cargo_cache: folder: $CARGO_HOME/registry fingerprint_script: cat Cargo.lock || echo "" env: # Build by default; don't just check BUILD: build RUSTFLAGS: -D warnings RUSTDOCFLAGS: -D warnings TOOL: cargo # The MSRV TOOLCHAIN: 1.46.0 ZFLAGS: # Tests that don't require executing the build binaries build: &BUILD build_script: - . $HOME/.cargo/env || true - $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets - $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET - $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET -- -D warnings - if [ -z "$NOHACK" ]; then $TOOL install cargo-hack; fi - if [ -z "$NOHACK" ]; then $TOOL hack $ZFLAGS check --target $TARGET --each-feature; fi # Tests that do require executing the binaries test: &TEST << : *BUILD test_script: - . $HOME/.cargo/env || true - $TOOL +$TOOLCHAIN test --target $TARGET # Test FreeBSD in a full VM. Test the i686 target too, in the # same VM. The binary will be built in 32-bit mode, but will execute on a # 64-bit kernel and in a 64-bit environment. Our tests don't execute any of # the system's binaries, so the environment shouldn't matter. task: name: FreeBSD amd64 & i686 env: TARGET: x86_64-unknown-freebsd freebsd_instance: image: freebsd-12-2-release-amd64 setup_script: - fetch https://sh.rustup.rs -o rustup.sh - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN - . $HOME/.cargo/env - rustup target add i686-unknown-freebsd - rustup component add --toolchain $TOOLCHAIN clippy - cp Cargo.lock.msrv Cargo.lock << : *TEST i386_test_script: - . $HOME/.cargo/env - cargo build --target i686-unknown-freebsd - cargo doc --no-deps --target i686-unknown-freebsd - cargo test --target i686-unknown-freebsd i386_feature_script: - . $HOME/.cargo/env - cargo hack check --each-feature --target i686-unknown-freebsd before_cache_script: rm -rf $CARGO_HOME/registry/index # Test OSX in a full VM task: name: OSX x86_64 env: TARGET: x86_64-apple-darwin osx_instance: image: big-sur-xcode setup_script: - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN - . $HOME/.cargo/env - rustup component add --toolchain $TOOLCHAIN clippy - cp Cargo.lock.msrv Cargo.lock << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index # Use cross for QEMU-based testing # cross needs to execute Docker, so we must use Cirrus's Docker Builder task. task: env: RUST_TEST_THREADS: 1 # QEMU works best with 1 thread HOME: /tmp/home PATH: $HOME/.cargo/bin:$PATH RUSTFLAGS: --cfg qemu -D warnings TOOL: cross matrix: - name: Linux arm gnueabi env: TARGET: arm-unknown-linux-gnueabi - name: Linux armv7 gnueabihf env: TARGET: armv7-unknown-linux-gnueabihf - name: Linux i686 env: TARGET: i686-unknown-linux-gnu - name: Linux i686 musl env: TARGET: i686-unknown-linux-musl - name: Linux MIPS env: TARGET: mips-unknown-linux-gnu - name: Linux MIPS64 env: TARGET: mips64-unknown-linux-gnuabi64 - name: Linux MIPS64 el env: TARGET: mips64el-unknown-linux-gnuabi64 - name: Linux mipsel env: TARGET: mipsel-unknown-linux-gnu - name: Linux powerpc64le env: TARGET: powerpc64le-unknown-linux-gnu compute_engine_instance: image_project: cirrus-images image: family/docker-builder platform: linux cpu: 1 # Since QEMU will only use 1 thread memory: 4G setup_script: - mkdir /tmp/home - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN - . $HOME/.cargo/env - cargo install cross - cp Cargo.lock.msrv Cargo.lock << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index # Tasks for Linux native builds task: matrix: - name: Linux aarch64 arm_container: image: rust:1.46 env: RUSTFLAGS: --cfg graviton -D warnings TARGET: aarch64-unknown-linux-gnu - name: Linux x86_64 container: image: rust:1.46 env: TARGET: x86_64-unknown-linux-gnu - name: Linux x86_64 musl container: image: rust:1.46 env: TARGET: x86_64-unknown-linux-musl setup_script: - rustup target add $TARGET - rustup component add clippy - cp Cargo.lock.msrv Cargo.lock << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index task: name: Rust Stable container: image: rust:latest env: TARGET: x86_64-unknown-linux-gnu TOOLCHAIN: setup_script: - rustup target add $TARGET - rustup component add clippy << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index # Tasks for cross-compiling, but no testing task: container: image: rust:1.46 env: BUILD: check matrix: # Cross claims to support Android, but when it tries to run Nix's tests it # reports undefined symbol references. - name: Android aarch64 env: TARGET: aarch64-linux-android - name: Android arm env: TARGET: arm-linux-androideabi - name: Android armv7 env: TARGET: armv7-linux-androideabi - name: Android i686 env: TARGET: i686-linux-android - name: Android x86_64 env: TARGET: x86_64-linux-android - name: Linux arm-musleabi env: TARGET: arm-unknown-linux-musleabi - name: Fuchsia x86_64 env: TARGET: x86_64-fuchsia - name: Illumos env: TARGET: x86_64-unknown-illumos # illumos toolchain isn't available via rustup until 1.50 TOOLCHAIN: 1.50.0 container: image: rust:1.50 # Cross claims to support running tests on iOS, but it actually doesn't. # https://github.com/rust-embedded/cross/issues/535 - name: iOS aarch64 env: # cargo hack tries to invoke the iphonesimulator SDK for iOS NOHACK: 1 TARGET: aarch64-apple-ios # Rustup only supports cross-building from arbitrary hosts for iOS at # 1.49.0 and above. Below that it's possible to cross-build from an OSX # host, but OSX VMs are more expensive than Linux VMs. TOOLCHAIN: 1.49.0 - name: iOS x86_64 env: # cargo hack tries to invoke the iphonesimulator SDK for iOS NOHACK: 1 TARGET: x86_64-apple-ios TOOLCHAIN: 1.49.0 # Cross testing on powerpc fails with "undefined reference to renameat2". # Perhaps cross is using too-old a version? - name: Linux powerpc env: TARGET: powerpc-unknown-linux-gnu # Cross claims to support Linux powerpc64, but it really doesn't. # https://github.com/rust-embedded/cross/issues/441 - name: Linux powerpc64 env: TARGET: powerpc64-unknown-linux-gnu - name: Linux s390x env: TARGET: s390x-unknown-linux-gnu - name: Linux x32 env: TARGET: x86_64-unknown-linux-gnux32 - name: NetBSD x86_64 env: TARGET: x86_64-unknown-netbsd setup_script: - rustup target add $TARGET - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET - rustup component add --toolchain $TOOLCHAIN clippy - cp Cargo.lock.msrv Cargo.lock << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index task: container: image: rust:1.46 env: BUILD: check name: Redox x86_64 env: TARGET: x86_64-unknown-redox # cargo-hack needs a newer compiler. # TODO: try enabling NOHACK. NOHACK: 1 # Redox requires a nightly compiler. # If stuff breaks, change nightly to the date at # https://gitlab.redox-os.org/redox-os/redox/-/blob/master/rust-toolchain TOOLCHAIN: nightly-2021-06-15 setup_script: - rustup target add $TARGET - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET - rustup component add --toolchain $TOOLCHAIN clippy << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index # DragonflyBSD temporarily needs a pinned nightly toolchain # rustc is broken on DragonflyBSD as of Dec-5, probably by # https://github.com/rust-lang/rust/commit/e68887e67cc6b7bb4ea5113a40eaa4c0831bda13 task: container: image: rust:1.46 name: DragonFly BSD x86_64 env: BUILD: check ZFLAGS: -Zbuild-std TARGET: x86_64-unknown-dragonfly # Redox requires a nightly compiler. # If stuff breaks, change nightly to the date at # https://gitlab.redox-os.org/redox-os/redox/-/blob/master/rust-toolchain TOOLCHAIN: nightly-2021-12-04 # Temporarily allow deprecation on DragonflyBSD until an alternative is # available. #https://github.com/rust-lang/libc/pull/2522 RUSTFLAGS: -D warnings -A deprecated setup_script: - rustup toolchain add $TOOLCHAIN --profile minimal - rustup component add rust-src --toolchain $TOOLCHAIN - rustup component add clippy --toolchain $TOOLCHAIN << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index # Rust Tier 3 targets can't use Rustup task: container: image: rustlang/rust:nightly env: BUILD: check TOOLCHAIN: nightly ZFLAGS: -Zbuild-std matrix: - name: OpenBSD x86_64 env: TARGET: x86_64-unknown-openbsd setup_script: - rustup component add rust-src << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index # Test that we can build with the lowest version of all dependencies. # "cargo test" doesn't work because some of our dev-dependencies, like # rand, can't build with their own minimal dependencies. task: name: Minver env: TOOLCHAIN: nightly container: image: rustlang/rust:nightly setup_script: - cargo update -Zminimal-versions check_script: - cargo check before_cache_script: rm -rf $CARGO_HOME/registry/index