From: Marten Seemann Date: Mon, 9 Jun 2025 07:09:30 +0000 (+0800) Subject: ci: enable Codecov test analysis (#5210) X-Git-Url: https://git.feebdaed.xyz/?a=commitdiff_plain;h=6f2a3f1a1cd7b5219bad08e06704d060025db151;p=0xmirror%2Fquic-go.git ci: enable Codecov test analysis (#5210) * ci: enable Codecov test analysis * ci: set package name for pre-built test binary --- diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f762af33..de739225 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -36,6 +36,8 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} + - name: Install go-junit-report + run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 - name: Set qlogger if: env.DEBUG == 'true' run: echo "QLOGFLAG= -qlog" >> $GITHUB_ENV @@ -47,25 +49,25 @@ jobs: run: echo "GOARCH=386" >> $GITHUB_ENV - run: go version - name: Run tools tests - run: go test ${{ env.RACEFLAG }} -v -timeout 30s -shuffle=on ./integrationtests/tools/... + run: go test ${{ env.RACEFLAG }} -v -timeout 30s -shuffle=on ./integrationtests/tools/... 2>&1 | go-junit-report -set-exit-code -iocopy -out report_tools.xml - name: Run version negotiation tests - run: go test ${{ env.RACEFLAG }} -v -timeout 30s -shuffle=on ./integrationtests/versionnegotiation ${{ env.QLOGFLAG }} + run: go test ${{ env.RACEFLAG }} -v -timeout 30s -shuffle=on ./integrationtests/versionnegotiation ${{ env.QLOGFLAG }} 2>&1 | go-junit-report -set-exit-code -iocopy -out report_versionnegotiation.xml - name: Run self tests, using QUIC v1 if: success() || failure() # run this step even if the previous one failed - run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=1 ${{ env.QLOGFLAG }} + run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=1 ${{ env.QLOGFLAG }} 2>&1 | go-junit-report -set-exit-code -iocopy -out report_self.xml - name: Run self tests, using QUIC v2 if: ${{ !matrix.race && (success() || failure()) }} # run this step even if the previous one failed - run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=2 ${{ env.QLOGFLAG }} + run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=2 ${{ env.QLOGFLAG }} 2>&1 | go-junit-report -set-exit-code -iocopy -out report_self_v2.xml - name: Run self tests, with GSO disabled if: ${{ matrix.os == 'ubuntu' && (success() || failure()) }} # run this step even if the previous one failed env: QUIC_GO_DISABLE_GSO: true - run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=1 ${{ env.QLOGFLAG }} + run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=1 ${{ env.QLOGFLAG }} 2>&1 | go-junit-report -set-exit-code -iocopy -out report_self_nogso.xml - name: Run self tests, with ECN disabled if: ${{ !matrix.race && matrix.os == 'ubuntu' && (success() || failure()) }} # run this step even if the previous one failed env: QUIC_GO_DISABLE_ECN: true - run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=1 ${{ env.QLOGFLAG }} + run: go test ${{ env.RACEFLAG }} -v -timeout 5m -shuffle=on ./integrationtests/self -version=1 ${{ env.QLOGFLAG }} 2>&1 | go-junit-report -set-exit-code -iocopy -out report_self_noecn.xml - name: Run benchmarks if: ${{ !matrix.race }} run: go test -v -run=^$ -timeout 5m -shuffle=on -bench=. ./integrationtests/self @@ -76,3 +78,11 @@ jobs: name: qlogs-${{ matrix.os }}-go${{ matrix.go }}-race${{ matrix.race }}${{ matrix.use32bit && '-32bit' || '' }} path: integrationtests/self/*.qlog retention-days: 7 + - name: Upload report to Codecov + if: ${{ !cancelled() && !matrix.race && !matrix.use32bit }} + uses: codecov/test-results-action@v1 + with: + name: Unit tests + files: report_tools.xml,report_versionnegotiation.xml,report_self.xml,report_self_v2.xml,report_self_nogso.xml,report_self_noecn.xml + env_vars: OS,GO + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index e5171361..7bd7581a 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -17,13 +17,15 @@ jobs: with: go-version: ${{ matrix.go }} - run: go version + - name: Install go-junit-report + run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 - name: Remove integrationtests shell: bash run: rm -rf integrationtests - name: Run tests env: TIMESCALE_FACTOR: 10 - run: go test -v -shuffle on -cover -coverprofile coverage.txt ./... + run: go test -v -shuffle on -cover -coverprofile coverage.txt ./... 2>&1 | go-junit-report -set-exit-code -iocopy -out report.xml - name: Run tests as root if: ${{ matrix.os == 'ubuntu' }} env: @@ -33,22 +35,23 @@ jobs: test -f $FILE # make sure the file actually exists TEST_NAMES=$(grep '^func Test' "$FILE" | sed 's/^func \([A-Za-z0-9_]*\)(.*/\1/' | tr '\n' '|') go test -c -cover -tags root -o quic-go.test . - sudo ./quic-go.test -test.v -test.run "${TEST_NAMES%|}" -test.coverprofile coverage-root.txt + sudo ./quic-go.test -test.v -test.run "${TEST_NAMES%|}" -test.coverprofile coverage-root.txt 2>&1 | go-junit-report -set-exit-code -iocopy -package-name github.com/quic-go/quic-go -out report_root.xml rm quic-go.test - name: Run tests (32 bit) - if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX. + if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on macOS env: TIMESCALE_FACTOR: 10 GOARCH: 386 - run: go test -v -shuffle on -cover -coverprofile coverage.txt ./... + run: go test -v -shuffle on ./... - name: Run tests with race detector if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow env: TIMESCALE_FACTOR: 20 - run: go test -v -shuffle on -cover -coverprofile coverage.txt $(go list ./... | grep -v integrationtests) + run: go test -v -shuffle on ./... - name: Run benchmark tests run: go test -v -run=^$ -benchtime 0.5s -bench=. ./... - name: Upload coverage to Codecov + if: ${{ !cancelled() }} uses: codecov/codecov-action@v5 env: OS: ${{ matrix.os }} @@ -57,3 +60,11 @@ jobs: files: coverage.txt,coverage-root.txt env_vars: OS,GO token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload report to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + name: Unit tests + files: report.xml,report_root.xml + env_vars: OS,GO + token: ${{ secrets.CODECOV_TOKEN }}