-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (139 loc) · 4.28 KB
/
codeChecks.yml
File metadata and controls
158 lines (139 loc) · 4.28 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# yamllint disable rule:comments rule:line-length
---
name: CodeChecks
on:
push:
paths:
- ".github/workflows/codeChecks.yml"
- ".goreleaser.yaml"
- ".golangci.yml"
- ".testcoverage.yml"
- "devenv.*"
- "cmd/**"
- "internal/**"
- "pkg/**"
- "*.go"
- "go.*"
workflow_call:
permissions:
contents: read
jobs:
go_lint:
name: Go lint
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
go-version: ["1.25"]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: stable
- name: Run golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
go_vulncheck:
name: Go vulnerabilities check
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
go-version: ["1.25"]
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod tidy
- name: govulncheck test
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
with:
go-version-input: ${{ matrix.go-version }}
go-package: ./...
work-dir: .
go_tests:
name: Go tests and build
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
go-version: ["1.25"]
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod tidy
- name: Test with the Go CLI
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Build
run: go build -v ./...
go_test_coverage_check:
needs: go_tests
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: "1.25"
- name: generate test coverage
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: check test coverage
continue-on-error: ${{ github.ref_name != 'main' }}
uses: vladopajic/go-test-coverage@8cfd056d3bc5cc2bc64a840ded0c907aaae3dc46 # v2.18.7
with:
config: ./.testcoverage.yml
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges
# goreleaser_test:
# name: GoReleaser test release
# runs-on: ubuntu-latest
#
# strategy:
# max-parallel: 2
# matrix:
# go-version: ["1.25"]
#
# needs:
# - go_lint
# - go_tests
# - go_vulncheck
#
# steps:
# - name: Checkout
# uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
# with:
# fetch-depth: 0
#
# - name: Install Nix
# uses: cachix/install-nix-action@ab739621df7a23f52766f9ccc97f38da6b7af14f # v31.10.5
#
# - name: Install Syft
# uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
#
# - name: Set up QEMU
# uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
#
# - name: Set up Go
# uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version: ${{ matrix.go-version }}
#
# - name: Run GoReleaser test
# uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
# with:
# version: "~> 2"
# args: release --snapshot --clean
# workdir: .