Skip to content

Commit

Permalink
ci: add go lint checks job
Browse files Browse the repository at this point in the history
Signed-off-by: rare-magma <[email protected]>
  • Loading branch information
rare-magma committed Nov 5, 2024
1 parent 566a108 commit 320e0f2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
39 changes: 36 additions & 3 deletions .github/workflows/docker.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish a container image
name: Create and publish artifacts

on:
push:
Expand All @@ -15,7 +15,36 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5

- name: Go Format
run: gofmt -s -w . && git diff --exit-code

- name: Go Vet
run: go vet

- name: Go Tidy
run: go mod tidy && git diff --exit-code

- name: Go Mod
run: go mod download

- name: Go Mod Verify
run: go mod verify

- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run govulncheck
run: govulncheck

build-and-push-image:
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
Expand Down Expand Up @@ -51,6 +80,7 @@ jobs:
annotations: ${{ steps.meta.outputs.annotations }}

releases-matrix:
needs: lint
permissions:
contents: write
name: Release Go Binaries
Expand All @@ -63,8 +93,11 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- name: Build
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o pvpc_exporter main.go
run: go build -ldflags="-s -w" -trimpath -o pvpc_exporter main.go
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: Compress
run: zip pvpc_exporter-${{ matrix.goos }}-${{ matrix.goarch }}.zip pvpc_exporter
- name: Create Release
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module pvpc_exporter

go 1.22.7
go 1.23

0 comments on commit 320e0f2

Please sign in to comment.