Skip to content

Commit

Permalink
test: consolidate tests and add code coverage
Browse files Browse the repository at this point in the history
This commit consolidates the `tests` and `e2e` tests in one.
The command `make tests` already run all the tests (unit and e2e).

This commit also includes in witness.yml the action to save the
cover.out to be used later by the pipeline to download the cover.out and
upload to the CodeCov.

Signed-off-by: Kairo de Araujo <[email protected]>
  • Loading branch information
kairoaraujo committed Jan 4, 2024
1 parent 38cbab0 commit 5ca9282
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,19 @@ jobs:
attestations: "github"
command: go vet ./...

test:
tests:
needs: [fmt, static_analysis]
uses: ./.github/workflows/witness.yml
with:
pull_request: ${{ github.event_name == 'pull_request' }}
step: "test"
attestations: "github"
command: go test -v -coverprofile=profile.cov -covermode=atomic ./...

e2e-tests:
needs: test
uses: ./.github/workflows/witness.yml
with:
pull_request: ${{ github.event_name == 'pull_request' }}
step: "e2e"
step: "tests"
attestations: "github"
command: |
make clean
make test
release:
needs: e2e-tests
needs: tests
permissions:
id-token: write
contents: write
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/witness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ jobs:
step: ${{ inputs.step }}
attestations: ${{ inputs.attestations }}
command: /bin/sh -c "${{ inputs.command }}"

- if: ${{ inputs.pull_request == true }}
run: ${{ inputs.command }}

- if: ${{ inputs.step == 'tests' }}
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d

0 comments on commit 5ca9282

Please sign in to comment.