From 2c394aa265ca2bed677d9152e3941cfe56819051 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 18 May 2023 16:14:46 +0100 Subject: [PATCH] Add a CI check that everything compiles (#321) --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0996920..087c986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,6 @@ on: push: branches: - main - - dev pull_request: jobs: @@ -11,17 +10,35 @@ jobs: name: cargo fmt steps: - uses: actions/checkout@v2 - - - name: install stable toolchain - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable + - run: cargo fmt --all --check + compiles: + runs-on: ubuntu-latest + name: Check workspace compile + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + - name: Install native dependencies + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + - run: cargo check --workspace + # --exclude with_bevy # for when bevy has an outdated wgpu version + # -Dwarnings # for when we have fixed unused code warnings + + wasm: + runs-on: ubuntu-latest + name: Ensure with_winit compiles on WASM + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - components: rustfmt - override: true + targets: wasm32-unknown-unknown + # cargo-run-wasm does not provide a way to determine that it failed programmatically. + # Ideally, fix this and use: + # - run: cargo run_wasm -- -p with_winit --bin with_winit_bin --build-only + - name: Allow using WebGPU in web_sys + run: | + echo "RUSTFLAGS=--cfg=web_sys_unstable_apis" >> "$GITHUB_ENV" + - run: cargo check -p with_winit --target wasm32-unknown-unknown + + - - name: cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check