Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI times by removing Wasm builds #264

Merged
merged 14 commits into from
May 17, 2023
46 changes: 11 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,15 @@ name: CI

on:
pull_request:
push:

types: [ labeled, opened, synchronize, reopened ]
env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly
# Sparse cargo registry for faster updates
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_INCREMENTAL: 1

jobs:
test-native:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Cache Cargo build files
uses: Leafwing-Studios/cargo-cache@v1
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
if: runner.os == 'linux'
- name: Install zld
run: brew install michaeleisel/zld/zld
if: runner.os == 'macos'
- name: Install llvm tools
run: cargo install -f cargo-binutils && rustup component add llvm-tools-preview
if: runner.os == 'windows'
- name: Build & run tests for native
run: cargo test
test-native-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -46,10 +21,14 @@ jobs:
uses: Leafwing-Studios/cargo-cache@v1
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run doc tests
run: cargo test --doc
- name: Run cargo test for native-dev
run: cargo test

test-wasm:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
if: contains(github.event.pull_request.labels.*.name, 'wasm') # Gated because building Wasm clears the `target` dir, invalidating the cache and causing builds to take > 30 mins :(
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
Expand All @@ -68,8 +47,11 @@ jobs:
rustup target add wasm32-unknown-unknown
- name: Build wasm
run: trunk build --no-default-features --features wasm_dev

lint:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
Expand All @@ -83,10 +65,4 @@ jobs:
- name: Check format
run: cargo fmt --all -- --check
- name: Run clippy with native dev features
run: cargo clippy --workspace --all-targets -- --deny warnings
- name: Run clippy with native release features
run: cargo clippy --workspace --all-targets --no-default-features --features native -- --deny warnings
- name: Run clippy with wasm dev features
run: cargo clippy --workspace --all-targets --no-default-features --features wasm_dev -- --deny warnings
- name: Run clippy with wasm release features
run: cargo clippy --workspace --all-targets --no-default-features --features wasm -- --deny warnings
run: cargo clippy