-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (145 loc) · 4.22 KB
/
Copy pathci.yml
File metadata and controls
145 lines (145 loc) · 4.22 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
name: CI
on: [push, pull_request]
jobs:
check:
if: ${{ github.event_name == 'pull_request' }}
name: HAProxy check commit message
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
# setup-go exports GOTOOLCHAIN=local via GITHUB_ENV; a later write wins.
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: Install Task
uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: commit-policy
run: task check-commit
tidy:
name: go mod tidy
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
check-latest: true
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: tidy
run: go mod tidy
- name: changes
run: test -z "$(git diff 2> /dev/null)" || exit "Go modules not tidied, issue \`go mod tidy\` and commit the result"
format:
name: gofumpt
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: Install Task
uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: format
run: task format
- name: changes
run: test -z "$(git diff 2> /dev/null)" || exit "Go code not formatted, issue \`task format\` and commit the result"
lint:
name: lint
needs: ["tidy", "format"]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: Install Task
uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
run: task lint
test:
name: test (${{ matrix.mode }})
needs: ["lint"]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode: [root, rootless]
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: Install Task
uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
# rootless: e2e runs gopherd as a non-root UID (GOPHERD_E2E_ROOTLESS=1).
- name: Test
run: task test COUNT=1
env:
GOPHERD_E2E_ROOTLESS: ${{ matrix.mode == 'rootless' && '1' || '' }}
build:
name: build
needs: ["test"]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: Build
run: go build -v .
govulncheck:
name: govulncheck
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Allow Go toolchain downloads
run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
- name: Install Task
uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: govulncheck
run: task govulncheck