Skip to content

Commit

Permalink
Test all crates at once
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jan 4, 2021
1 parent a790c87 commit a1c5b13
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 155 deletions.
49 changes: 15 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -144,7 +126,6 @@ jobs:
if: github.event_name == 'push' && success()
needs:
- test
- cross
- features
- dependencies
- rustfmt
Expand Down
8 changes: 0 additions & 8 deletions ci/cross.sh

This file was deleted.

17 changes: 0 additions & 17 deletions ci/crossbeam-channel.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/crossbeam-deque.sh

This file was deleted.

25 changes: 0 additions & 25 deletions ci/crossbeam-epoch.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/crossbeam-queue.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/crossbeam-skiplist.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/crossbeam-utils.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/crossbeam.sh

This file was deleted.

50 changes: 50 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
@@ -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

if [[ "$RUST_VERSION" == "nightly"* ]]; then
# Some crates have `nightly` feature, so run tests with --all-features.
cargo test --all --all-features --exclude benchmarks

# 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

0 comments on commit a1c5b13

Please sign in to comment.