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
17 changes: 15 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,19 @@ 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
run: go get -v -t -d ./...
- name: Run tests
run: go test main_test.go main.go
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
Loading