Skip to content

Commit 850c5e5

Browse files
committed
chore(gha): clean-up go Github actions (#19)
- chore(gha): go version from go.mod (setup-go action) - chore(gha): use golangci/golangci-lint-action
1 parent c973d3a commit 850c5e5

File tree

6 files changed

+59
-28
lines changed

6 files changed

+59
-28
lines changed

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ jobs:
2626
- name: Setup Go
2727
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
2828
with:
29-
go-version: '1.23'
29+
go-version-file: 'go.mod'
3030
- name: Run tests
3131
run: make e2e KUBECONFIG=/etc/rancher/k3s/k3s.yaml node=$(kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml get no --no-headers | awk '{print $1}' | tail -1)

.github/workflows/govulncheck.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ jobs:
1414
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
1515
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
1616
with:
17-
stable: 'false'
18-
go-version: '1.24'
17+
go-version-file: 'go.mod'
1918
- run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...

.github/workflows/release.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up Go
2424
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
2525
with:
26-
go-version: '1.23'
26+
go-version-file: 'go.mod'
2727
- name: Remove Git Tags with Charts
2828
run: git tag -d $(git tag -l "helm-chart-*")
2929
- name: Run GoReleaser
@@ -94,6 +94,7 @@ jobs:
9494
runs-on: ubuntu-latest
9595
needs: [publish-linux-amd64, publish-linux-arm64, publish-windows-amd64]
9696
steps:
97+
<<<<<<< HEAD
9798
- uses: docker/login-action@v3
9899
with:
99100
username: ${{ secrets.DOCKER_USERNAME }}
@@ -104,3 +105,15 @@ jobs:
104105
- run: docker manifest push ${{ env.IMAGE_LATEST }}
105106
- run: docker manifest create ${{ env.IMAGE_LATEST }}-ltsc2025 ${{ env.IMAGE }}-linux-amd64 ${{ env.IMAGE }}-linux-arm64 ${{ env.IMAGE }}-windows-ltsc2025-amd64
106107
- run: docker manifest push ${{ env.IMAGE_LATEST }}-ltsc2025
108+
=======
109+
- uses: docker/login-action@v3
110+
with:
111+
username: ${{ secrets.DOCKER_USERNAME }}
112+
password: ${{ secrets.DOCKER_PASSWORD }}
113+
- run: docker manifest create ${{ env.IMAGE }} ${{ env.IMAGE }}-linux-amd64 ${{ env.IMAGE }}-linux-arm64 ${{ env.IMAGE }}-windows-ltsc2022-amd64
114+
- run: docker manifest push ${{ env.IMAGE }}
115+
- run: docker manifest create ${{ env.IMAGE_LATEST }} ${{ env.IMAGE }}-linux-amd64 ${{ env.IMAGE }}-linux-arm64 ${{ env.IMAGE }}-windows-ltsc2022-amd64
116+
- run: docker manifest push ${{ env.IMAGE_LATEST }}
117+
- run: docker manifest create ${{ env.IMAGE_LATEST }}-ltsc2019 ${{ env.IMAGE }}-linux-amd64 ${{ env.IMAGE }}-linux-arm64 ${{ env.IMAGE }}-windows-ltsc2019-amd64
118+
- run: docker manifest push ${{ env.IMAGE_LATEST }}-ltsc2019
119+
>>>>>>> 7a2b71c (chore(gha): clean-up go Github actions (#19))

.github/workflows/test.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- 'go.mod'
99
- 'go.sum'
1010
- '.github/workflows/test.yml'
11+
- '.golangci.yml'
1112

1213
jobs:
1314
test:
@@ -17,8 +18,23 @@ jobs:
1718
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
1819
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
1920
with:
20-
stable: 'false'
21-
go-version: '1.23'
21+
go-version-file: 'go.mod'
2222
- run: make test
2323
- name: Upload coverage to Codecov
2424
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
25+
golangci-lint:
26+
# Only lint on PRs; it's not as useful on pushes to main
27+
if: github.event_name == 'pull_request'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
31+
- name: Set up Go for golangci-lint
32+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
33+
with:
34+
go-version-file: go.mod
35+
cache: false
36+
- name: golangci-lint
37+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
38+
with:
39+
version: v2.6.1
40+
only-new-issues: true

.golangci.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1+
---
2+
version: "2"
13
run:
24
timeout: 5m
35
issues:
46
fix: true
5-
linters-settings:
6-
lll:
7-
line-length: 200
87
linters:
9-
enable-all: true
10-
disable:
11-
- deadcode # deprecated
12-
- exhaustivestruct # deprecated
13-
- golint # deprecated
14-
- ifshort # deprecated
15-
- interfacer # deprecated
16-
- maligned # deprecated
17-
- nosnakecase # deprecated
18-
- scopelint # deprecated
19-
- structcheck # deprecated
20-
- varcheck # deprecated
21-
- gochecknoglobals
22-
- exhaustivestruct
23-
- exhaustruct
24-
- varnamelen
25-
- musttag
26-
- depguard
8+
default: all
9+
settings:
10+
lll:
11+
line-length: 200
12+
wsl_v5:
13+
allow-first-in-block: true
14+
allow-whole-block: false
15+
branch-max-lines: 2
16+
depguard:
17+
rules:
18+
default:
19+
# list-mode can be "strict", "lax", or "original"
20+
list-mode: lax # allow all; unless in deny list
21+
# $all matches all go files (except test files if configured)
22+
files:
23+
- "$all"
24+
# - "!$test"
25+
allow:
26+
- "$gostd"
27+
deny: []
28+
# # Optionally, deny specific packages with a suggestion
29+
# - pkg: "io/ioutil"
30+
# desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ test:
6565
go fmt ./cmd/... ./pkg/... ./internal/...
6666
go vet ./cmd/... ./pkg/... ./internal/...
6767
go test --race -coverprofile coverage.out ./cmd/... ./pkg/...
68-
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v
6968

7069
.PHONY: e2e
7170
e2e:

0 commit comments

Comments
 (0)