Skip to content

Commit

Permalink
Run testcoverage in its own action
Browse files Browse the repository at this point in the history
  • Loading branch information
storvik committed Jan 10, 2024
1 parent 6f86d33 commit b1568d5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,4 @@ jobs:
- name: Run gotests
run: |
nix develop --command \
go test -v ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
local-prefix: github.com/storvik/goshrt
threshold-file: 50
threshold-package: 60
threshold-total: 80
git-token: ${{ github.ref_name == 'master' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges
go test -v ./...
30 changes: 30 additions & 0 deletions .github/workflows/testcoverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: test coverage
on: [push]
jobs:
testcoverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install nix
uses: nixbuild/nix-quick-install-action@v22
with:
nix_conf: experimental-features = nix-command flakes
- name: Start postgres database
run: |
nix develop --command \
pgnix-init
- name: Run gotests
run: |
nix develop --command \
go test -v ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
local-prefix: github.com/storvik/goshrt
threshold-file: 50
threshold-package: 60
threshold-total: 80
git-token: ${{ github.ref_name == 'master' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div align="center">
<a href="https://goreportcard.com/report/github.com/storvik/goshrt"><img src="https://goreportcard.com/badge/github.com/storvik/goshrt" /></a> &nbsp;
<a href="https://github.com/storvik/goshrt/actions/workflows/lint.yml"><img src="https://github.com/storvik/goshrt/actions/workflows/lint.yml/badge.svg?branch=master" /></a> &nbsp;
<a href="https://github.com/storvik/goshrt/actions/workflows/gotest.yml"><img src="https://raw.githubusercontent.com/org/project/badges/.badges/main/coverage.svg" /></a> &nbsp;
<a href="https://github.com/storvik/goshrt/actions/workflows/testcoverage.yml"><img src="https://raw.githubusercontent.com/storvik/goshrt/badges/.badges/master/coverage.svg" /></a> &nbsp;
<a href="https://github.com/storvik/goshrt/actions/workflows/vuln.yml"><img src="https://github.com/storvik/goshrt/actions/workflows/vuln.yml/badge.svg" /></a>
</div>

Expand Down

0 comments on commit b1568d5

Please sign in to comment.