diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b38982ab05..2794d7526e7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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 }} @@ -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" - if: success() || failure() uses: actions/upload-artifact@v4 with: