Skip to content

Add multi user support #169

Add multi user support

Add multi user support #169

Workflow file for this run

name: Digital Voting CI
on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize]
jobs:
check:
name: Check
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# - os: macos-latest
# target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: i686-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust Default Toolchain
run: rustup toolchain install stable --profile minimal
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}-cargo-check-${{ hashFiles('**/Cargo.lock') }}
- name: Check project
run: cargo check --verbose --workspace --release --target ${{ matrix.target }}
test:
name: Test
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# - os: macos-latest
# target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: i686-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust Default Toolchain
run: rustup toolchain install stable --profile minimal
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --verbose --workspace --target ${{ matrix.target }}
formatting:
name: Check formatting
runs-on: ubuntu-latest
container:
image: thrasherlt/digital-voting-rust-multi-toolchain:latest
steps:
- uses: actions/checkout@v2
- name: Install Rust Default Toolchain
run: rustup toolchain install stable --profile default
- name: Check formatting
run: cargo fmt -- --check
- name: Check leptos formatting
run: leptosfmt --check subcrates/client/src/**.rs
docrs:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust Default Toolchain
run: rustup toolchain install stable --profile default
- name: cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-cargo-docrs-${{ hashFiles('**/Cargo.lock') }}
- name: Build documentation
run: cargo doc --verbose --workspace --no-deps
lint:
name: Run linters
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# - os: macos-latest
# target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: i686-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust Default Toolchain
run: rustup toolchain install stable --profile default
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
- name: Lint with Clippy
# Enabling all and pedantic since they seem to produce good results even if sometimes annoying.
run: cargo clippy -- -D warnings --target ${{ matrix.target }} -W clippy::all -W clippy::pedantic
dependencies:
name: Check dependencies
runs-on: ubuntu-latest
# Building udeps and deny takes way too long, so using a prebuilt image.
container:
image: thrasherlt/digital-voting-rust-multi-toolchain:latest
steps:
- uses: actions/checkout@v2
# TODO not sure if two separate caches are required here:
- name: cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
- name: Check dependencies with cargo-deny
run: cargo deny --workspace check
- name: Check unused dependencies with cargo-udeps
run: cargo +nightly udeps --workspace --all-targets
wasm-test:
name: Test on WASM
runs-on: ubuntu-latest
# Using custom container to avoid waiting for wasm-pack and chromium driver to be installed
container:
image: thrasherlt/digital-voting-rust-multi-toolchain:latest
steps:
- uses: actions/checkout@v2
- name: cache
uses: Swatinem/rust-cache@v2
with:
key: wasm-cargo-test-${{ hashFiles('**/Cargo.lock') }}
# TODO figure out a better way to test multiple crates:
# Seems like wasm-pack doesn't allow specifying multiple crates:
- name: Run WASM tests for crypto subcrate
run: wasm-pack test --chrome --headless subcrates/crypto/
- name: Run WASM tests for protocol subcrate
run: wasm-pack test --chrome --headless subcrates/protocol/
- name: Run WASM tests for client subcrate
run: wasm-pack test --chrome --headless subcrates/client/