summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-08-22 09:19:51 -0600
committerAlan Somers <asomers@gmail.com>2021-08-22 10:33:07 -0600
commitd20fe20af79cc6fa4528a8a170ad50a1319a1fbf (patch)
treedfa5849cb7cfa05df0db3667093ab323b4c0269d
parentf3cb6b321fa1e16dc14b9bcdc37f001375a8c85c (diff)
downloadnix-d20fe20af79cc6fa4528a8a170ad50a1319a1fbf.zip
Multiple CI improvements:
* Install cross the easy way, via cargo * Don't test in release mode. Nix contains no release-dependent paths, and release mode testing has to my knowledge never revealed a bug in Nix. * Add Linux powerpc back to CI, fixed by the latest cross. * Check the tests even on platforms that can't run them. * DRY for the Illumos and Redox sections * Cross-check iOS from a Linux VM instead of OSX * Revert the workaround for rust-lang/rustup issue 2774
-rw-r--r--.cirrus.yml109
-rw-r--r--bors.toml1
-rw-r--r--ci/install.sh49
-rw-r--r--ci/script.sh31
4 files changed, 52 insertions, 138 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index cb360947..3a74a4a4 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -8,9 +8,6 @@ cargo_cache:
# the system's binaries, so the environment shouldn't matter.
task:
name: FreeBSD amd64 & i686
- env:
- # Temporary workaround for https://github.com/rust-lang/rustup/issues/2774
- RUSTUP_IO_THREADS: 1
freebsd_instance:
image: freebsd-11-4-release-amd64
setup_script:
@@ -31,24 +28,17 @@ task:
- name: OSX x86_64
env:
TARGET: x86_64-apple-darwin
- - name: iOS aarch64
- env:
- TARGET: aarch64-apple-ios
- DISABLE_TESTS: 1
- - name: iOS x86_64
- env:
- TARGET: x86_64-apple-ios
- DISABLE_TESTS: 1
osx_instance:
image: catalina-xcode
setup_script:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
- . $HOME/.cargo/env
- - bash ci/install.sh
+ - cargo install cross
script:
- . $HOME/.cargo/env
- - bash ci/script.sh
+ - cross build --target $TARGET
+ - cross test --target $TARGET
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Use cross for QEMU-based testing
@@ -100,10 +90,11 @@ task:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
- . $HOME/.cargo/env
- - bash ci/install.sh
+ - cargo install cross
script:
- . $HOME/.cargo/env || true
- - bash ci/script.sh
+ - cross build --target $TARGET
+ - cross test --target $TARGET
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Tasks for Linux amd64 builds
@@ -128,14 +119,18 @@ task:
- rustup target add --toolchain $TOOLCHAIN $TARGET
script:
- cargo +$TOOLCHAIN build --target $TARGET --all-targets
- - cargo +$TOOLCHAIN build --target $TARGET --all-targets --release
- cargo +$TOOLCHAIN test --target $TARGET
- - cargo +$TOOLCHAIN test --target $TARGET --release
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Tasks for cross-compiling, but no testing
task:
+ container:
+ image: rust:1.46
+ env:
+ TOOLCHAIN: 1.46.0
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
@@ -154,9 +149,40 @@ task:
- 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:
+ 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:
+ 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
@@ -166,57 +192,24 @@ task:
- name: NetBSD x86_64
env:
TARGET: x86_64-unknown-netbsd
- - name: Fuchsia x86_64
+ - name: Redox x86_64
env:
- TARGET: x86_64-fuchsia
- container:
- image: rust:1.46
- setup_script:
- - rustup target add $TARGET
- script:
- - cargo +$TOOLCHAIN check --target $TARGET
- - cargo +$TOOLCHAIN check --target $TARGET --release
- - cargo +$TOOLCHAIN check --all-targets --target $TARGET
- before_cache_script: rm -rf $CARGO_HOME/registry/index
-
-# illumos toolchain isn't available via rustup until 1.50
-task:
- name: illumos
- env:
- TARGET: x86_64-unknown-illumos
- container:
- image: rust:1.50
+ TARGET: x86_64-unknown-redox
+ # Redox requires a nightly compiler.
+ # If stuff breaks, change nightly to the date in the toolchain_*
+ # directory at https://static.redox-os.org
+ TOOLCHAIN: nightly-2020-08-04
setup_script:
- rustup target add $TARGET
- script:
- - cargo +$TOOLCHAIN check --target $TARGET
- - cargo +$TOOLCHAIN check --target $TARGET --release
- before_cache_script: rm -rf $CARGO_HOME/registry/index
-
-# Redoxer is too unreliable, so we'll do a cross-build only
-# See also:
-# https://github.com/nix-rust/nix/issues/1258
-# https://github.com/rust-embedded/cross/issues/427
-task:
- name: Redox x86_64
- env:
- TARGET: x86_64-unknown-redox
- # Redox requires a nightly compiler.
- # If stuff breaks, change nightly to the date in the toolchain_*
- # directory at https://static.redox-os.org
- TOOLCHAIN: nightly-2020-08-04
- container:
- image: rustlang/rust:nightly
- setup_script:
- rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET
script:
- cargo +$TOOLCHAIN check --target $TARGET
- - cargo +$TOOLCHAIN check --target $TARGET --release
+ - cargo +$TOOLCHAIN check --all-targets --target $TARGET
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 thier own minimal dependencies.
+# rand, can't build with their own minimal dependencies.
task:
name: Minver
container:
diff --git a/bors.toml b/bors.toml
index a02fd691..1e2ad980 100644
--- a/bors.toml
+++ b/bors.toml
@@ -17,6 +17,7 @@ status = [
"Linux i686",
"Linux mipsel",
"Linux powerpc",
+ "Linux powerpc64",
"Linux powerpc64le",
"Linux s390x",
"Linux x32",
diff --git a/ci/install.sh b/ci/install.sh
deleted file mode 100644
index bcb7c110..00000000
--- a/ci/install.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-set -ex
-
-main() {
- local target=
- if [ $CIRRUS_OS = linux ]; then
- target=x86_64-unknown-linux-musl
- else
- target=x86_64-apple-darwin
- fi
-
- # Builds for iOS are done on OSX, but require the specific target to be
- # installed.
- IFS=';' read -ra TARGET_ARRAY <<< "$TARGET"
- for t in "${TARGET_ARRAY[@]}"; do
- case $t in
- aarch64-apple-ios)
- rustup target install aarch64-apple-ios
- ;;
- armv7-apple-ios)
- rustup target install armv7-apple-ios
- ;;
- armv7s-apple-ios)
- rustup target install armv7s-apple-ios
- ;;
- i386-apple-ios)
- rustup target install i386-apple-ios
- ;;
- x86_64-apple-ios)
- rustup target install x86_64-apple-ios
- ;;
- esac
- done
-
- # This fetches latest stable release
- local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
- | cut -d/ -f3 \
- | grep -E '^v[0.1.0-9.]+$' \
- | sort --version-sort \
- | tail -n1)
- curl -LSfs https://japaric.github.io/trust/install.sh | \
- sh -s -- \
- --force \
- --git japaric/cross \
- --tag $tag \
- --target $target
-}
-
-main
diff --git a/ci/script.sh b/ci/script.sh
deleted file mode 100644
index f998039a..00000000
--- a/ci/script.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-# This script takes care of testing your crate
-
-set -ex
-
-main() {
- # Add a cfg spec to allow disabling specific tests under CI.
- if [ "$CIRRUS_CI" = true ]; then
- export RUSTFLAGS=--cfg=cirrus
- fi
-
- IFS=';' read -ra TARGET_ARRAY <<< "$TARGET"
- for t in "${TARGET_ARRAY[@]}"; do
- # Build debug and release targets
- cross build --target $t
- cross build --target $t --release
-
- if [ ! -z $DISABLE_TESTS ]; then
- continue
- fi
-
- # Run tests on debug and release targets.
- cross test --target $t
- cross test --target $t --release
- done
-}
-
-# we don't run the "test phase" when doing deploys
-if [ -z $CIRRUS_TAG ]; then
- main
-fi