From 0c3acd786cb409bd91ff9ef8dd40b4cfd0b3de95 Mon Sep 17 00:00:00 2001 From: Andre Kurait Date: Thu, 21 Nov 2024 16:30:18 -0600 Subject: [PATCH] Move back to tokenless pr codecov with v5 fixes Signed-off-by: Andre Kurait --- .github/workflows/CI.yml | 50 +++++++++++++---------- .github/workflows/codecov-publish.yml | 58 --------------------------- 2 files changed, 28 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/codecov-publish.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4c6e1c36e..7a72a9dae 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,27 +11,6 @@ env: node-version: '18.x' jobs: - workflow-info: - runs-on: ubuntu-latest - steps: - - name: Create JSON Artifact - run: | - echo '{' > workflow-info.json - echo ' "pr_number": "${{ github.event.pull_request.number }}",' >> workflow-info.json - echo ' "commit": "${{ github.event.pull_request.head.sha || github.event.after || github.sha }}",' >> workflow-info.json - echo ' "branch": "${{ github.ref }}",' >> workflow-info.json - echo ' "commit_parent": "${{ github.event.pull_request.base.sha || github.event.before || github.base.sha }}",' >> workflow-info.json - echo ' "build_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",' >> workflow-info.json - echo ' "build": "${{ github.run_id }}"' >> workflow-info.json - echo '}' >> workflow-info.json - echo "workflow-info.json created" - - name: Upload JSON Artifact - uses: actions/upload-artifact@v4 - with: - name: workflow-info - path: workflow-info.json - - style-check: runs-on: ubuntu-latest steps: @@ -85,13 +64,19 @@ jobs: - run: | python3 -m pip install --upgrade pipenv pipenv install --deploy --dev - pipenv run test + pipenv run test || TEST_FAILED=true pipenv run coverage xml + if [ "$TEST_FAILED" = true ]; then + echo "Tests failed, exiting step with error" + exit 1 + fi - name: Get Sanitized Name + if: always() env: PY_PROJECT: ${{ matrix.py-project }} run: echo "SANITIZED_PY_PROJECT=${PY_PROJECT/\//-}" >> $GITHUB_ENV - name: Upload Coverage Reports + if: always() uses: actions/upload-artifact@v4 with: if-no-files-found: error @@ -129,6 +114,7 @@ jobs: **/build/reports/tests/ **/reports/jacoco/mergedReport/ - name: Upload Coverage Reports + if: always() uses: actions/upload-artifact@v4 with: if-no-files-found: error @@ -235,6 +221,26 @@ jobs: env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + codecov-test: + needs: + - gradle-tests + - console-python-tests + if: always() + runs-on: ubuntu-latest + steps: + - name: Download Coverage Artifacts + uses: actions/download-artifact@v4 + with: + path: ./coverage-reports + pattern: coverage-reports-* + - name: Upload coverage report + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: true + files: /**/coverage-reports/**/*.* + flags: unittests + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true all-ci-checks-pass: needs: diff --git a/.github/workflows/codecov-publish.yml b/.github/workflows/codecov-publish.yml deleted file mode 100644 index 23c666b8e..000000000 --- a/.github/workflows/codecov-publish.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Codecov Publish - -# Due to the behavior of workflow_run, changes to this file will -# only be reflected once it is pushed up to the `default` (main) branch -# -# It is recommended to test changes to this file by pushing to the default branch -# on a fork and evaluating the correctness of the action execution - -on: - workflow_run: - workflows: [CI] - types: - - completed - -jobs: - publish-codecov: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - steps: - - name: Download Workflow Info - uses: actions/download-artifact@v4 - with: - # Needed for cross run downloading - github-token: ${{ secrets.GITHUB_TOKEN }} - name: workflow-info - run-id: ${{ github.event.workflow_run.id }} - - name: Set Environment Variables from JSON - run: | - ls - # Read the JSON file and export each key-value pair as an environment variable - for key in $(jq -r 'keys[]' ./workflow-info.json); do - value=$(jq -r --arg key "$key" '.[$key]' ./workflow-info.json) - echo "workflow-info_$key=$value" - echo "workflow-info_$key=$value" >> $GITHUB_ENV - done - - name: Download Coverage Artifacts - uses: actions/download-artifact@v4 - with: - # Needed for cross run downloading - github-token: ${{ secrets.GITHUB_TOKEN }} - path: ./coverage-reports - pattern: coverage-reports-* - run-id: ${{ github.event.workflow_run.id }} - - - name: Upload coverage report - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - files: /**/coverage-reports/**/*.* - flags: unittests - override_branch: ${{ env.workflow-info_branch }} - override_commit: ${{ env.workflow-info_commit }} - override_pr: ${{ env.workflow-info_pr_number }} - commit_parent: ${{ env.workflow-info_commit_parent }} - override_build_url: ${{ env.workflow-info_build_url }} - override_build: ${{ env.workflow-info_build }} - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true