Skip to content

Commit 320e0f2

Browse files
committed
ci: add go lint checks job
Signed-off-by: rare-magma <[email protected]>
1 parent 566a108 commit 320e0f2

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

.github/workflows/docker.yml .github/workflows/ci.yml

+36-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create and publish a container image
1+
name: Create and publish artifacts
22

33
on:
44
push:
@@ -15,7 +15,36 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18+
lint:
19+
name: Lint
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-go@v5
24+
25+
- name: Go Format
26+
run: gofmt -s -w . && git diff --exit-code
27+
28+
- name: Go Vet
29+
run: go vet
30+
31+
- name: Go Tidy
32+
run: go mod tidy && git diff --exit-code
33+
34+
- name: Go Mod
35+
run: go mod download
36+
37+
- name: Go Mod Verify
38+
run: go mod verify
39+
40+
- name: Install govulncheck
41+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
42+
43+
- name: Run govulncheck
44+
run: govulncheck
45+
1846
build-and-push-image:
47+
needs: lint
1948
runs-on: ubuntu-latest
2049
timeout-minutes: 10
2150
permissions:
@@ -51,6 +80,7 @@ jobs:
5180
annotations: ${{ steps.meta.outputs.annotations }}
5281

5382
releases-matrix:
83+
needs: lint
5484
permissions:
5585
contents: write
5686
name: Release Go Binaries
@@ -63,8 +93,11 @@ jobs:
6393
- uses: actions/checkout@v4
6494
- uses: actions/setup-go@v5
6595
- name: Build
66-
run: |
67-
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o pvpc_exporter main.go
96+
run: go build -ldflags="-s -w" -trimpath -o pvpc_exporter main.go
97+
env:
98+
CGO_ENABLED: 0
99+
GOOS: ${{ matrix.goos }}
100+
GOARCH: ${{ matrix.goarch }}
68101
- name: Compress
69102
run: zip pvpc_exporter-${{ matrix.goos }}-${{ matrix.goarch }}.zip pvpc_exporter
70103
- name: Create Release

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module pvpc_exporter
22

3-
go 1.22.7
3+
go 1.23

0 commit comments

Comments
 (0)