diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d05e3809c8..c113c76b25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,11 +22,18 @@ jobs: WITH_ASAN: ${{ matrix.WITH_ASAN }} COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} COVERALLS_SERVICE_NAME: "GitHub Actions" + UPLOAD_COVERALLS: "false" steps: - name: Checkout repository contents uses: actions/checkout@v3 + - name: Set RUN_COVERALLS Environment Variable + if: (github.event.pull_request.merged == true || github.event_name == 'push') && env.WITH_ASAN != 'true' + run: | + echo "Setting UPLOAD_COVERALLS to true" + echo "UPLOAD_COVERALLS=true" >>${GITHUB_ENV} + - name: Build run: | docker run \ @@ -34,5 +41,5 @@ jobs: -e WITH_ASAN="${{ env.WITH_ASAN }}" \ -e COVERALLS_REPO_TOKEN="${{ env.COVERALLS_REPO_TOKEN }}" \ -e COVERALLS_SERVICE_NAME="${{ env.COVERALLS_SERVICE_NAME }}" \ - -e EVENT_NAME="${{ github.event_name }}" \ + -e UPLOAD_COVERALLS="${{ env.UPLOAD_COVERALLS }}" \ -v $PWD:$PWD ubuntu:20.04 $PWD/.github/workflows/start.sh diff --git a/ci/build.sh b/ci/build.sh index 723e1441f4..930fb5ac0d 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -58,8 +58,8 @@ if [ "${WITH_ASAN:-}" = "true" ]; then else make -j4 test fi - -if [ "${EVENT_NAME:-}" = "push" ] && [ "${WITH_ASAN:-}" != "true" ] && [ -n "${COVERALLS_REPO_TOKEN:-}" ]; then + +if "${UPLOAD_COVERALLS:-}" = "true" ]; then echo "uploading to coveralls" git config --global --add safe.directory "${WORK_DIR:=..}" ln -s ../../../src/mapparser.y build/CMakeFiles/mapserver.dir/