Since the CODECOV_TOKEN secret isn't being made available to every pull request, revert to having the Codecov uploader auto-detect.

This commit is contained in:
binary1248 2023-03-24 02:18:46 +01:00 committed by Lukas Dürrenberger
parent b510042b0d
commit 05d9f2046a

View File

@ -6,8 +6,6 @@ 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
@ -111,7 +109,7 @@ jobs:
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 - 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 if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
shell: bash shell: bash
run: | run: |
platform=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') platform=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
@ -125,9 +123,7 @@ jobs:
echo "CODECOV_BINARY=$CODECOV_BINARY" >> $GITHUB_ENV 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' && env.HAVE_CODECOV_TOKEN == 'true' # Disable upload in forks and when Codecov token isn't available if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
uses: nick-fields/retry@v2 uses: nick-fields/retry@v2
with: with:
timeout_seconds: 30 timeout_seconds: 30
@ -137,7 +133,7 @@ jobs:
shell: bash shell: bash
command: | command: |
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then COMMIT_OVERRIDE="-C ${{ github.event.pull_request.head.sha }}"; fi if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then COMMIT_OVERRIDE="-C ${{ github.event.pull_request.head.sha }}"; fi
./${{ env.CODECOV_BINARY }} -n "${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}" -Z -f ./build/coverage.out $COMMIT_OVERRIDE -s ./build -e CODECOV_TOKEN,GITHUB_ACTION,GITHUB_RUN_ID,GITHUB_REF,GITHUB_REPOSITORY,GITHUB_SHA,GITHUB_HEAD_REF ./${{ env.CODECOV_BINARY }} -n "${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}" -Z -f ./build/coverage.out $COMMIT_OVERRIDE -s ./build -e 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'