-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (52 loc) · 1.46 KB
/
ci.yml
File metadata and controls
65 lines (52 loc) · 1.46 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 6 * * 1"
permissions:
contents: read
jobs:
test:
name: Test (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.25", "1.26"]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: false
- name: Vet
run: go vet ./...
- name: Lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.10
- name: Check formatting
run: |
go install mvdan.cc/gofumpt@latest
diff <(gofumpt -d .) <(echo -n)
- name: Test
run: go test -race -coverprofile=coverage.out -coverpkg=github.com/rdapapi/rdapapi-go ./...
- name: Check coverage
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
echo "Coverage: ${COVERAGE}%"
if [ "$(echo "$COVERAGE < 100" | bc)" -eq 1 ]; then
echo "::error::Coverage is ${COVERAGE}%, expected 100%"
exit 1
fi
- name: Build
run: go build ./...
- name: Build examples
run: go build ./examples/...
- name: Vulnerability check
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...