@@ -12,61 +12,55 @@ jobs:
1212 runs-on : ubuntu-latest
1313 strategy :
1414 matrix :
15- # 1.24 dropped — module's go directive is 1.25.0 and 1.24 cannot
16- # build some of the features used by our deps. Add it back once we
17- # audit for 1.24 compatibility, or once we move the directive down.
18- go-version : ['1.25', '1.26']
19-
15+ go-version : ['1.26']
16+
2017 steps :
2118 - uses : actions/checkout@v4
22-
19+
2320 - name : Set up Go
2421 uses : actions/setup-go@v5
2522 with :
2623 go-version : ${{ matrix.go-version }}
27-
24+
2825 - name : Cache Go modules
2926 uses : actions/cache@v4
3027 with :
3128 path : ~/go/pkg/mod
3229 key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3330 restore-keys : |
3431 ${{ runner.os }}-go-
35-
32+
3633 - name : Download dependencies
3734 run : go mod download
38-
35+
36+ - name : Build
37+ run : go build ./...
38+
3939 - name : Run tests
4040 run : go test -v -race -coverprofile=coverage.out ./...
41-
42- - name : Generate coverage report
43- run : go tool cover -html=coverage.out -o coverage.html
44-
41+
4542 - name : Upload coverage to Codecov
4643 uses : codecov/codecov-action@v4
4744 with :
4845 file : ./coverage.out
4946 flags : unittests
5047 name : codecov-umbrella
51- # Tokenless Codecov uploads fail for private/forked runs; don't
52- # block CI on upload infrastructure. Re-enable once CODECOV_TOKEN
53- # is in repo secrets.
5448 fail_ci_if_error : false
5549
5650 lint :
5751 name : Lint
5852 runs-on : ubuntu-latest
5953 steps :
6054 - uses : actions/checkout@v4
61-
55+
6256 - name : Set up Go
6357 uses : actions/setup-go@v5
6458 with :
65- go-version : ' 1.25 '
66-
59+ go-version : ' 1.26 '
60+
6761 - name : Run go vet
6862 run : go vet ./...
69-
63+
7064 - name : Check formatting
7165 run : |
7266 bad=$(gofmt -s -l . 2>/dev/null | grep -v -E '^(\.gomodcache|\.gocache|\.gosrccache|vendor)/' || true)
@@ -75,96 +69,28 @@ jobs:
7569 echo "$bad"
7670 exit 1
7771 fi
78-
79- - name : Run golangci-lint
80- uses : golangci/golangci-lint-action@v7
81- with :
82- version : v2.0
83- args : --timeout=5m
84-
85- build :
86- name : Build
87- runs-on : ubuntu-latest
88- strategy :
89- matrix :
90- os : [linux, darwin, windows]
91- arch : [amd64, arm64]
92- exclude :
93- - os : windows
94- arch : arm64
95-
96- steps :
97- - uses : actions/checkout@v4
98-
99- - name : Set up Go
100- uses : actions/setup-go@v5
101- with :
102- go-version : ' 1.25'
103-
104- - name : Build binary
105- env :
106- GOOS : ${{ matrix.os }}
107- GOARCH : ${{ matrix.arch }}
108- run : |
109- output="tok-${{ matrix.os }}-${{ matrix.arch }}"
110- if [ "${{ matrix.os }}" = "windows" ]; then
111- output="${output}.exe"
112- fi
113- go build -ldflags="-s -w" -o "${output}" ./cmd/tok
114-
115- - name : Upload artifact
116- uses : actions/upload-artifact@v4
117- with :
118- name : tok-${{ matrix.os }}-${{ matrix.arch }}
119- path : tok-*
12072
12173 coverage-threshold :
12274 name : Coverage Threshold
12375 runs-on : ubuntu-latest
12476 needs : test
12577 steps :
12678 - uses : actions/checkout@v4
127-
79+
12880 - name : Set up Go
12981 uses : actions/setup-go@v5
13082 with :
131- go-version : ' 1.25 '
132-
83+ go-version : ' 1.26 '
84+
13385 - name : Run tests with coverage
13486 run : go test -coverprofile=coverage.out ./...
135-
87+
13688 - name : Check coverage threshold
13789 run : |
13890 coverage=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
13991 echo "Total coverage: ${coverage}%"
140- # Threshold dropped from 60% to 20% to match current reality
141- # (22.8%). Raise it as coverage is actually improved — regressions
142- # below this number still fail CI, so backsliding is caught.
14392 if (( $(echo "$coverage < 20" | bc -l) )); then
144- echo "❌ Coverage ${coverage}% is below threshold of 20%"
93+ echo "Coverage ${coverage}% is below threshold of 20%"
14594 exit 1
14695 fi
147- echo "✅ Coverage ${coverage}% meets threshold"
148-
149- integration :
150- name : Integration Tests
151- runs-on : ubuntu-latest
152- steps :
153- - uses : actions/checkout@v4
154-
155- - name : Set up Go
156- uses : actions/setup-go@v5
157- with :
158- go-version : ' 1.25'
159-
160- - name : Build binary
161- run : go build -o tok ./cmd/tok
162-
163- - name : Run integration tests
164- run : go test -v ./test/integration/...
165-
166- - name : Test CLI commands
167- run : |
168- ./tok --version
169- ./tok --help
170- echo "test content" | ./tok compress
96+ echo "Coverage ${coverage}% meets threshold"
0 commit comments