forked from sourcenetwork/defradb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Reconfigure CodeCov action to ensure stability (sourcenetwork#1414)
## Relevant issue(s) Resolves sourcenetwork#1413 ## Description - Ensures Codecov doesn't run on every push (code coverage reports will only generate for every PR, or pushes on `master` and `develop`). This also means contributors don't need to have codecov to have a build run successfully on their fork pushes. - If for whatever reason the code cov token doesn't exist, still run the action (but might be flakey - so retry until passes up to 5 times). Future: Should probably rework this to do the `pull_request` -> trigger a `workflow_run` that will be passed the code coverage report that will then have the secrets in the second privileged action run. But until then hopefully this can get us by. ## How has this been tested? Fork pushes and this PR pushes.
- Loading branch information
1 parent
46ed728
commit 33a0ef3
Showing
8 changed files
with
51 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -12,9 +12,16 @@ name: Code Test Coverage Workflow | |
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
|
||
push: | ||
|
||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
code-test-coverage: | ||
|
@@ -25,10 +32,8 @@ jobs: | |
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Setup Go | ||
- name: Setup Go environment explicitly | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.19" | ||
|
@@ -37,9 +42,29 @@ jobs: | |
- name: Generate full test coverage report using go-acc | ||
run: make test:coverage | ||
|
||
- name: Upload coverage to Codecov | ||
- name: Upload coverage to Codecov without token, retry on failure | ||
env: | ||
codecov_secret: ${{ secrets.CODECOV_TOKEN }} | ||
if: env.codecov_secret == '' | ||
uses: Wandalen/[email protected] | ||
with: | ||
attempt_limit: 5 | ||
attempt_delay: 10000 | ||
action: codecov/codecov-action@v3 | ||
with: | | ||
fail_ci_if_error: true | ||
files: ./coverage.txt | ||
flags: defra-tests | ||
name: codecov-umbrella | ||
verbose: true | ||
- name: Upload coverage to Codecov with token | ||
env: | ||
codecov_secret: ${{ secrets.CODECOV_TOKEN }} | ||
if: env.codecov_secret != '' | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ env.codecov_secret }} | ||
fail_ci_if_error: true | ||
files: ./coverage.txt | ||
flags: defra-tests | ||
|
This file contains 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 |
---|---|---|
|
@@ -28,6 +28,9 @@ on: | |
- completed | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
deploy-ami-with-terraform: | ||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ on: | |
|
||
push: | ||
tags: | ||
- v* | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
branches: | ||
- master | ||
- develop | ||
|
This file contains 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 |
---|---|---|
|
@@ -12,6 +12,9 @@ name: Run Tests Workflow | |
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
|
||
push: | ||
|
||
|
This file contains 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