-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (32 loc) · 1.04 KB
/
Copy pathtest.yml
File metadata and controls
35 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: test
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.24"
cache: true
# Cross-module deps (github.com/ubgo/cache, ...) resolve from their
# published pseudo-versions via the default module proxy — no sibling
# checkout or replace directive needed.
- name: vet
run: go vet ./...
- name: gofmt
run: test -z "$(gofmt -l .)"
- name: test (race + coverage)
run: go test -race -count=2 -coverprofile=cover.out ./...
- name: coverage floor gate
run: |
go test -coverprofile=cover.out -covermode=atomic ./...
TOTAL=$(go tool cover -func=cover.out | tail -1 | grep -oE '[0-9.]+' | tail -1)
FLOOR=95
echo "coverage: $TOTAL% (floor: $FLOOR%)"
if awk "BEGIN{exit !($TOTAL < $FLOOR)}"; then echo "coverage $TOTAL% below floor $FLOOR%"; exit 1; fi