Skip to content

Commit

Permalink
Merge branch 'nix-rust:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hack3ric committed Mar 31, 2024
2 parents 5b7a353 + 4ab23c3 commit 356fecd
Show file tree
Hide file tree
Showing 128 changed files with 8,162 additions and 6,592 deletions.
291 changes: 1 addition & 290 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,306 +65,17 @@ task:
- if [ -z "$NOHACK" ]; then cargo hack check --each-feature --target i686-unknown-freebsd; fi
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Test macOS aarch64 in a full VM
task:
name: macOS aarch64
env:
TARGET: aarch64-apple-darwin
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
setup_script:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain $MSRV
- . $HOME/.cargo/env
- rustup component add clippy
<< : *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:
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
RUST_TEST_THREADS: 1 # QEMU works best with 1 thread
HOME: /tmp/home
HOST: x86_64-unknown-linux-gnu
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 $MSRV
- . $HOME/.cargo/env
- cargo install cross --version 0.2.5
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Tasks for Linux native builds
# Tasks for Linux aarch64 native builds
task:
matrix:
- name: Linux aarch64
arm_container:
image: rust:1.69.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: aarch64-unknown-linux-gnu
- name: Linux x86_64
container:
image: rust:1.69.0
cpu: 1
env:
TARGET: x86_64-unknown-linux-gnu
- name: Linux x86_64 musl
container:
image: rust:1.69.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: x86_64-unknown-linux-musl
setup_script:
- rustup target add $TARGET
- rustup component add clippy
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index

task:
name: Rust Stable
container:
image: rust:latest
cpu: 1
env:
TARGET: x86_64-unknown-linux-gnu
setup_script:
- 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.69.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
BUILD: check
HOST: x86_64-unknown-linux-gnu
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-unknown-fuchsia
- name: Illumos
env:
TARGET: x86_64-unknown-illumos
# 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
# 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 component add clippy
<< : *BUILD
before_cache_script: rm -rf $CARGO_HOME/registry/index

task:
container:
# Redox's MSRV policy is unclear. Until they define it, use nightly.
image: rustlang/rust:nightly
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
BUILD: check
name: Redox x86_64
env:
HOST: x86_64-unknown-linux-gnu
TARGET: x86_64-unknown-redox
CLIPPYFLAGS: -D warnings
setup_script:
- rustup target add $TARGET
- rustup component add clippy
<< : *BUILD
before_cache_script: rm -rf $CARGO_HOME/registry/index

## Rust Tier 3 targets can't use Rustup
task:
container:
image: rustlang/rust:nightly
cpu: 1
env:
BUILD: check
HOST: x86_64-unknown-linux-gnu
ZFLAGS: -Zbuild-std
CLIPPYFLAGS: -D warnings
matrix:
- name: DragonFly BSD x86_64
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: x86_64-unknown-dragonfly
- name: OpenBSD x86_64
env:
TARGET: x86_64-unknown-openbsd
- name: Linux armv7 uclibceabihf
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: armv7-unknown-linux-uclibceabihf
- name: Haiku x86_64
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: x86_64-unknown-haiku
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:
HOST: x86_64-unknown-linux-gnu
container:
image: rustlang/rust:nightly
cpu: 1
setup_script:
- cargo update -Zminimal-versions
check_script:
- cargo check
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Tasks that checks if the code is formatted right using `cargo fmt` tool
task:
name: Rust Formatter
container:
image: rust:latest
cpu: 1
setup_script: rustup component add rustfmt
test_script: cargo fmt --all -- --check **/*.rs
72 changes: 72 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Build'
description: 'Build nix'
inputs:
# This is required
TARGET:
required: true

BUILD:
required: false
default: build

CLIPPYFLAGS:
required: false
default: -D warnings -A unknown-lints

RUSTFLAGS:
required: false
default: -D warnings -A unknown-lints

RUSTDOCFLAGS:
required: false
default: -D warnings

TOOL:
description: 'Tool used to involve the BUILD command, can be cargo or cross'
required: false
default: cargo

ZFLAGS:
required: false
default:

NOHACK:
description: "whether to run cargo hack"
required: false
default: false

runs:
using: "composite"
steps:
- name: set up Rust env
shell: bash
run: |
echo "RUSTFLAGS=${{ inputs.RUSTFLAGS }}" >> $GITHUB_ENV
echo "RUSTDOCFLAGS=${{ inputs.RUSTDOCFLAGS }}" >> $GITHUB_ENV
- name: debug info
shell: bash
run: |
${{ inputs.TOOL }} -Vv
rustc -Vv
- name: build
shell: bash
run: ${{ inputs.TOOL }} ${{ inputs.BUILD }} ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features

- name: doc
shell: bash
run: ${{ inputs.TOOL }} doc ${{ inputs.ZFLAGS }} --no-deps --target ${{ inputs.TARGET }} --all-features

- name: clippy
shell: bash
run: ${{ inputs.TOOL}} clippy ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features -- ${{ inputs.CLIPPYFLAGS }}

- name: Set up cargo-hack
if: inputs.NOHACK == 'false'
uses: taiki-e/install-action@cargo-hack

- name: run cargo hack
shell: bash
if: inputs.NOHACK == 'false'
run: ${{ inputs.TOOL }} hack ${{ inputs.ZFLAGS }} check --target ${{ inputs.TARGET }} --each-feature
Loading

0 comments on commit 356fecd

Please sign in to comment.