-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (107 loc) · 3.64 KB
/
Copy pathci.yml
File metadata and controls
117 lines (107 loc) · 3.64 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION: "1.26.2"
jobs:
test:
name: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- run: go mod download
- run: go mod verify
- name: Build
run: go build ./...
- name: Vet
run: go vet ./...
- name: Test (unit + integration)
run: go test -race -count=1 ./...
- name: Test (E2E)
run: go test -race -count=1 ./test/e2e/...
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Compute coverage
run: |
go test -race -count=1 -covermode=atomic \
-coverprofile=coverage.out \
-coverpkg=./internal/...,./cmd/... \
./internal/... ./cmd/...
go tool cover -func=coverage.out | tee coverage.txt
- name: Enforce 90% coverage floor
run: |
total=$(go tool cover -func=coverage.out | awk '/^total:/ {print $3}' | tr -d %)
echo "total coverage: $total%"
awk -v c="$total" 'BEGIN { if (c+0 < 90) { exit 1 } }'
stats:
name: statistical-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Chi-squared uniformity (1M samples per charset)
run: go test -tags stats -run ChiSquared -count=1 -v ./internal/generator
fuzz:
name: fuzz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Fuzz Exclude (60s)
run: go test -fuzz=FuzzExclude -fuzztime=60s ./internal/charset
- name: Fuzz ParseClasses (60s)
run: go test -fuzz=FuzzParseClasses -fuzztime=60s ./internal/policy
- name: Fuzz IsWeakPIN (60s)
run: go test -fuzz=FuzzIsWeakPIN -fuzztime=60s ./internal/policy
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9
with:
version: v2.1.0
vuln:
name: govulncheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...