Skip to content
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

test: consolidate tests and add code coverage #145

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for now. Eventually, we've talked about moving this workflow to an external location (i.e. witness GHA repo). We may want a generic "post" step for the job. The go-witness repo has an upload artifact step today as a "post" step.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was struggling with it while designing how to add the upload to codecov.
I couldn't retrieve it from the artifact.

Another alternative is to use the codecov client ( (it is documented by codecov), but I don't like this curl approach. So, I could add it to the pipeline.yml right after the make tests.

curl -Os https://uploader.codecov.io/latest/linux/codecov

chmod +x codecov
./codecov

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened the issue #146 for it.

uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d