CI #1469
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- dev | |
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 | |
RUST_TEST_THREADS: 1 | |
RUSTDOCFLAGS: -D warnings | |
RUSTFLAGS: -D warnings | |
RUSTUP_MAX_RETRIES: 10 | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
check-external-types: | |
uses: taiki-e/github-actions/.github/workflows/check-external-types.yml@main | |
deny: | |
uses: taiki-e/github-actions/.github/workflows/deny.yml@main | |
docs: | |
uses: taiki-e/github-actions/.github/workflows/docs.yml@main | |
msrv: | |
needs: tidy | |
uses: taiki-e/github-actions/.github/workflows/msrv.yml@main | |
with: | |
event_name: ${{ github.event_name }} | |
tidy: | |
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main | |
with: | |
check-cfg: false # covered by ./tools/build.sh | |
test: | |
needs: tidy | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- rust: '1.59' | |
- rust: stable | |
- rust: beta | |
- rust: nightly | |
- rust: nightly | |
flags: -C panic=abort -Z panic_abort_tests | |
- rust: nightly | |
os: macos-latest | |
- rust: '1.59' | |
target: aarch64-unknown-linux-gnu | |
- rust: stable | |
target: aarch64-unknown-linux-gnu | |
- rust: nightly | |
target: aarch64-unknown-linux-gnu | |
- rust: nightly | |
target: aarch64_be-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use stable asm on this target) | |
target: aarch64_be-unknown-linux-gnu | |
- rust: '1.59' | |
target: armv5te-unknown-linux-gnueabi | |
- rust: stable | |
target: armv5te-unknown-linux-gnueabi | |
- rust: nightly | |
target: armv5te-unknown-linux-gnueabi | |
- rust: '1.59' | |
target: arm-unknown-linux-gnueabi | |
- rust: stable | |
target: arm-unknown-linux-gnueabi | |
- rust: nightly | |
target: arm-unknown-linux-gnueabi | |
- rust: '1.59' | |
target: armv7-unknown-linux-gnueabi | |
- rust: stable | |
target: armv7-unknown-linux-gnueabi | |
- rust: nightly | |
target: armv7-unknown-linux-gnueabi | |
- rust: '1.59' | |
target: armv7-unknown-linux-gnueabihf | |
- rust: stable | |
target: armv7-unknown-linux-gnueabihf | |
- rust: nightly | |
target: armv7-unknown-linux-gnueabihf | |
- rust: nightly | |
target: armeb-unknown-linux-gnueabi | |
- rust: nightly-2022-09-16 # Rust 1.65, LLVM 15 (version that this target was added) | |
target: armeb-unknown-linux-gnueabi | |
- rust: '1.59' | |
target: i586-unknown-linux-gnu | |
- rust: stable | |
target: i586-unknown-linux-gnu | |
- rust: nightly | |
target: i586-unknown-linux-gnu | |
- rust: '1.59' | |
target: i686-unknown-linux-gnu | |
- rust: stable | |
target: i686-unknown-linux-gnu | |
- rust: nightly | |
target: i686-unknown-linux-gnu | |
- rust: nightly | |
target: hexagon-unknown-linux-musl | |
- rust: nightly-2023-08-23 # The last nightly version that doesn't support MaybeUninit registers. | |
target: hexagon-unknown-linux-musl | |
- rust: '1.72' # inline asm for loongarch has been stabilized in Rust 1.72 | |
target: loongarch64-unknown-linux-gnu | |
- rust: stable | |
target: loongarch64-unknown-linux-gnu | |
- rust: nightly | |
target: loongarch64-unknown-linux-gnu | |
- rust: nightly | |
target: mips-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mips-unknown-linux-gnu | |
- rust: nightly | |
target: mipsel-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mipsel-unknown-linux-gnu | |
- rust: nightly | |
target: mips64-unknown-linux-gnuabi64 | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mips64-unknown-linux-gnuabi64 | |
- rust: nightly | |
target: mips64el-unknown-linux-gnuabi64 | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mips64el-unknown-linux-gnuabi64 | |
- rust: nightly-2023-07-18 # TODO: hang with LLVM 17 | |
target: mipsisa32r6-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mipsisa32r6-unknown-linux-gnu | |
- rust: nightly-2023-07-18 # TODO: hang with LLVM 17 | |
target: mipsisa32r6el-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mipsisa32r6el-unknown-linux-gnu | |
- rust: nightly | |
target: mipsisa64r6-unknown-linux-gnuabi64 | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mipsisa64r6-unknown-linux-gnuabi64 | |
- rust: nightly | |
target: mipsisa64r6el-unknown-linux-gnuabi64 | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: mipsisa64r6el-unknown-linux-gnuabi64 | |
- rust: nightly | |
target: powerpc-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: powerpc-unknown-linux-gnu | |
- rust: nightly | |
target: powerpc64-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: powerpc64-unknown-linux-gnu | |
- rust: nightly | |
target: powerpc64le-unknown-linux-gnu | |
- rust: nightly-2021-12-16 # Rust 1.59, LLVM 13 (oldest version we can use asm_experimental_arch on this target) | |
target: powerpc64le-unknown-linux-gnu | |
- rust: nightly | |
target: riscv32gc-unknown-linux-gnu | |
- rust: nightly-2023-08-23 # The last nightly version that doesn't support MaybeUninit registers. | |
target: riscv32gc-unknown-linux-gnu | |
- rust: '1.59' | |
target: riscv64gc-unknown-linux-gnu | |
- rust: stable | |
target: riscv64gc-unknown-linux-gnu | |
- rust: nightly | |
target: riscv64gc-unknown-linux-gnu | |
- rust: nightly | |
target: s390x-unknown-linux-gnu | |
- rust: nightly-2023-05-09 # Rust 1.71, LLVM 16 (oldest version we can implement atomic RMWs on this target) | |
target: s390x-unknown-linux-gnu | |
- rust: '1.59' | |
target: thumbv7neon-unknown-linux-gnueabihf | |
- rust: stable | |
target: thumbv7neon-unknown-linux-gnueabihf | |
- rust: nightly | |
target: thumbv7neon-unknown-linux-gnueabihf | |
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- run: | | |
lscpu | |
# sudo apt-get -o Acquire::Retries=10 -qq update && sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils | |
if: startsWith(matrix.os, 'ubuntu') || matrix.os == '' | |
- run: | | |
sysctl hw.optional machdep.cpu | |
# brew install moreutils | |
if: startsWith(matrix.os, 'macos') | |
- name: Install Rust | |
run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} | |
- run: rustup toolchain add nightly --no-self-update | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: taiki-e/install-action@cargo-minimal-versions | |
- uses: taiki-e/install-action@cargo-careful | |
if: startsWith(matrix.rust, 'nightly') | |
- uses: taiki-e/setup-cross-toolchain-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
if: matrix.target != '' | |
- run: echo "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}" | |
if: matrix.target != '' && !startsWith(matrix.target, 'i686') && !startsWith(matrix.target, 'x86_64') | |
- run: | | |
echo "RUSTFLAGS=${RUSTFLAGS} ${{ matrix.flags }}" >>"${GITHUB_ENV}" | |
echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} ${{ matrix.flags }}" >>"${GITHUB_ENV}" | |
if: matrix.flags != '' | |
- run: echo "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" | |
if: matrix.target != '' | |
# TODO: LLVM bug: Undefined temporary symbol error when building std. | |
- run: echo "RELEASE=--release" >>"${GITHUB_ENV}" | |
if: startsWith(matrix.target, 'mips-') || startsWith(matrix.target, 'mipsel-') | |
- run: tools/test.sh -vv $TARGET $DOCTEST_XCOMPILE $BUILD_STD $RELEASE | |
# We test doctest only once with the default build conditions because doctest is slow. | |
# src/tests has extended copies of doctest, so this will not reduce test coverage. | |
# x86_64 +cmpxchg16b | |
# macOS is skipped because it is +cmpxchg16b by default | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b | |
if: (matrix.target == '' || startsWith(matrix.target, 'x86_64')) && !startsWith(matrix.os, 'macos') | |
# x86 -sse2 | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=-sse2 | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=-sse2 | |
if: startsWith(matrix.target, 'i686') | |
# aarch64 +lse | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse | |
if: startsWith(matrix.target, 'aarch64') | |
# aarch64 +rcpc,+lse,+lse2 | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+rcpc,+lse,+lse2 | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+rcpc,+lse,+lse2 | |
if: startsWith(matrix.target, 'aarch64') | |
# arm v8 little endian | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+v8 | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+v8 | |
if: matrix.target == 'armv7-unknown-linux-gnueabi' | |
# arm v6 with legacy cp15_barrier | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg atomic_maybe_uninit_use_cp15_barrier | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg atomic_maybe_uninit_use_cp15_barrier | |
if: matrix.target == 'arm-unknown-linux-gnueabi' | |
# arm v7 big endian | |
# armeb-unknown-linux-gnueabi is v8 by default, use custom target instead | |
- run: tools/test.sh -vv --tests --target armebv7-unknown-linux-gnueabi -Z build-std $RELEASE | |
env: | |
CARGO_TARGET_ARMEBV7_UNKNOWN_LINUX_GNUEABI_LINKER: armeb-unknown-linux-gnueabi-gcc | |
CARGO_TARGET_ARMEBV7_UNKNOWN_LINUX_GNUEABI_RUNNER: qemu-armeb | |
if: startsWith(matrix.rust, 'nightly') && matrix.target == 'armeb-unknown-linux-gnueabi' | |
# arm v4t | |
- run: tools/test.sh -vv --tests --target armv4t-unknown-linux-gnueabi -Z build-std $RELEASE | |
env: | |
CARGO_TARGET_ARMV4T_UNKNOWN_LINUX_GNUEABI_LINKER: arm-linux-gnueabi-gcc | |
CARGO_TARGET_ARMV4T_UNKNOWN_LINUX_GNUEABI_RUNNER: qemu-arm | |
if: startsWith(matrix.rust, 'nightly') && matrix.target == 'armv5te-unknown-linux-gnueabi' | |
# powerpc64 pwr7 | |
# powerpc64- (big-endian) is skipped because it is pre-pwr8 by default | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-cpu=pwr7 | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-cpu=pwr7 | |
if: startsWith(matrix.target, 'powerpc64le-') | |
# powerpc64 pwr8 | |
# powerpc64le- (little-endian) is skipped because it is pwr8 by default | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-cpu=pwr8 | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-cpu=pwr8 | |
if: startsWith(matrix.target, 'powerpc64-') | |
# s390x z196 (arch9) | |
- run: tools/test.sh -vv --tests $TARGET $BUILD_STD $RELEASE | |
env: | |
# TODO: disable high-word LLVM target-feature to avoid LLVM codegen bug. | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-cpu=z196 -C target-feature=-high-word | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-cpu=z196 -C target-feature=-high-word | |
if: startsWith(matrix.target, 's390x') | |
- run: cargo minimal-versions build --workspace --no-private --detach-path-deps=skip-exact --all-features $TARGET $BUILD_STD $RELEASE | |
build: | |
needs: tidy | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- '1.59' | |
- stable | |
- beta | |
- nightly-2023-08-23 # The last nightly version that doesn't support MaybeUninit registers. | |
- nightly-2023-08-24 # The oldest nightly version that supports MaybeUninit registers: https://github.com/rust-lang/rust/pull/114790 | |
- nightly | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Rust | |
run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} | |
- uses: taiki-e/install-action@cargo-hack | |
- run: tools/build.sh | |
no-std: | |
needs: tidy | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- '1.64' | |
- stable | |
- nightly-2023-08-23 # The last nightly version that doesn't support MaybeUninit registers. | |
- nightly | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Rust | |
run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} | |
- run: | | |
set -eEuxo pipefail | |
sudo apt-get -o Acquire::Retries=10 -qq update && sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends \ | |
avr-libc \ | |
gcc-avr \ | |
qemu-system-arm \ | |
qemu-system-misc \ | |
simavr | |
# APT's qemu package doesn't provide firmware for riscv32: https://packages.ubuntu.com/en/jammy/all/qemu-system-data/filelist | |
OPENSBI_VERSION=1.3.1 # https://github.com/riscv-software-src/opensbi/releases | |
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://github.com/riscv-software-src/opensbi/releases/download/v${OPENSBI_VERSION}/opensbi-${OPENSBI_VERSION}-rv-bin.tar.xz" \ | |
| tar xJf - | |
sudo mv "opensbi-${OPENSBI_VERSION}-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin" /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin | |
sudo mv "opensbi-${OPENSBI_VERSION}-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.elf" /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf | |
rm -rf "opensbi-${OPENSBI_VERSION}-rv-bin" | |
- run: tools/no-std.sh | |
valgrind: | |
needs: tidy | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Rust | |
run: rustup toolchain add nightly --no-self-update && rustup default nightly | |
# - run: sudo apt-get -o Acquire::Retries=10 -qq update && sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils | |
- uses: taiki-e/install-action@valgrind | |
- run: tools/test.sh valgrind -vv | |
# +cmpxchg16b | |
- run: tools/test.sh valgrind -vv | |
env: | |
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b | |
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b | |
codegen: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Rust | |
run: rustup toolchain add nightly --no-self-update --component rustfmt && rustup default nightly | |
- run: tools/target_spec.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') | |
- uses: peter-evans/create-pull-request@v5 | |
with: | |
title: Update generated code | |
body: | | |
Auto-generated by [create-pull-request][1] | |
[Please close and immediately reopen this pull request to run CI.][2] | |
[1]: https://github.com/peter-evans/create-pull-request | |
[2]: https://github.com/peter-evans/create-pull-request/blob/HEAD/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs | |
branch: update-generated-code | |
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 |