refs/heads/main by @iwanders #95
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: Rust Checks | |
run-name: "${{ github.ref }} by @${{ github.actor }}" | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- staging | |
pull_request: | |
branches: | |
- master | |
- main | |
- staging | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
jobs: | |
ubuntu-native: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Rust install | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh | |
sh ./rustup.sh --profile minimal -y | |
- name: Setup Cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/ | |
target/ | |
key: ${{ runner.os }}-native-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-native- | |
- name: Format | |
# https://github.com/rust-lang/rustfmt#checking-style-on-a-ci-server | |
run: cargo fmt --all -- --check | |
- name: Build | |
run: cargo build --release --features unit_control_wasm | |
- name: Clippy | |
run: cargo clippy --release --features unit_control_wasm -- --no-deps --deny "warnings" | |
- name: Test | |
run: cargo test --release --features unit_control_wasm | |
web-wasmpack: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./battleground_viewer | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Rust install | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh | |
sh ./rustup.sh --profile minimal -y -t wasm32-unknown-unknown | |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Setup Cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/ | |
target/ | |
key: ${{ runner.os }}-web-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-web- | |
- name: Build | |
run: | | |
cat /home/runner/work/battleground_construct/battleground_construct/Cargo.toml | |
wasm-pack build --release --target web --out-name web | |
- name: Clippy | |
run: | | |
cargo clippy --release --target wasm32-unknown-unknown -- --no-deps --deny "warnings" | |