mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-01 20:47:18 -04:00
454 lines
12 KiB
YAML
454 lines
12 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
style:
|
|
name: Check style
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
components: rustfmt
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Cargo fmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
typos:
|
|
name: Spell Check with Typos
|
|
needs: [style]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Actions Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Check the spelling of the files in our repo
|
|
uses: crate-ci/typos@master
|
|
|
|
clippy:
|
|
name: Run clippy
|
|
needs: [style]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Load cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
components: clippy
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --all-targets -- -D warnings
|
|
|
|
- name: Clippy without default features
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --all-targets --no-default-features --features native-tls,warp -- -D warnings
|
|
|
|
check-wasm:
|
|
name: checking WASM builds
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
# fail-fast: true
|
|
|
|
matrix:
|
|
name:
|
|
- matrix-qrcode
|
|
- matrix-sdk (no-default, wasm-flags)
|
|
- matrix-sdk-base
|
|
- matrix-sdk-common
|
|
- matrix-sdk-crypto
|
|
- matrix-sdk-base / indexeddb_state_store
|
|
- matrix-sdk-crypto / indexeddb_cryptostore
|
|
|
|
include:
|
|
- name: matrix-qrcode
|
|
cargo_args: --package matrix-qrcode
|
|
- name: matrix-sdk (no-default, wasm-flags)
|
|
cargo_args: --no-default-features --features qrcode,encryption,indexeddb_stores,rustls-tls --package matrix-sdk
|
|
- name: matrix-sdk-base
|
|
cargo_args: --package matrix-sdk-base
|
|
- name: matrix-sdk-common
|
|
cargo_args: --package matrix-sdk-common
|
|
- name: matrix-sdk-crypto
|
|
cargo_args: --package matrix-sdk-crypto
|
|
|
|
# special check for specific features
|
|
- name: matrix-sdk-base / indexeddb_state_store
|
|
cargo_args: --package matrix-sdk-base --features indexeddb_state_store
|
|
- name: matrix-sdk-crypto / indexeddb_cryptostore
|
|
cargo_args: --package matrix-sdk-crypto --features indexeddb_cryptostore
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Load cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
profile: minimal
|
|
override: true
|
|
|
|
# needed for libolm-sys compilation
|
|
- name: Install emscripten
|
|
uses: mymindstorm/setup-emsdk@v11
|
|
with:
|
|
version: ${{ matrix.emcc_version || 'latest' }}
|
|
|
|
- name: check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target wasm32-unknown-unknown ${{ matrix.cargo_args }}
|
|
|
|
test-wasm:
|
|
# building wasm is not enough, we've seen runtime errors before,
|
|
# hence the tests
|
|
name: ${{ matrix.name }} WASM test
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ matrix.experimental }}
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- name: "matrix-sdk-crypto @Node14 emcc2.0"
|
|
experimental: false
|
|
emcc_version: 2.0.27
|
|
base_dir: matrix-sdk-crypto
|
|
cargo_args: --features indexeddb_cryptostore
|
|
- name: matrix-sdk-base
|
|
experimental: false
|
|
base_dir: matrix-sdk-base
|
|
cargo_args: --features indexeddb_state_store,indexeddb_cryptostore
|
|
- name: matrix-sdk
|
|
experimental: false
|
|
base_dir: matrix-sdk
|
|
# FIXME: we have to skip all examples b/c of https://github.com/rustwasm/wasm-pack/issues/666
|
|
cargo_args: --no-default-features --features indexeddb_stores,rustls-tls --lib
|
|
- name: "matrix-sdk-example-wasm_command_bot @Node14"
|
|
experimental: false
|
|
emcc_version: 2.0.27
|
|
node_version: '14'
|
|
# known to work
|
|
base_dir: matrix-sdk/examples/wasm_command_bot
|
|
cmd: |
|
|
npm install
|
|
npm test
|
|
wasm-pack test --firefox --headless
|
|
|
|
# these are _known_ broken on latest node
|
|
# - name: matrix-sdk-crypto
|
|
# experimental: true
|
|
# base_dir: matrix-sdk-crypto
|
|
- name: matrix-sdk-example-wasm_command_bot
|
|
base_dir: matrix-sdk/examples/wasm_command_bot
|
|
# this might fail
|
|
experimental: true
|
|
cmd: |
|
|
npm install
|
|
npm test
|
|
wasm-pack test --firefox --headless
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Load cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node_version || 'lts/*' }}
|
|
|
|
- name: Install emscripten
|
|
uses: mymindstorm/setup-emsdk@v11
|
|
with:
|
|
version: ${{ matrix.emcc_version || 'latest' }}
|
|
|
|
- name: Install wasm-pack
|
|
run: cargo install wasm-pack
|
|
|
|
- name: Verify versions
|
|
run: |
|
|
echo "> node --version"
|
|
node --version
|
|
echo "> npm --version"
|
|
npm --version
|
|
echo "> wasm-pack --version"
|
|
wasm-pack --version
|
|
echo "> emcc -v"
|
|
emcc -v
|
|
|
|
- name: Default wasm-pack tests
|
|
if: ${{!matrix.cmd}}
|
|
run: |
|
|
cd crates/${{matrix.base_dir}}
|
|
wasm-pack test --node -- ${{ matrix.cargo_args }}
|
|
wasm-pack test --firefox --headless -- --features ${{ matrix.cargo_args }}
|
|
|
|
- name: Testing with custom command
|
|
if: ${{matrix.cmd}}
|
|
run: |
|
|
cd crates/${{matrix.base_dir}}
|
|
${{matrix.cmd}}
|
|
|
|
test-appservice:
|
|
name: ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
name:
|
|
- linux / appservice / stable / warp
|
|
- macOS / appservice / stable / warp
|
|
|
|
include:
|
|
- name: linux / appservice / stable / warp
|
|
cargo_args: --features warp
|
|
|
|
- name: macOS / appservice / stable / warp
|
|
os: macOS-latest
|
|
cargo_args: --features warp
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Load cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust || 'stable' }}
|
|
target: ${{ matrix.target }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --manifest-path crates/matrix-sdk-appservice/Cargo.toml ${{ matrix.cargo_args }} -- -D warnings
|
|
|
|
- name: Build
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --manifest-path crates/matrix-sdk-appservice/Cargo.toml ${{ matrix.cargo_args }}
|
|
|
|
- name: Test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --manifest-path crates/matrix-sdk-appservice/Cargo.toml ${{ matrix.cargo_args }}
|
|
|
|
test-features:
|
|
name: ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
name:
|
|
- linux / features-no-encryption
|
|
- linux / features-no-sled
|
|
- linux / features-no-encryption-and-sled
|
|
- linux / features-sled_cryptostore
|
|
- linux / features-rustls-tls
|
|
- linux / features-markdown
|
|
- linux / features-socks
|
|
- linux / features-sso_login
|
|
|
|
include:
|
|
- name: linux / features-no-encryption
|
|
cargo_args: --no-default-features --features "sled_state_store, native-tls"
|
|
|
|
- name: linux / features-no-sled
|
|
cargo_args: --no-default-features --features "encryption, native-tls"
|
|
|
|
- name: linux / features-no-encryption-and-sled
|
|
cargo_args: --no-default-features --features "native-tls"
|
|
|
|
- name: linux / features-sled_cryptostore
|
|
cargo_args: --no-default-features --features "encryption, sled_cryptostore, native-tls"
|
|
|
|
- name: linux / features-rustls-tls
|
|
cargo_args: --no-default-features --features rustls-tls
|
|
|
|
- name: linux / features-markdown
|
|
cargo_args: --features markdown
|
|
|
|
- name: linux / features-socks
|
|
cargo_args: --features socks
|
|
|
|
- name: linux / features-sso_login
|
|
cargo_args: --features sso_login
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Load cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust || 'stable' }}
|
|
target: ${{ matrix.target }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --manifest-path crates/matrix-sdk/Cargo.toml ${{ matrix.cargo_args }}
|
|
|
|
- name: Test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --manifest-path crates/matrix-sdk/Cargo.toml ${{ matrix.cargo_args }}
|
|
|
|
test:
|
|
name: ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
name:
|
|
- linux / stable
|
|
- linux / beta
|
|
- macOS / stable
|
|
|
|
include:
|
|
- name: linux / stable
|
|
|
|
- name: linux / beta
|
|
rust: beta
|
|
|
|
- name: macOS / stable
|
|
os: macOS-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Load cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust || 'stable' }}
|
|
target: ${{ matrix.target }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Build
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
|
|
- name: Test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|