-
-
Notifications
You must be signed in to change notification settings - Fork 0
388 lines (379 loc) · 16.8 KB
/
ci.yml
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
name: CI
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
- dev*
- v[0-9]+.[0-9]+
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash --noprofile --norc -CeEuxo pipefail {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
tidy:
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main
permissions:
contents: read
pull-requests: write # for gh pr edit --add-assignee
repository-projects: read # for gh pr edit --add-assignee
secrets: inherit
test:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
# - target: x86_64-pc-windows-gnu
# rust: nightly-x86_64-gnu
# os: windows-latest
# - target: x86_64-unknown-linux-musl
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@main
with:
toolchain: ${{ matrix.rust || 'nightly' }}
- run: cargo test --all
test-tidy:
strategy:
fail-fast: false
matrix:
include:
# NB: Sync list with https://github.com/taiki-e/checkout-action/blob/HEAD/.github/workflows/ci.yml
- os: ubuntu-22.04
- os: ubuntu-22.04-arm
- os: ubuntu-24.04
- os: ubuntu-24.04-arm
- os: macos-13
- os: macos-14
- os: macos-15
# Error: [WinError 2] The system cannot find the file specified
# tools/tidy.sh: error on line 89: "python${py_suffix}" -m venv .venv
# - os: windows-2019
# - os: windows-2019
# bash: msys64
# - os: windows-2019
# bash: cygwin
- os: windows-2022
- os: windows-2022
bash: msys64
- os: windows-2022
bash: cygwin
- os: windows-2025
- os: windows-2025
bash: msys64
- os: windows-2025
bash: cygwin
runs-on: ${{ matrix.os }}
steps:
- run: |
printf '%s\n' 'C:\msys64\mingw32\bin' >>"${GITHUB_PATH}"
printf '%s\n' 'C:\msys64\usr\bin' >>"${GITHUB_PATH}"
if: matrix.bash == 'msys64'
- run: |
choco install --no-progress --requirechecksums cygwin
printf '%s\n' 'C:\tools\cygwin\bin' >>"${GITHUB_PATH}"
printf '%s\n' 'C:\tools\cygwin\usr\bin' >>"${GITHUB_PATH}"
if: matrix.bash == 'cygwin'
- uses: taiki-e/checkout-action@v1
- run: brew install clang-format
if: startsWith(matrix.os, 'macos')
- uses: taiki-e/github-actions/install-rust@nightly
- uses: taiki-e/install-action@shellcheck
- uses: taiki-e/install-action@shfmt
- run: tools/ci/tidy-show-deps.sh
- run: tools/tidy.sh
- run: brew install bash
if: startsWith(matrix.os, 'macos')
- run: tools/ci/tidy-show-deps.sh
if: startsWith(matrix.os, 'macos')
- run: tools/tidy.sh
if: startsWith(matrix.os, 'macos')
test-tidy-container:
strategy:
fail-fast: false
matrix:
container:
# NB: Sync list with https://github.com/taiki-e/checkout-action/blob/HEAD/.github/workflows/ci.yml
# ubuntu 16.04's python3 is 3.5, ubuntu 14.04's python3 is 3.4
# SyntaxError: invalid syntax
# Traceback (most recent call last):
# File ".venv/bin/tomlq", line 7, in <module>
# - ubuntu:14.04 # glibc 2.19
# - ubuntu:16.04 # glibc 2.23
- ubuntu:18.04 # glibc 2.27
- ubuntu:20.04 # glibc 2.31
- ubuntu:22.04 # glibc 2.35
- ubuntu:24.04 # glibc 2.39
- debian:9-slim # glibc 2.24
- debian:10-slim # glibc 2.28
- debian:11-slim # glibc 2.31
- debian:12-slim # glibc 2.36
- fedora:latest # glibc 2.39 (as of fedora 40)
- almalinux:8 # glibc 2.28
- almalinux:8-minimal # glibc 2.28
- almalinux:9 # glibc 2.34
- almalinux:9-minimal # glibc 2.34
# - centos:6 # glibc 2.12 # rustc/nodejs requires glibc 2.17
- centos:7 # glibc 2.17
# - opensuse/leap:latest # glibc 2.38 (as of leap 15.6)
# - opensuse/tumbleweed:latest # glibc 2.39 (as of 2024-07-19)
# - archlinux:latest # glibc 2.39 (as of 2024-07-19)
- alpine:latest # musl 1.2.5 (as of alpine 3.20)
# - openwrt/rootfs:x86-64-openwrt-24.10 # musl 1.2.5
runs-on: ubuntu-latest
timeout-minutes: 60
container: ${{ matrix.container }}
steps:
- name: Install requirements (ubuntu/debian)
run: |
case "${{ matrix.container }}" in
debian:9*)
# In Debian, the old repositories is removed from the main mirrors some time after EoL.
sed -i /etc/apt/sources.list -e 's/deb.debian.org/archive.debian.org/g' \
-e 's|security.debian.org|archive.debian.org/|g' \
-e '/stretch-updates/d'
;;
esac
apt-get -o Acquire::Retries=10 -qq update
apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends ca-certificates curl xz-utils clang-format python3-venv
case "${{ matrix.container }}" in
# ubuntu 18.04/16.04 and debian 10/9's jq is 1.5, ubuntu 14.04's jq is 1.3
# jq: error (at <stdin>:44): Invalid path expression near attempt to access element 0 of [0]
# tools/tidy.sh: error on line 408: jq 'del(.dictionaryDefinitions[] | select(.name == "organization-dictionary" | not))'
ubuntu:18.04* | ubuntu:16.04* | ubuntu:14.04* | debian:10* | debian:9*)
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 -o /usr/local/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64
chmod +x /usr/local/bin/jq
;;
esac
if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian')
- name: Install requirements (fedora/almalinux/centos)
run: |
if type -P dnf >/dev/null; then
dnf install -y clang-tools-extra python3
elif type -P microdnf >/dev/null; then
microdnf install -y tar xz clang-tools-extra python3
else
# In CentOS, the old repositories is removed from the main mirrors just after EoL.
# https://github.com/rust-lang/rust/pull/126352
sed -i /etc/yum.repos.d/*.repo -e 's!^mirrorlist!#mirrorlist!' \
-e 's!^#baseurl=http://mirror.centos.org/!baseurl=https://vault.centos.org/!'
sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
yum install -y xz clang python3
if [[ "${{ matrix.container }}" == "centos:6"* ]]; then
# CentOS 6's git (1.7.1) has no --local/--no-recurse-submodules.
# And even if we don't pass those flags, that version of git will not work
# anyway due to of "fatal: Couldn't find remote ref" error.
yum install -y openssh-clients perl perl-Error perl-TermReadKey rsync
rpm -i \
https://vault.ius.io/el6/x86_64/packages/p/perl-Git18-1.8.5.5-4.ius.el6.noarch.rpm \
https://vault.ius.io/el6/x86_64/packages/g/git18-1.8.5.5-4.ius.el6.x86_64.rpm
fi
fi
if: startsWith(matrix.container, 'fedora') || startsWith(matrix.container, 'almalinux') || startsWith(matrix.container, 'centos')
- name: Install requirements (alpine)
run: apk --no-cache add ca-certificates curl clang-extra-tools npm python3
shell: sh
if: startsWith(matrix.container, 'alpine')
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@nightly
- name: Install node 18
run: |
mkdir -p -- /node18
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 https://unofficial-builds.nodejs.org/download/release/v18.20.3/node-v18.20.3-linux-x64-glibc-217.tar.xz | tar xJf - --strip-components 1 -C /node18
printf '/node18/bin\n' >>"${GITHUB_PATH}"
if: (!startsWith(matrix.container, 'alpine'))
- uses: taiki-e/install-action@shellcheck
- uses: taiki-e/install-action@shfmt
- run: tools/ci/tidy-show-deps.sh
- run: tools/tidy.sh
test-tidy-bsd:
strategy:
fail-fast: false
matrix:
include:
- os: freebsd
version: '13.4'
- os: freebsd
version: '14.2'
- os: netbsd
version: '9.4'
- os: netbsd
version: '10.1'
- os: openbsd
version: '7.6'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: cross-platform-actions/action@v0.27.0
with:
environment_variables: CARGO_INCREMENTAL CARGO_NET_RETRY CARGO_TERM_COLOR RUST_BACKTRACE RUST_TEST_THREADS RUSTDOCFLAGS RUSTFLAGS RUSTUP_MAX_RETRIES
operating_system: ${{ matrix.os }}
version: ${{ matrix.version }}
shell: bash
sync_files: runner-to-vm
run: |
set -CeEuxo pipefail
case "$(uname -s)" in
FreeBSD)
sudo pkg install -y git jq npm python3 shfmt hs-ShellCheck llvm
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly-2025-01-22 --no-modify-path
export PATH="${HOME}/.cargo/bin:${PATH}"
;;
NetBSD)
sudo pkgin -y install mozilla-rootcerts-openssl git jq nodejs shfmt shellcheck clang
sudo ln -s -- /usr/pkg/bin/python3.12 /usr/pkg/bin/python3
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --no-modify-path
export PATH="${HOME}/.cargo/bin:${PATH}"
;;
# OpenBSD targets are tier 3 targets, so install Rust from package manager instead of rustup.
OpenBSD) sudo pkg_add git jq node python3 shfmt shellcheck rust rust-rustfmt clang-tools-extra ;;
esac
tools/ci/tidy-show-deps.sh
tools/tidy.sh
test-tidy-dragonfly:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: vmactions/dragonflybsd-vm@v1
with:
envs: CARGO_INCREMENTAL CARGO_NET_RETRY CARGO_TERM_COLOR RUST_BACKTRACE RUST_TEST_THREADS RUSTDOCFLAGS RUSTFLAGS RUSTUP_MAX_RETRIES
usesh: true
copyback: false
run: |
# DragonFly BSD sh's -E means -o emacs
# shellcheck disable=SC3040
set -Ceuxo pipefail
pkg upgrade -y # needed to avoid Undefined symbol "uv_library_shutdown" error
# DragonFly BSD targets are tier 3 targets, so install Rust from package manager instead of rustup.
pkg install -y bash git jq npm python3 shfmt hs-ShellCheck rust llvm
git config --global --add safe.directory "$(pwd)"
tools/ci/tidy-show-deps.sh
tools/tidy.sh
test-tidy-omnios:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: vmactions/omnios-vm@v1
with:
envs: CARGO_INCREMENTAL CARGO_NET_RETRY CARGO_TERM_COLOR RUST_BACKTRACE RUST_TEST_THREADS RUSTDOCFLAGS RUSTFLAGS RUSTUP_MAX_RETRIES
usesh: true
copyback: false
run: |
# illumos sh has no -E
# shellcheck disable=SC3040
set -Ceuxo pipefail
pkg install git jq node-20 python-312 clang-18
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 -o bootstrap.tar.gz https://pkgsrc.SmartOS.org/packages/SmartOS/bootstrap/bootstrap-2023Q4-x86_64.tar.gz
tar xzpf bootstrap.tar.gz -C /
export PATH="/opt/local/sbin:/opt/local/bin:${PATH}"
pkgin -y install shfmt shellcheck
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --no-modify-path
export PATH="${HOME}/.cargo/bin:${PATH}"
git config --global --add safe.directory "$(pwd)"
tools/ci/tidy-show-deps.sh
tools/tidy.sh
test-tidy-solaris:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: vmactions/solaris-vm@v1
with:
envs: CARGO_INCREMENTAL CARGO_NET_RETRY CARGO_TERM_COLOR RUST_BACKTRACE RUST_TEST_THREADS RUSTDOCFLAGS RUSTFLAGS RUSTUP_MAX_RETRIES
usesh: true
copyback: false
run: |
# Solaris sh has no -C/-E/-o pipefail
set -eux
g() {
ifs="${IFS}"
IFS=' '
cmd="$*"
IFS="${ifs}"
printf '::group::%s\n' "${cmd#retry }"
"$@"
printf '::endgroup::\n'
}
g egrep 'AV_|AV2_' /usr/include/sys/auxv_SPARC.h
# rustup doesn't support host tools on Solaris. https://github.com/rust-lang/rustup/issues/2987
g pkg install git jq pkg://solaris/runtime/python-37 clang gnu-make developer/rust/cargo developer/rust/rustc
# TODO: nodejs shellcheck
# runtime/nodejs from pkg install is node 16.
# developer/golang from pkg install is too old (1.7) to build shfmt.
go_bootstrap=go1.4.3
# last version that can be built with one bootstrap: https://go.dev/doc/install/source
go=go1.19.13
printf '::group::install %s\n' "${go}"
mkdir -p -- "${HOME}/go/${go_bootstrap}" "${HOME}/go/${go}"
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "https://go.dev/dl/${go_bootstrap}.src.tar.gz" | gtar xzf - --strip-components 1 -C "${HOME}/go/${go_bootstrap}"
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "https://go.dev/dl/${go}.src.tar.gz" | gtar xzf - --strip-components 1 -C "${HOME}/go/${go}"
(cd -- "${HOME}/go/${go_bootstrap}"/src && PATH="/usr/gnu/bin:${PATH}" ./make.bash --no-banner)
"${HOME}/go/${go_bootstrap}"/bin/go version
(cd -- "${HOME}/go/${go}"/src && PATH="/usr/gnu/bin:${PATH}" GOROOT_BOOTSTRAP="${HOME}/go/${go_bootstrap}" ./make.bash --no-banner)
rm -rf -- "${HOME}/go/${go_bootstrap}"
export PATH="${HOME}/go/${go}/bin:${PATH}"
go version
export GOPATH="${HOME}/go"
export PATH="${GOPATH}/bin:${PATH}"
printf '::endgroup::\n'
# Use 3.7 because 3.8 dropped support for Go 1.19 and 1.20.
g go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
pkg uninstall gnu-make
tools/ci/tidy-show-deps.sh
tools/tidy.sh
codegen:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
pull-requests: write # for gh pr edit --add-assignee
repository-projects: read # for gh pr edit --add-assignee
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@nightly
- run: tools/gen.sh
- id: diff
run: tools/ci/gen.sh
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main')
- id: create-pull-request
uses: peter-evans/create-pull-request@v7
with:
title: Update generated code
body: |
Auto-generated by CI using [create-pull-request](https://github.com/peter-evans/create-pull-request).
branch: update-generated-code
token: ${{ secrets.CREATE_PR_TOKEN }}
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false'
- name: Notify PR author by assigning PR
run: gh pr edit --add-assignee taiki-e "${PR_NUMBER:?}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false'
- run: git add -N . && git diff --exit-code