Skip to content

CI

CI #3677

Workflow file for this run

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