Skip to content

Workflow file for this run

name: Rust compile & test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: [push]
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
check-strict:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check --tests
- run: cargo check --benches
- run: cargo doc --all --no-deps
env:
RUSTFLAGS: "-D warnings -W unreachable-pub"
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check --tests
- run: cargo check --benches
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- run: cargo build --verbose
- run: cargo clippy -- -D warnings
- run: cargo clippy --target wasm32-unknown-unknown -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- name: "Test CoreCrypto"
run: cargo nextest run --verbose --release
- name: "Test CoreCrypto documentation"
run: cargo test --doc
proteus-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- name: "Test CoreCrypto's proteus implementation"
run: cargo nextest run --verbose --features proteus,cryptobox-migrate,proteus-keystore proteus
# extract things unrelated to main tests not to slow them down
tooling-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- name: "Test CoreCrypto xtask tooling"
run: cargo nextest run --verbose --manifest-path xtask/Cargo.toml
- name: "Test CoreCrypto benchmarks"
run: sh crypto/benches/scripts/test.sh
wasm-build:
runs-on: ubuntu-latest
strategy:
matrix:
workspace: [ "crypto", "keystore", "mls-provider" ]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: Swatinem/rust-cache@v2
- name: WASM check
run: cargo check --tests --target wasm32-unknown-unknown
- name: WASM build
run: wasm-pack build --dev --target web ${{ matrix.workspace }}
wasm-test:
runs-on: ubuntu-latest
strategy:
matrix:
workspace: ["core-crypto", "core-crypto-keystore", "mls-crypto-provider"]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
with:
chrome-version: stable
- run: |
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
- uses: Swatinem/rust-cache@v2
- name: Run tests (wasm)
run: cargo test --release --target wasm32-unknown-unknown -p ${{ matrix.workspace }}
proteus-wasm-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: Swatinem/rust-cache@v2
- name: Run tests (wasm w/ wasm-pack)
run: |
wasm-pack test --chrome --headless keystore --features proteus-keystore -- proteus
wasm-pack test --chrome --headless crypto --features proteus,cryptobox-migrate -- proteus
e2e-interop-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Setup cargo-make
uses: davidB/rust-cargo-make@v1
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
with:
chrome-version: stable
- run: |
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
- uses: Swatinem/rust-cache@v2
- name: Run E2E interop test
run: cargo run --bin interop
hack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
- name: cargo/hack (verify features compile in isolation)
run: cargo hack check --each-feature --no-dev-deps