Skip to content

feat!: wpb-5608

feat!: wpb-5608 #2979

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
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- run: cargo fmt --all -- --check
check-strict:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- run: cargo check --tests
- run: cargo check --benches
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
components: clippy
target: wasm32-unknown-unknown
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: taiki-e/install-action@nextest
- name: "Test CoreCrypto"
run: cargo nextest run --verbose
- name: "Test CoreCrypto documentation"
run: cargo test --doc
- name: "Test Keystore regressions"
run: |
cd extras/keystore-regression-versions
cargo run
proteus-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- 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-keystore", "mls-crypto-provider"]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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
- name: Run tests (wasm)
run: cargo test --target wasm32-unknown-unknown -p ${{ matrix.workspace }}
# TODO: pending a proper solution to fix the size limit for WASM tests
wasm-core-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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
- name: Run core tests (wasm)
run: sh crypto-ffi/bindings/js/test/wasm-tests.sh
proteus-wasm-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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
- name: Run tests (wasm)
run: |
cargo test --features "proteus-keystore" --target wasm32-unknown-unknown -p core-crypto-keystore proteus
cargo test --features "proteus,cryptobox-migrate" --target wasm32-unknown-unknown -p core-crypto proteus
e2e-interop-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 18
- run: |
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
- name: Run E2E interop test
run: cargo run --bin interop
hack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ''
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: taiki-e/install-action@cargo-hack
- name: cargo/hack (verify features compile in isolation)
run: cargo hack check --each-feature --exclude-features uniffi --no-dev-deps