Repository navigation
370 lines (359 loc) · 15.2 KB
/
Copy pathci.yml
File metadata and controls
370 lines (359 loc) · 15.2 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
name: CI
on:
push:
branches: [main, develop] # develop is the integration branch; main is the release branch
pull_request:
workflow_dispatch: # dispatched onto bot branches (xmrig-bump #225) whose token-created PRs can't self-trigger
# Least privilege: every job here only reads the repo to lint/test/build — nothing publishes or
# writes. Set the floor once at the top so all jobs inherit a read-only GITHUB_TOKEN (zizmor:
# excessive-permissions).
permissions:
contents: read
jobs:
lint-yaml:
name: Lint (yamllint)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false # zizmor: artipacked
- name: "setup: Install pinned Python CI tools"
id: setup_py_tools
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/ci-python-tools"
"$RUNNER_TEMP/ci-python-tools/bin/pip" install -r tools/requirements-ci.txt
echo "$RUNNER_TEMP/ci-python-tools/bin" >>"$GITHUB_PATH"
- name: "assert: yamllint (make lint-yaml)"
id: assert_lint_yaml
run: make lint-yaml
- name: "setup: Install pinned actionlint"
id: setup_actionlint
env:
ACTIONLINT_VERSION: "1.7.12"
ACTIONLINT_SHA256: "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8"
run: |
set -euo pipefail
tarball="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
curl -fsSL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/${tarball}" -o "$tarball"
echo "${ACTIONLINT_SHA256} ${tarball}" | sha256sum -c -
tar -xzf "$tarball" actionlint
sudo install actionlint /usr/local/bin/
actionlint --version
- name: "assert: actionlint (make lint-actions)"
id: assert_lint_actions
run: make lint-actions
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_LINT_ACTIONS: ${{ steps.assert_lint_actions.outcome }}
CAT_ASSERT_LINT_YAML: ${{ steps.assert_lint_yaml.outcome }}
CAT_SETUP_ACTIONLINT: ${{ steps.setup_actionlint.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
CAT_SETUP_PY_TOOLS: ${{ steps.setup_py_tools.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
lint-md:
name: Lint (markdownlint)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false # zizmor: artipacked
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
id: setup_node
name: "setup: Install Node.js 22"
with:
node-version: "22"
package-manager-cache: false
- name: "assert: markdownlint (make lint-md)"
id: assert_lint_md
run: make lint-md
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_LINT_MD: ${{ steps.assert_lint_md.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
CAT_SETUP_NODE: ${{ steps.setup_node.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
lint:
name: Lint (shellcheck + shfmt)
runs-on: ubuntu-24.04
env:
SHELLCHECK_VERSION: "0.11.0"
SHELLCHECK_SHA256: "8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198"
SHFMT_VERSION: "3.14.1"
SHFMT_SHA256: "76e77641faa025814b77f153b29796b8e6fa2fca03e0c76a691608b86c7ea7bf"
FILE_BUDGET_REQUIRE_BASE: "1"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false # zizmor: artipacked
fetch-depth: 0
- name: "setup: Install pinned ShellCheck"
id: setup_shellcheck
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
tarball="shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/${tarball}" -o "$tarball"
echo "${SHELLCHECK_SHA256} ${tarball}" | sha256sum -c -
tar -xJf "$tarball"
sudo install "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" /usr/local/bin/shellcheck
shellcheck --version
- name: "setup: Install pinned shfmt"
id: setup_shfmt
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl -fsSL "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -o shfmt
echo "${SHFMT_SHA256} shfmt" | sha256sum -c -
sudo install shfmt /usr/local/bin/shfmt
shfmt --version
- name: "assert: shellcheck + shfmt (make lint)"
id: assert_lint
run: make lint
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_LINT: ${{ steps.assert_lint.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
CAT_SETUP_SHELLCHECK: ${{ steps.setup_shellcheck.outcome }}
CAT_SETUP_SHFMT: ${{ steps.setup_shfmt.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
test:
name: Test suite
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false # zizmor: artipacked
- name: "assert: test suite (make test-suite)"
id: assert_test_suite
run: make test-suite
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_TEST_SUITE: ${{ steps.assert_test_suite.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
apt-feed:
name: APT feed (sign, verify, tamper)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false
- name: "setup: Install packaging tools"
id: setup_packaging_tools
run: sudo apt-get update && sudo apt-get install -y apt-utils
- name: "assert: apt feed test"
id: assert_apt_feed
run: sudo bash tests/test-apt-feed.sh
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_APT_FEED: ${{ steps.assert_apt_feed.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
CAT_SETUP_PACKAGING_TOOLS: ${{ steps.setup_packaging_tools.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
stock-home:
name: Stock home setup (${{ matrix.label }})
runs-on: ubuntu-24.04
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
include:
- label: historical
revision: b2d4c3d9ca1da74d0e6d5ccce772d401acc8be03
expect: broken
- label: current
revision: HEAD
expect: working
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false
fetch-depth: 0
- name: "setup: Verify native prerequisites"
id: setup_prereqs
run: |
command -v git curl
systemctl --version
- name: "assert: documented setup beneath a private home"
id: assert_stock_home
env:
TEST_REVISION: ${{ matrix.revision }}
TEST_EXPECTATION: ${{ matrix.expect }}
run: timeout 1800 bash tests/test-stock-home.sh "$TEST_REVISION" "$TEST_EXPECTATION"
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_STOCK_HOME: ${{ steps.assert_stock_home.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
CAT_SETUP_PREREQS: ${{ steps.setup_prereqs.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
e2e:
name: End-to-end (Docker)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false # zizmor: artipacked
- name: "assert: deploy pass"
id: assert_deploy
if: ${{ !cancelled() }}
run: bash tests/e2e/linux.sh deploy
- name: "assert: appliance pass"
id: assert_appliance
if: ${{ !cancelled() }}
run: bash tests/e2e/linux.sh appliance
- name: "assert: isolation pass"
id: assert_isolation
if: ${{ !cancelled() }}
run: bash tests/e2e/linux.sh isolation
- name: "assert: deb install pass"
id: assert_deb_install
if: ${{ !cancelled() }}
run: bash tests/test-deb-install.sh
- name: "setup: Build the API allowlist kernel test image"
id: setup_allowlist_image
if: ${{ !cancelled() }}
run: docker build -q -t rigforge-allowlist tests/docker
- name: "assert: API allowlist kernel test"
id: assert_allowlist
if: ${{ !cancelled() && steps.setup_allowlist_image.outcome == 'success' }}
run: docker run --rm --privileged -v "$PWD:/src:ro" rigforge-allowlist bash /src/tests/test-api-allowlist-linux.sh
- name: "cleanup: Remove the API allowlist kernel test image"
id: cleanup_allowlist_image
if: always() && steps.setup_allowlist_image.outcome == 'success'
run: docker rmi rigforge-allowlist
- name: "assert: Require every Docker mode"
id: assert_docker_modes
if: ${{ always() }}
env:
DEPLOY: ${{ steps.assert_deploy.outcome }}
APPLIANCE: ${{ steps.assert_appliance.outcome }}
ISOLATION: ${{ steps.assert_isolation.outcome }}
ALLOWLIST: ${{ steps.assert_allowlist.outcome }}
DEB_INSTALL: ${{ steps.assert_deb_install.outcome }}
run: bash scripts/require-success.sh "deploy=$DEPLOY" "appliance=$APPLIANCE" "isolation=$ISOLATION" "allowlist=$ALLOWLIST" "deb-install=$DEB_INSTALL"
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_ALLOWLIST: ${{ steps.assert_allowlist.outcome }}
CAT_ASSERT_APPLIANCE: ${{ steps.assert_appliance.outcome }}
CAT_ASSERT_DEB_INSTALL: ${{ steps.assert_deb_install.outcome }}
CAT_ASSERT_DEPLOY: ${{ steps.assert_deploy.outcome }}
CAT_ASSERT_DOCKER_MODES: ${{ steps.assert_docker_modes.outcome }}
CAT_ASSERT_ISOLATION: ${{ steps.assert_isolation.outcome }}
CAT_CLEANUP_ALLOWLIST_IMAGE: ${{ steps.cleanup_allowlist_image.outcome }}
CAT_SETUP_ALLOWLIST_IMAGE: ${{ steps.setup_allowlist_image.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
coverage:
name: Coverage (kcov + diff-cover)
runs-on: ubuntu-24.04
env:
PATCH_COVERAGE_MIN: "90"
BASE_REF: ${{ github.base_ref || github.ref_name }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
fetch-depth: 0
persist-credentials: false # zizmor: artipacked
- name: "setup: Fetch base branch for diff-cover"
id: setup_base_fetch
run: git fetch --no-tags origin "$BASE_REF"
- name: "assert: total coverage floor (kcov)"
id: assert_coverage_floor
run: make coverage
- name: "setup: Install pinned Python CI tools"
id: setup_py_tools
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/ci-python-tools"
"$RUNNER_TEMP/ci-python-tools/bin/pip" install -r tools/requirements-ci.txt
echo "$RUNNER_TEMP/ci-python-tools/bin" >>"$GITHUB_PATH"
- name: "assert: patch coverage on changed lines (diff-cover)"
id: assert_patch_coverage
run: diff-cover coverage/cobertura.xml --compare-branch="origin/$BASE_REF" --fail-under="${PATCH_COVERAGE_MIN}"
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_COVERAGE_FLOOR: ${{ steps.assert_coverage_floor.outcome }}
CAT_ASSERT_PATCH_COVERAGE: ${{ steps.assert_patch_coverage.outcome }}
CAT_SETUP_BASE_FETCH: ${{ steps.setup_base_fetch.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
CAT_SETUP_PY_TOOLS: ${{ steps.setup_py_tools.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"
homebrew:
name: Homebrew formula (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
id: setup_checkout
name: "setup: Checkout"
with:
persist-credentials: false
- name: "assert: tap, install and test the formula"
id: assert_brew_formula
env:
HOMEBREW_NO_AUTO_UPDATE: "1"
run: |
set -euo pipefail
if [ "$(uname)" = Linux ]; then eval "$("$(compgen -G "/home/*/.linuxbrew/bin/brew")" shellenv)"; fi
eval "$(brew shellenv)"
brew tap p2pool-starter-stack/rigforge "$GITHUB_WORKSPACE"
brew install p2pool-starter-stack/rigforge/rigforge
brew test p2pool-starter-stack/rigforge/rigforge
want=$(sed -n 's/^ url ".*\/rigforge-v\([0-9.]*\)\.tar\.gz"$/\1/p' Formula/rigforge.rb)
test "$(rigforge --version)" = "RigForge $want"
test -f "$(brew --prefix rigforge)/libexec/.rigforge-package"
test "$(cat "$(brew --prefix rigforge)/libexec/.rigforge-package")" = brew
- name: "assert: report whether sudo finds the brew command"
id: assert_sudo_resolution
if: runner.os == 'Linux'
run: |
set -euo pipefail
eval "$("$(compgen -G "/home/*/.linuxbrew/bin/brew")" shellenv)"
if sudo -n sh -c 'command -v rigforge'; then echo "sudo resolves rigforge"; else echo "sudo does not resolve rigforge"; fi
sudo -n "$(command -v rigforge)" --version
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_BREW_FORMULA: ${{ steps.assert_brew_formula.outcome }}
CAT_ASSERT_SUDO_RESOLUTION: ${{ steps.assert_sudo_resolution.outcome }}
CAT_SETUP_CHECKOUT: ${{ steps.setup_checkout.outcome }}
run: bash scripts/ci-categorize.sh "$GITHUB_JOB"