diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5d6115cf..34d2a00b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,47 +24,29 @@ jobs: name: test env: RUST_VERSION: ${{ matrix.rust }} + TARGET: ${{ matrix.target }} strategy: matrix: - crates: - - crossbeam - - crossbeam-channel - - crossbeam-deque - - crossbeam-epoch - - crossbeam-queue - - crossbeam-skiplist - - crossbeam-utils - rust: - - 1.36.0 - - nightly - os: - - ubuntu-latest - - windows-latest - runs-on: ${{ matrix.os }} + include: + - rust: 1.36.0 + - rust: nightly + # TODO: https://github.com/crossbeam-rs/crossbeam/pull/518#issuecomment-633342606 + # - rust: nightly + # os: macos-latest + - rust: nightly + os: windows-latest + - rust: nightly + target: i686-unknown-linux-gnu + - rust: nightly + target: aarch64-unknown-linux-gnu + runs-on: ${{ matrix.os || 'ubuntu-latest' }} steps: - uses: actions/checkout@v2 - name: Install Rust # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} - name: Test - run: ./ci/${{ matrix.crates }}.sh - - # Test crates on non x86_64 architectures. - cross: - env: - TARGET: ${{ matrix.target }} - strategy: - matrix: - target: - - i686-unknown-linux-gnu - - aarch64-unknown-linux-gnu - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install Rust - run: rustup update stable && rustup default stable - - name: Test - run: ./ci/cross.sh + run: ./ci/test.sh # Check all feature combinations works properly. features: diff --git a/ci/cross.sh b/ci/cross.sh deleted file mode 100755 index 7034c8661..000000000 --- a/ci/cross.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/.. -set -ex - -cargo install cross - -cross test --target "$TARGET" --all --exclude benchmarks diff --git a/ci/crossbeam-channel.sh b/ci/crossbeam-channel.sh deleted file mode 100755 index 3482365d0..000000000 --- a/ci/crossbeam-channel.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/../crossbeam-channel -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test -- --test-threads=1 - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - cd benchmarks - cargo check --bins - cd .. - - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -fi diff --git a/ci/crossbeam-deque.sh b/ci/crossbeam-deque.sh deleted file mode 100755 index fb53ab88c..000000000 --- a/ci/crossbeam-deque.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/../crossbeam-deque -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -fi diff --git a/ci/crossbeam-epoch.sh b/ci/crossbeam-epoch.sh deleted file mode 100755 index 995f81c0d..000000000 --- a/ci/crossbeam-epoch.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/../crossbeam-epoch -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - cargo test --features nightly - - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features - - if [[ "$OSTYPE" == "linux"* ]]; then - ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \ - RUSTFLAGS="-Z sanitizer=address" \ - cargo run \ - --release \ - --target x86_64-unknown-linux-gnu \ - --features sanitize,nightly \ - --example sanitize - fi -fi diff --git a/ci/crossbeam-queue.sh b/ci/crossbeam-queue.sh deleted file mode 100755 index b15303b5b..000000000 --- a/ci/crossbeam-queue.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/../crossbeam-queue -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -fi diff --git a/ci/crossbeam-skiplist.sh b/ci/crossbeam-skiplist.sh deleted file mode 100755 index 3928d42e4..000000000 --- a/ci/crossbeam-skiplist.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/../crossbeam-skiplist -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - cargo test --features nightly - - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -fi diff --git a/ci/crossbeam-utils.sh b/ci/crossbeam-utils.sh deleted file mode 100755 index 4879687de..000000000 --- a/ci/crossbeam-utils.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/../crossbeam-utils -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - cargo test --features nightly - - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -fi diff --git a/ci/crossbeam.sh b/ci/crossbeam.sh deleted file mode 100755 index 99d4483bd..000000000 --- a/ci/crossbeam.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")"/.. -set -ex - -export RUSTFLAGS="-D warnings" - -cargo check --bins --examples --tests -cargo test - -if [[ "$RUST_VERSION" == "nightly"* ]]; then - cargo test --features nightly - - RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -fi diff --git a/ci/test.sh b/ci/test.sh new file mode 100755 index 000000000..8a5650dab --- /dev/null +++ b/ci/test.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +cd "$(dirname "$0")"/.. +set -ex + +export RUSTFLAGS="-D warnings" + +if [[ -n "$TARGET" ]]; then + # If TARGET is specified, use cross for testing. + cargo install cross + cross test --all --target "$TARGET" --exclude benchmarks + + # For now, the non-host target only runs tests. + exit 0 +fi + +# Otherwise, run tests and checks with the host target. +cargo check --all --bins --examples --tests --exclude benchmarks +cargo test --all --exclude benchmarks -- --test-threads=1 + +if [[ "$RUST_VERSION" == "nightly"* ]]; then + # Some crates have `nightly` feature, so run tests with --all-features. + cargo test --all --all-features --exclude benchmarks -- --test-threads=1 + + # Make sure if documents can be generated without warning + RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all --all-features + + # Benchmarks are only checked on nightly because depending on unstable features. + cargo check --all --benches + cd crossbeam-channel/benchmarks + cargo check --bins + cd .. + + # Run address sanitizer on crossbeam-epoch + # Note: this will be significantly rewritten by https://github.com/crossbeam-rs/crossbeam/pull/591. + if [[ "$OSTYPE" == "linux"* ]]; then + cd crossbeam-epoch + cargo clean + + ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \ + RUSTFLAGS="-Z sanitizer=address" \ + cargo run \ + --release \ + --target x86_64-unknown-linux-gnu \ + --features sanitize,nightly \ + --example sanitize + + cd .. + fi +fi