-
Notifications
You must be signed in to change notification settings - Fork 233
feat: codecov override with merge squash hash #2371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
35857cf
feat: ci codecov
SkArchon 9fa697a
fix: updates
SkArchon 951a031
fix: updates
SkArchon e25578b
fix: flag update
SkArchon 2b0a1fa
fix: updates
SkArchon d78a79b
fix: add router
SkArchon 7a4f4ab
fix: add router
SkArchon 2d97285
fix: test merge hash
SkArchon df1b4cf
fix: testing
SkArchon bffcc81
fix: router tests
SkArchon 17b63d3
fix: router updates
SkArchon 3396b25
fix: revert
SkArchon a74f748
fix: updates
SkArchon 472ca22
fix: specify branch
SkArchon 01c9157
fix: changes to ci
SkArchon b0e90a1
fix: update status
SkArchon 7e81751
fix: upload
SkArchon d7e9ee4
fix: proper upload
SkArchon 9e63709
fix: update workflow
SkArchon be4fbad
fix: sanitized
SkArchon 34639a3
updates
SkArchon b762eb1
fix: refactoring
SkArchon 1ef9acd
fix: refactoring
SkArchon ae33c06
fix: rabbit review
SkArchon 156b3e2
fix: comments
SkArchon 7ce3c62
fix: cli workflow
SkArchon aa75820
Merge branch 'main' into milinda/merge-codecov
SkArchon 266ceac
Merge branch 'main' into milinda/merge-codecov
SkArchon 1f0ce6f
fix: when there are no artifacts
SkArchon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: 'Codecov Download and Upload' | ||
| description: 'Download coverage artifacts from previous PR runs and upload to Codecov' | ||
|
|
||
| inputs: | ||
| coverage-path: | ||
| description: 'Path to coverage files' | ||
| required: true | ||
| workflow-paths: | ||
| description: 'Comma-separated list of workflow paths for artifact lookup (e.g., ".github/workflows/router-ci.yaml,.github/workflows/cli-ci.yaml")' | ||
| required: true | ||
| override-commit: | ||
| description: 'Commit SHA to override in Codecov' | ||
| required: true | ||
| merge-commit-sha: | ||
| description: 'Merge commit SHA to look up the PR and find head SHA' | ||
| required: false | ||
| default: '' | ||
| codecov-token: | ||
| description: 'Codecov token for uploading' | ||
| required: true | ||
| github-token: | ||
| description: 'GitHub token for artifact operations' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Find latest successful PR runs for this commit | ||
| id: find-artifacts | ||
| shell: bash | ||
| env: | ||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||
| REPO: ${{ github.repository }} | ||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| MERGE_COMMIT_SHA: ${{ inputs.merge-commit-sha }} | ||
| CURRENT_RUN_ID: ${{ github.run_id }} | ||
| ARTIFACT_NAME_PATTERN: codecov | ||
| WORKFLOW_PATHS: ${{ inputs.workflow-paths }} | ||
| run: ./.github/scripts/find-codecov-artifact.sh | ||
|
|
||
| - name: Download coverage artifacts | ||
| if: steps.find-artifacts.outputs.has_artifacts == 'true' | ||
| shell: bash | ||
| env: | ||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||
| REPO: ${{ github.repository }} | ||
| ARTIFACTS_JSON: ${{ steps.find-artifacts.outputs.artifacts_json }} | ||
| COVERAGE_PATH: ${{ inputs.coverage-path }} | ||
| run: ./.github/scripts/download-codecov-artifacts.sh | ||
|
|
||
| - name: Upload results to Codecov | ||
| if: steps.find-artifacts.outputs.has_artifacts == 'true' | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ inputs.codecov-token }} | ||
| override_commit: ${{ inputs.override-commit }} | ||
| override_branch: main | ||
| directory: ${{ inputs.coverage-path }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: 'Codecov Upload PR' | ||
| description: 'Upload coverage artifacts during PR and send to Codecov' | ||
|
|
||
| inputs: | ||
| artifact-name: | ||
| description: 'Name of the coverage artifact' | ||
| required: false | ||
| default: 'pr-build' | ||
| coverage-path: | ||
| description: 'Path to coverage files' | ||
| required: true | ||
| retention-days: | ||
| description: 'Days to retain the artifact' | ||
| required: false | ||
| default: '7' | ||
| codecov-token: | ||
| description: 'Codecov token for uploading' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Upload artifact for PR | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| overwrite: true | ||
| name: codecov-pr-build-${{ inputs.artifact-name }} | ||
| path: ${{ inputs.coverage-path }} | ||
| retention-days: ${{ inputs.retention-days }} | ||
|
|
||
| - name: Upload results to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ inputs.codecov-token }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This script downloads coverage artifacts from GitHub Actions runs. | ||
| # | ||
| # Required environment variables: | ||
| # GITHUB_TOKEN: Required for GitHub CLI authentication | ||
| # REPO: GitHub repository (e.g., owner/repo) | ||
| # ARTIFACTS_JSON: JSON array of artifacts to download (from find-codecov-artifact.sh output) | ||
| # COVERAGE_PATH: Directory where artifacts should be downloaded | ||
| # | ||
|
|
||
| set -e | ||
|
|
||
| GITHUB_TOKEN="${GITHUB_TOKEN:?GITHUB_TOKEN environment variable is required}" | ||
| REPO="${REPO:?REPO environment variable is required}" | ||
| ARTIFACTS_JSON="${ARTIFACTS_JSON:?ARTIFACTS_JSON environment variable is required}" | ||
| COVERAGE_PATH="${COVERAGE_PATH:?COVERAGE_PATH environment variable is required}" | ||
|
|
||
| echo "Downloading artifacts..." | ||
|
|
||
| # Validate JSON before processing | ||
| if ! echo "$ARTIFACTS_JSON" | jq empty 2>/dev/null; then | ||
| echo "ERROR: Invalid JSON received from artifact discovery step" >&2 | ||
| echo "JSON content (truncated to 500 chars):" >&2 | ||
| echo "$ARTIFACTS_JSON" | head -c 500 >&2 | ||
| echo "" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "$ARTIFACTS_JSON" | jq -c '.[]' | while read -r artifact; do | ||
| run_id=$(echo "$artifact" | jq -r '.run_id') | ||
| artifact_id=$(echo "$artifact" | jq -r '.artifact_id') | ||
| artifact_name=$(echo "$artifact" | jq -r '.artifact_name') | ||
|
|
||
| echo "Downloading artifact: $artifact_name (ID: $artifact_id) from run: $run_id" | ||
|
|
||
| # Download artifact using GitHub CLI | ||
| gh run download "$run_id" \ | ||
| --repo "$REPO" \ | ||
| --name "$artifact_name" \ | ||
| --dir "$COVERAGE_PATH/$artifact_name" | ||
|
|
||
| if [ $? -eq 0 ]; then | ||
| echo "✓ Successfully downloaded $artifact_name" | ||
| else | ||
| echo "✗ Failed to download $artifact_name" >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| echo "All artifacts downloaded successfully" | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.