Skip to content

CI

CI #180

Workflow file for this run

name: CI
on: merge_group
jobs:
check:
name: Check (1.63.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/index
key: cargo-git-index
- uses: dtolnay/[email protected]
- run: cp ci/compat-Cargo.lock ./Cargo.lock
- run: cargo check --verbose --locked
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo build --verbose
- run: cargo test --verbose --package rayon
- run: cargo test --verbose --package rayon-core
- run: ./ci/highlander.sh
# rayon-demo has huge dependencies, so limit its testing.
# build on stable, test on nightly (because of #[bench])
demo:
name: Demo
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo build --verbose --package rayon-demo
- run: cargo test --verbose --package rayon-demo
if: matrix.rust == 'nightly'
i686:
name: Test (ubuntu-latest, stable-i686)
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable-i686-unknown-linux-gnu
- run: cargo build --verbose
- run: cargo test --verbose --package rayon
- run: cargo test --verbose --package rayon-core
# wasm32-unknown-unknown builds, and even has the runtime fallback for
# unsupported threading, but we don't have an environment to execute in.
wasm:
name: WebAssembly (standalone)
runs-on: ubuntu-latest
strategy:
matrix:
include:
- toolchain: stable
- toolchain: nightly
cargoflags: --features web_spin_lock
rustflags: -C target-feature=+atomics,+bulk-memory,+mutable-globals
env:
RUSTFLAGS: ${{ matrix.rustflags }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: wasm32-unknown-unknown
- run: cargo build --verbose --target wasm32-unknown-unknown ${{ matrix.cargoflags }}
# wasm32-wasi can test the fallback by running in wasmtime.
wasi:
name: WebAssembly (WASI)
runs-on: ubuntu-latest
env:
CARGO_TARGET_WASM32_WASI_RUNNER: /home/runner/.wasmtime/bin/wasmtime
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasi
- run: curl https://wasmtime.dev/install.sh -sSf | bash
- run: cargo build --verbose --target wasm32-wasi
- run: cargo test --verbose --target wasm32-wasi --package rayon
- run: cargo test --verbose --target wasm32-wasi --package rayon-core
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
components: rustfmt
- run: cargo fmt --all --check
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
# protection, rather than having to add each job separately.
success:
name: Success
runs-on: ubuntu-latest
needs: [check, test, demo, i686, wasm, wasi, fmt]
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'