Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): modify JUnit output file to properly name packages for BuildPulse #12434

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ jobs:
submodules: 'recursive'
- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- run: go install gotest.tools/gotestsum@latest
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Restore cached make deps outputs
uses: actions/cache/restore@v4
with:
Expand All @@ -257,10 +258,12 @@ jobs:
path: ${{ needs.cache.outputs.fetch_params_path }}
fail-on-cache-miss: true
# TODO: Install statediff (used to be used for conformance)
- id: reports
- name: Create temporary directory for reports
id: reports
run: mktemp -d | xargs -0 -I{} echo "path={}" | tee -a $GITHUB_OUTPUT
# TODO: Track coverage (used to be tracked for conformance)
- env:
- name: Run tests
env:
NAME: ${{ matrix.name }}
LOTUS_SRC_DIR: ${{ github.workspace }}
REPORTS_PATH: ${{ steps.reports.outputs.path }}
Expand All @@ -275,6 +278,25 @@ jobs:
--jsonfile "$REPORTS_PATH/$NAME.json" \
--packages="$PACKAGES" \
-- ${{ matrix.go_test_flags || '' }}
- name: Modify junit.xml for BuildPulse
env:
NAME: ${{ matrix.name }}
REPORTS_PATH: ${{ steps.reports.outputs.path }}
PACKAGES: ${{ join(matrix.packages, ' ') }}
if: always()
run: |
# Modify test suite name and classname attributes in JUnit XML for better grouping
# in BuildPulse. itests are run with go test ./itests/file_test.go and therefore Go
# assigns the name and classname attributes to "command-line-arguments". Others get the
# package name for both.
if [[ "${{ matrix.name }}" == itest-* ]]; then
PACKAGE_NAME=$(basename "$PACKAGES" .go)
sed -i 's/ name="command-line-arguments"/ name="itests"/g' "$REPORTS_PATH/$NAME.xml"
sed -i 's/classname="command-line-arguments"/classname="'"$PACKAGE_NAME"'"/g' "$REPORTS_PATH/$NAME.xml"
else
sed -i 's# name="github.com/filecoin-project/lotus/\(.*\)"# name="'${{ matrix.name }}':\1"#g' "$REPORTS_PATH/$NAME.xml"
fi
cat "$REPORTS_PATH/$NAME.xml"
BigLep marked this conversation as resolved.
Show resolved Hide resolved
- if: success() || failure()
uses: actions/upload-artifact@v4
with:
Expand Down