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

chore: track code coverage in PRs #5312

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
18 changes: 16 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
pull_request:

permissions:
contents: read # to fetch code (actions/checkout)
pull-requests: write # required for posting comments
contents: write # required for git push

jobs:
build:
Expand All @@ -16,7 +17,20 @@ jobs:
container: golang:latest
steps:
- uses: actions/checkout@v3
- name: Verify Changed files
id: verify-changed-files
uses: tj-actions/verify-changed-files@v20
with:
files: !*.md
- name: Get dependencies
if: steps.verify-changed-files.outputs.files_changed == 'true'
kilianc marked this conversation as resolved.
Show resolved Hide resolved
run: go get -v -t -d ./...
- name: Run tests
run: go test main_test.go main.go
if: steps.verify-changed-files.outputs.files_changed == 'true'
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to run tests still, only skip the coverage step please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looks like it's not working either way :(

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kilianc can you enable github actions and github pages for your fork for cover branch and try and run it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done: kilianc#1 (comment)

but the action to detect changes is borked, I am going to use git directly or find a new one if that's ok

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure

kilianc marked this conversation as resolved.
Show resolved Hide resolved
run: go test -coverprofile=cover.out main_test.go main.go
- name: Install Vim
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: apt-get update; apt-get install -y vim;
phanirithvij marked this conversation as resolved.
Show resolved Hide resolved
- name: Go Beautiful HTML Coverage
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: gha-common/go-beautiful-html-coverage@v1
kilianc marked this conversation as resolved.
Show resolved Hide resolved