Repository navigation
175 lines (145 loc) · 5.55 KB
/
Copy pathci.yml
File metadata and controls
175 lines (145 loc) · 5.55 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# setup-go keys its cache on go.sum alone and never refreshes it. Each job
# instead keeps its own build and test cache keyed on the commit, saved from
# main so pull requests start warm.
jobs:
quality:
name: Quality
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false
- name: Restore Go cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-ci-quality-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
restore-keys: |
go-ci-quality-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-
go-ci-quality-${{ runner.os }}-
- name: Check formatting
shell: bash
run: |
unformatted="$(gofmt -l .)"
if [[ -n "${unformatted}" ]]; then
printf 'Files requiring gofmt:\n%s\n' "${unformatted}"
exit 1
fi
- name: Verify module files
shell: bash
run: |
go mod verify
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: Verify generated code, tests, and static analysis
run: go tool mage verify
- name: Scan reachable dependencies
run: go tool govulncheck ./...
- name: Save Go cache
if: github.event_name == 'push'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-ci-quality-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
race:
name: Race detector
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false
- name: Restore Go cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-ci-race-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
restore-keys: |
go-ci-race-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-
go-ci-race-${{ runner.os }}-
- name: Run race detector
run: go tool mage race
- name: Save Go cache
if: github.event_name == 'push'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-ci-race-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
browser:
name: Browser regression
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false
- name: Restore Go cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-ci-browser-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
restore-keys: |
go-ci-browser-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-
go-ci-browser-${{ runner.os }}-
- name: Set up Node for browser regression tests
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24'
- name: Install browser test dependencies
run: npm ci --prefix scripts/browser
- name: Restore Playwright browsers
id: playwright-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('scripts/browser/package-lock.json') }}
- name: Install Chromium
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: scripts/browser/node_modules/.bin/playwright install --with-deps chromium
- name: Install Chromium system dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: scripts/browser/node_modules/.bin/playwright install-deps chromium
- name: Check live refresh and block-list feedback
run: go test -count=1 -tags=browser -run TestBrowser -v ./internal/web
- name: Save Go cache
if: github.event_name == 'push'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-ci-browser-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}