Skip to content

Commit

Permalink
fix(CI): ensure go test command has sufficient timeout (#144)
Browse files Browse the repository at this point in the history
* fix(CI): ensure test command has sufficient timeout

* fix: apply project flag to default status

* fix: apply flag to published report

* fix: pass status checks when no changes found

* fix: skip coverage if no tests are run
  • Loading branch information
coffeebeats authored Nov 7, 2023
1 parent d900645 commit eb646a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flags:
project:
gdenv:
carryforward: true
paths:
- "*"
39 changes: 3 additions & 36 deletions .github/workflows/check-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,45 +142,20 @@ jobs:

- name: Test source code
shell: bash
run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./...

- name: Upload coverage report artifact
uses: actions/upload-artifact@v3
with:
name: coverage.out
path: coverage.out
if-no-files-found: error

coverage:
needs: ["test"]
if: |
always() &&
needs.test.result == 'success' ||
needs.test.result == 'skipped'
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v4

- name: Download coverage report artifact
uses: actions/download-artifact@v3
continue-on-error: true # OK if coverage is missing.
with:
name: coverage.out
run: go test -v -race -timeout 16m -covermode=atomic -coverprofile=coverage.out ./...

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: gdenv
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

# Used to ensure all branch protection requirements are met. This is a workaround until
# https://github.com/github-community/community/discussions/4324 is addressed.
branch_protection:
needs: ["coverage", "format", "lint", "build", "test"]
needs: ["format", "lint", "build", "test"]
if: ${{ always() }}

runs-on: ubuntu-latest
Expand All @@ -191,14 +166,6 @@ jobs:
shell: bash

steps:
- name: Verify 'coverage' status
if: |
always() &&
needs.coverage.result == 'failure' ||
needs.coverage.result == 'cancelled'
shell: bash
run: exit 1

- name: Verify 'format' status
if: |
always() &&
Expand Down

0 comments on commit eb646a8

Please sign in to comment.