Skip to content

Commit

Permalink
Update based on PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <[email protected]>
  • Loading branch information
AndreKurait committed Nov 14, 2024
1 parent b4ecd8d commit d5c7aa2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
41 changes: 21 additions & 20 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ 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:
Expand Down Expand Up @@ -77,26 +98,6 @@ jobs:
name: coverage-reports-python-tests-${{ env.SANITIZED_PY_PROJECT }}
path: ${{ env.WORKING_DIR }}/coverage.xml

upload-codecov-info:
runs-on: ubuntu-latest
steps:
- name: Create JSON Artifact
run: |
echo '{' > codecov_info.json
echo ' "pr_number": "${{ github.event.pull_request.number }}",' >> codecov_info.json
echo ' "commit": "${{ github.event.pull_request.head.sha || github.event.after || github.sha }}",' >> codecov_info.json
echo ' "branch": "${{ github.ref }}",' >> codecov_info.json
echo ' "commit_parent": "${{ github.event.pull_request.base.sha || github.event.before || github.base.sha }}",' >> codecov_info.json
echo ' "build_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",' >> codecov_info.json
echo ' "build": "${{ github.run_id }}"' >> codecov_info.json
echo '}' >> codecov_info.json
echo "codecov_info.json created"
- name: Upload JSON Artifact
uses: actions/upload-artifact@v4
with:
name: codecov-info
path: codecov_info.json


gradle-tests:
runs-on: ubuntu-latest
Expand Down
26 changes: 12 additions & 14 deletions .github/workflows/codecov-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,23 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Download CodeCov Info
- name: Download Workflow Info
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: codecov-info
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[]' ./codecov_info.json); do
value=$(jq -r --arg key "$key" '.[$key]' ./codecov_info.json)
echo "codecov_info_$key=$value"
echo "codecov_info_$key=$value" >> $GITHUB_ENV
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:
github-token: ${{ secrets.GITHUB_TOKEN }}
path: ./coverage-reports
pattern: coverage-reports-*
run-id: ${{ github.event.workflow_run.id }}
Expand All @@ -46,11 +44,11 @@ jobs:
fail_ci_if_error: true
files: /**/coverage-reports/**/*.*
flags: unittests
override_branch: ${{ env.codecov_info_branch }}
override_commit: ${{ env.codecov_info_commit }}
override_pr: ${{ env.codecov_info_pr_number }}
commit_parent: ${{ env.codecov_info_commit_parent }}
override_build_url: ${{ env.codecov_info_build_url }}
override_build: ${{ env.codecov_info_build }}
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

0 comments on commit d5c7aa2

Please sign in to comment.