-
Notifications
You must be signed in to change notification settings - Fork 1
310 lines (302 loc) · 11.3 KB
/
validation.yaml
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
name: Validation CI
on:
pull_request:
push:
branches: [ master ]
release:
types: [ published ]
schedule:
# run every day at 0252, 0852, 1452, and 2052 UTC
- cron: '52 2,8,14,20 * * *'
workflow_dispatch:
env:
TERM: xterm
jobs:
changes:
name: Check for file changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
ci: ${{ steps.filter.outputs.ci }}
dependencies: ${{ steps.filter.outputs.dependencies }}
docker: ${{ steps.filter.outputs.docker }}
markdown: ${{ steps.filter.outputs.markdown }}
helpers: ${{ steps.filter.outputs.helpers }}
shell: ${{ steps.filter.outputs.shell }}
spelling: ${{ steps.filter.outputs.spelling }}
test: ${{ steps.filter.outputs.test }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: resources/config/paths-filter.yaml
dependencies-check:
name: Check depencencies
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Renovate
uses: renovatebot/[email protected]
with:
configurationFile: 'resources/config/renovate-config.json'
token: ${{ secrets.RENOVATE_TOKEN }}
- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
config-file: 'resources/config/dependency-review.yaml'
base-ref: ${{ github.event.pull_request.base.sha || 'master' }}
head-ref: ${{ github.event.pull_request.head.sha || github.ref }}
shell-lint:
name: Lint the shell code
needs: changes
if: >-
${{
needs.changes.outputs.ci == 'true' ||
needs.changes.outputs.dependencies == 'true' ||
needs.changes.outputs.docker == 'true' ||
needs.changes.outputs.helpers == 'true' ||
needs.changes.outputs.shell == 'true' ||
needs.changes.outputs.test == 'true'
}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint with shellcheck and shfmt
uses: luizm/[email protected]
env:
SHELLCHECK_OPTS: >-
--enable add-default-case
--enable avoid-nullary-conditions
--enable check-unassigned-uppercase
--enable deprecate-which
--enable quote-safe-variables
--enable require-variable-braces
SHFMT_OPTS: --indent 2 --space-redirects
yaml-lint:
name: Lint the yaml code
needs: changes
if: >-
${{
needs.changes.outputs.ci == 'true' ||
needs.changes.outputs.dependencies == 'true' ||
needs.changes.outputs.docker == 'true' ||
needs.changes.outputs.shell == 'true' ||
needs.changes.outputs.test == 'true'
}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint workflow files
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color -verbose
shell: bash
dockerfile-lint:
name: Lint the Dockerfile code
needs: changes
if: >-
${{
needs.changes.outputs.ci == 'true' ||
needs.changes.outputs.dependencies == 'true' ||
needs.changes.outputs.docker == 'true' ||
needs.changes.outputs.shell == 'true'
}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint Dockerfiles
uses: luke142367/[email protected]
with:
target: docker/Dockerfile*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
markdown-checks:
name: Check the documentation
needs: changes
if: >-
${{
needs.changes.outputs.ci == 'true' ||
needs.changes.outputs.markdown == 'true'
}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint the markdown
uses: avto-dev/markdown-lint@v1
with:
config: 'resources/config/markdownlint.yaml'
args: '*/*.md'
- name: Check spelling
uses: rojopolis/spellcheck-github-actions@v0
with:
config_path: 'resources/config/spellcheck.yaml'
output_file: 'spellcheck-output.txt'
- uses: actions/upload-artifact@v4
if: '!cancelled()'
with:
name: Spellcheck Output
path: spellcheck-output.txt
markdown-links:
name: Check hyperlinks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run markdown-link-check on documentation
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: 'resources/config/markdown-link-check.json'
use-verbose-mode: 'yes'
run-nodebuilder-baremetal:
name: Test ${{ matrix.job-purpose }} on ${{ matrix.os-friendly-name }}
needs: [changes, shell-lint, yaml-lint]
if: >-
${{
needs.changes.outputs.ci == 'true' ||
needs.changes.outputs.dependencies == 'true' ||
needs.changes.outputs.shell == 'true' ||
needs.changes.outputs.test == 'true'
}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
job-purpose: [package, source]
os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-latest]
include:
- job-purpose: package
additional-args: ''
- job-purpose: source
additional-args: '--compile'
- os: ubuntu-22.04
os-friendly-name: Ubuntu 22
check-environment-command: cat /etc/os-release && lscpu && grep Mem /proc/meminfo
remove-firefox-command: sudo apt-get remove --assume-yes firefox
cache-path: |
/var/cache/apt/archives/*.deb
/var/lib/apt/lists/*.ubuntu.com_ubuntu_dists_*
/var/lib/apt/lists/download.docker.com_linux_ubuntu_dists_*
/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_*
/var/lib/apt/lists/packages.microsoft.com_repos_code_dists_*
/var/lib/apt/lists/pkg.cloudflareclient.com_dists_*
path-to-bitcoin-log: '/home/runner/.bitcoin/debug.log'
- os: ubuntu-24.04
os-friendly-name: Ubuntu 24
check-environment-command: cat /etc/os-release && lscpu && grep Mem /proc/meminfo
remove-firefox-command: sudo apt-get remove --assume-yes firefox
path-to-bitcoin-log: '/home/runner/.bitcoin/debug.log'
- os: macos-13
os-friendly-name: macOS 13
check-environment-command: sw_vers && sysctl machdep.cpu.core_count machdep.cpu.thread_count machdep.cpu.brand_string && memory_pressure -Q
path-to-bitcoin-log: '/Users/runner/Library/Application Support/Bitcoin/debug.log'
- os: macos-latest
os-friendly-name: macOS 14
check-environment-command: sw_vers && sysctl machdep.cpu.core_count machdep.cpu.thread_count machdep.cpu.brand_string && memory_pressure -Q
path-to-bitcoin-log: '/Users/runner/Library/Application Support/Bitcoin/debug.log'
steps:
- uses: actions/checkout@v4
- name: Check the current environment
run: |
uname -a
${{ matrix.check-environment-command }}
df -h
date -u
- name: Change owner of apt archives
if: contains(matrix.os, 'ubuntu')
run: sudo chown -R "$(whoami)" /var/cache/apt/archives
- name: Cache system archives
if: matrix.cache-path != null
uses: actions/cache@v4
with:
path: ${{ matrix.cache-path }}
key: cache-updates-${{ matrix.os }}-${{ github.run_id }}
restore-keys: cache-updates-${{ matrix.os }}
- name: Remove the snap package
if: matrix.remove-firefox-command != null
run: ${{ matrix.remove-firefox-command }}
- name: Test the console output ${{ matrix.additional-args }}
id: test-nodebuilder
run: /bin/sh -x ./test/test_nodebuilder --ref "${GITHUB_SHA}" ${{ matrix.additional-args }}
timeout-minutes: 120
continue-on-error: true
- name: If test failed, debug nodebuilder ${{ matrix.additional-args }}
if: steps.test-nodebuilder.outcome == 'failure'
env:
CI_NODEBUILDER_URL: https://github.com/bitcoin-tools/nodebuilder/raw/master/nodebuilder
run: |
if [ -n "$(ls /usr/local/bin/*bitcoin*)" ]; then
rm /usr/local/bin/*bitcoin*
fi
wget --no-verbose --retry-connrefused "${CI_NODEBUILDER_URL}"
chmod u+x nodebuilder
/bin/sh -x ./nodebuilder ${{ matrix.additional-args }}
timeout-minutes: 120
- name: Save Bitcoin Core log as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.job-purpose }}-bitcoin-debug.log
path: ${{ matrix.path-to-bitcoin-log }}
- name: If test failed, fail the job
if: steps.test-nodebuilder.outcome == 'failure'
run: printf '%s\n' "Review the step 'Test the console output' above." && exit 1
run-nodebuilder-docker:
name: Build image for ${{ matrix.container }}
needs: [changes, dockerfile-lint, shell-lint, yaml-lint]
if: >-
github.event.action != 'prerelease' &&
github.event.action != 'published' &&
(
needs.changes.outputs.ci == 'true' ||
needs.changes.outputs.dependencies == 'true' ||
needs.changes.outputs.docker == 'true' ||
needs.changes.outputs.shell == 'true'
)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [Gentoo, Alpine, Amazon Linux, Arch, Clear Linux, Debian, Fedora, Manjaro, Oracle Linux, Red Hat, Rocky Linux, Ubuntu, openSUSE Leap, openSUSE Tumbleweed]
include:
- container: Gentoo
dockerfile: Dockerfile_gentoo
- container: Alpine
dockerfile: Dockerfile_alpine
- container: Amazon Linux
dockerfile: Dockerfile_amazonlinux
- container: Arch
dockerfile: Dockerfile_archlinux
- container: Clear Linux
dockerfile: Dockerfile_clearlinux
- container: Debian
dockerfile: Dockerfile_debian
- container: Fedora
dockerfile: Dockerfile_fedora
- container: Manjaro
dockerfile: Dockerfile_manjarolinux
- container: Oracle Linux
dockerfile: Dockerfile_oraclelinux
- container: Red Hat
dockerfile: Dockerfile_redhat-ubi9
- container: Rocky Linux
dockerfile: Dockerfile_rockylinux
- container: Ubuntu
dockerfile: Dockerfile
- container: openSUSE Leap
dockerfile: Dockerfile_opensuse-leap
- container: openSUSE Tumbleweed
dockerfile: Dockerfile_opensuse-tumbleweed
steps:
- uses: actions/checkout@v4
- name: Check the current OS version
run: grep 'VERSION\|ID' /etc/os-release && uname -a
- name: Build the ${{ matrix.container }} docker image
timeout-minutes: 300
uses: docker/build-push-action@v6
with:
build-args: NODEBUILDER_VERSION=${{ github.sha || github.head_ref || 'master' }}
context: .
file: docker/${{ matrix.dockerfile }}