Skip to content

Commit e518023

Browse files
committed
create a separate workflow for go analyse
1 parent 3ff0933 commit e518023

File tree

2 files changed

+77
-48
lines changed

2 files changed

+77
-48
lines changed

.github/workflows/build_test_ci.yml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -70,54 +70,6 @@ jobs:
7070
token: ${{ secrets.CODECOV_TOKEN }}
7171
slug: linode/cluster-api-provider-linode
7272

73-
74-
go-analyse:
75-
needs: go-build-test
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Harden Runner
79-
uses: step-security/harden-runner@v2
80-
with:
81-
disable-sudo: true
82-
egress-policy: block
83-
allowed-endpoints: >
84-
api.github.com:443
85-
github.com:443
86-
proxy.golang.org:443
87-
sum.golang.org:443
88-
objects.githubusercontent.com:443
89-
registry-1.docker.io:443
90-
auth.docker.io:443
91-
production.cloudflare.docker.com:443
92-
vuln.go.dev:443
93-
storage.googleapis.com:443
94-
95-
- uses: actions/checkout@v4
96-
97-
- name: Set up Go
98-
uses: actions/setup-go@v5
99-
with:
100-
go-version-file: 'go.mod'
101-
check-latest: true
102-
103-
- name: Docker cache
104-
uses: ScribeMD/[email protected]
105-
with:
106-
key: docker-${{ runner.os }}-${{ hashFiles('go.sum') }}
107-
108-
- name: Lint
109-
run: make lint
110-
111-
- name: Gosec
112-
run: make gosec
113-
114-
- name: Vulncheck
115-
continue-on-error: true
116-
run: make vulncheck
117-
118-
- name: Nilcheck
119-
run: make nilcheck
120-
12173
e2e-test:
12274
needs: [go-build-test, docker-build]
12375
runs-on: ubuntu-latest

.github/workflows/go-analyze.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Go Analyze
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pull-requests: read
15+
16+
jobs:
17+
changes:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
# Expose matched filters as job 'src' output variable
21+
src: ${{ steps.filter.outputs.src }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@v2
26+
with:
27+
disable-sudo: true
28+
egress-policy: block
29+
allowed-endpoints: >
30+
api.github.com:443
31+
github.com:443
32+
- uses: dorny/paths-filter@v3
33+
id: filter
34+
with:
35+
predicate-quantifier: 'every'
36+
filters: |
37+
src:
38+
- '!**/**.md'
39+
- '!docs/**'
40+
go-analyze:
41+
needs: changes
42+
runs-on: ubuntu-latest
43+
if: ${{ needs.changes.outputs.src == 'true' }}
44+
steps:
45+
- name: Harden Runner
46+
uses: step-security/harden-runner@v2
47+
with:
48+
disable-sudo: true
49+
egress-policy: block
50+
allowed-endpoints: >
51+
api.github.com:443
52+
github.com:443
53+
proxy.golang.org:443
54+
sum.golang.org:443
55+
objects.githubusercontent.com:443
56+
raw.githubusercontent.com:443
57+
auth.docker.io:443
58+
production.cloudflare.docker.com:443
59+
vuln.go.dev:443
60+
storage.googleapis.com:443
61+
62+
- uses: actions/checkout@v4
63+
64+
- name: Set up Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version-file: 'go.mod'
68+
check-latest: true
69+
cache: false
70+
71+
- name: lint
72+
uses: golangci/golangci-lint-action@v4
73+
with:
74+
version: latest
75+
76+
- name: Nilcheck
77+
run: make nilcheck

0 commit comments

Comments
 (0)