Merge pull request #294 from jurteam/staging #758
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
merge_group: | |
branches: [ main, develop ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
install_toolchain: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set-Up | |
run: sudo apt-get update && sudo apt-get install -f -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler eatmydata | |
- name: Cache toolchain | |
id: cache-rustup | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }} | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
- name: Install Rustup | |
id: install-rustup | |
if: steps.cache-rustup.outputs.cache-hit != 'true' | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
source ~/.cargo/env | |
rustup default stable | |
rustup update nightly | |
rustup update stable | |
rustup toolchain install nightly | |
rustup target add wasm32-unknown-unknown --toolchain nightly | |
build-deps: | |
runs-on: ubuntu-latest | |
needs: [install_toolchain] | |
steps: | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v3 | |
with: | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }} | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
- name: cache dependencies | |
id: cache-cargo | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
path: | | |
~/.cargo/ | |
./target/ | |
- name: cargo check | |
id: cargo-check | |
if: steps.cache-toolchain.outputs.cache-hit != 'true' | |
run: SKIP_WASM_BUILD= cargo check --all | |
build: | |
runs-on: ubuntu-latest | |
needs: [install_toolchain,build-deps] | |
steps: | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v3 | |
with: | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }} | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
- uses: actions/cache/restore@v3 | |
with: | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
path: | | |
~/.cargo/ | |
./target/ | |
- name: Build | |
run: SKIP_WASM_BUILD= cargo check --all-targets --features runtime-benchmarks | |
fmt: | |
runs-on: ubuntu-latest | |
needs: [install_toolchain,build-deps] | |
steps: | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v3 | |
with: | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }} | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
- uses: actions/cache/restore@v3 | |
with: | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
path: | | |
~/.cargo/ | |
./target/ | |
- name: Check format | |
run: cargo fmt --all -- --check | |
test: | |
runs-on: ubuntu-latest | |
needs: [install_toolchain,build-deps] | |
steps: | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v3 | |
with: | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }} | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
- name: Test | |
run: SKIP_WASM_BUILD= cargo test --workspace --features runtime-benchmarks |