Manually upload coverage report instead of using codecov-action.

This commit is contained in:
binary1248 2023-03-16 04:02:39 +01:00 committed by Chris Thrasher
parent 641cf54cc3
commit 6ca627ee9d

View File

@ -6,6 +6,8 @@ jobs:
build: build:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }} name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}
runs-on: ${{ matrix.platform.os }} runs-on: ${{ matrix.platform.os }}
env:
HAVE_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -108,14 +110,32 @@ jobs:
if: matrix.type.name == 'Debug' && runner.os != 'Windows' # Coverage is already generated on Windows when running tests. if: matrix.type.name == 'Debug' && runner.os != 'Windows' # Coverage is already generated on Windows when running tests.
run: gcovr -r $GITHUB_WORKSPACE -x $GITHUB_WORKSPACE/build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE run: gcovr -r $GITHUB_WORKSPACE -x $GITHUB_WORKSPACE/build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE
- name: Download Codecov Uploader
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' && env.HAVE_CODECOV_TOKEN == 'true' # Disable upload in forks and when Codecov token isn't available
shell: bash
run: |
platform=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
if [ "$platform" == "windows" ]; then CODECOV_BINARY="codecov.exe"; else CODECOV_BINARY="codecov"; fi
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -s --remote-name-all "https://uploader.codecov.io/latest/$platform/{$CODECOV_BINARY,$CODECOV_BINARY.SHA256SUM,$CODECOV_BINARY.SHA256SUM.sig}"
gpgv "$CODECOV_BINARY.SHA256SUM.sig" "$CODECOV_BINARY.SHA256SUM"
if [ "$platform" == "windows" ]; then powershell 'If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) {echo "codecov: OK"} Else {exit 1}';
else shasum -a 256 -c codecov.SHA256SUM; fi
chmod +x "$CODECOV_BINARY"
echo "CODECOV_BINARY=$CODECOV_BINARY" >> $GITHUB_ENV
- name: Upload Coverage Report to Codecov - name: Upload Coverage Report to Codecov
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' && env.HAVE_CODECOV_TOKEN == 'true' # Disable upload in forks and when Codecov token isn't available
uses: codecov/codecov-action@v3 env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
uses: nick-fields/retry@v2
with: with:
token: ${{ secrets.CODECOV_TOKEN }} timeout_seconds: 30
directory: ./build max_attempts: 10
files: ./build/coverage.out retry_wait_seconds: 60
fail_ci_if_error: true warning_on_retry: false
shell: bash
command: ./${{ env.CODECOV_BINARY }} -n "${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}" -Z -f ./build/coverage.out -C ${{ github.sha }} -s ./build -e CODECOV_TOKEN,GITHUB_ACTION,GITHUB_RUN_ID,GITHUB_REF,GITHUB_REPOSITORY,GITHUB_SHA,GITHUB_HEAD_REF
- name: Test Install Interface - name: Test Install Interface
if: matrix.platform.name != 'Android' && matrix.config.name != 'iOS' if: matrix.platform.name != 'Android' && matrix.config.name != 'iOS'