-
Notifications
You must be signed in to change notification settings - Fork 71
Split test-with-coverage.yml workflow in two pieces: ci-pr (untrusted… #1229
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
Changes from all commits
57efb96
9fbfc40
3b45ae6
8f8944b
b6df27c
996affd
425d194
182ee22
48feb6c
389bc30
badc443
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,38 @@ | ||
| name: ci-build | ||
| name: test-with-coverage | ||
| on: | ||
| pull_request: | ||
| branches: [ master ] | ||
| push: | ||
| branches: | ||
| - master | ||
| tags-ignore: | ||
| - '*.*' | ||
| pull_request_target: | ||
| types: [ opened, synchronize, reopened, ready_for_review ] | ||
| branches: | ||
| - master | ||
| - '*.*' | ||
|
|
||
| jobs: | ||
| test-with-coverage: | ||
| name: Test with Coverage | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{github.event.pull_request.head.ref}} | ||
| repository: ${{github.event.pull_request.head.repo.full_name}} | ||
| fetch-depth: 0 | ||
| - name: Checkout PR code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: generate | ||
| run: | | ||
| make generate | ||
| - name: generate | ||
| run: | | ||
| make generate | ||
|
|
||
| - name: Test | ||
| run: | | ||
| make test-with-coverage | ||
| - name: Test | ||
| run: | | ||
| make test-with-coverage | ||
|
|
||
| - name: Upload code coverage | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./build/_output/coverage/coverage.txt | ||
| flags: unittests # optional | ||
| fail_ci_if_error: true # optional (default = false) | ||
| verbose: true # optional (default = false) | ||
| - name: Upload coverage artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage | ||
| path: ./build/_output/coverage/coverage.txt | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: upload-coverage | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_run: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflows: [ test-with-coverage ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [ completed ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| upload-coverage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: > | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| github.event.workflow_run.conclusion == 'success' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Download coverage artifact | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/download-artifact@v7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: coverage | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run-id: ${{ github.event.workflow_run.id }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload to Codecov | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: codecov/codecov-action@v5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # The 'files' attribute consists of 'coverage/coverage.txt'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # The 'coverage' directory is created upon the download of the coverage artifact from previous step (it creates a directory with the name of the artifact). | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| files: coverage/coverage.txt | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| flags: unittests # optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail_ci_if_error: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+21
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: When your upload job runs on To get the commit SHA that the triggering workflow actually ran for, use the
For on:
workflow_run:
workflows: ["CI"]
types: [completed]
jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}Sources: GitHub Actions 🏁 Script executed: cat .github/workflows/upload-coverage.ymlRepository: codeready-toolchain/host-operator Length of output: 763 Add When using Required fix steps:
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
+ - name: Checkout triggering workflow commit
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.workflow_run.head_sha }}
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/_output/coverage/coverage.txt
fail_ci_if_error: true📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| verbose: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codeready-toolchain/registration-service@468f6e9