From 123b3831a71149f36576bf595319c31217cd8590 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Tue, 10 Oct 2023 15:38:50 +0200 Subject: [PATCH] Ubify CI with RustCycles somewhat --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddf116b..2169345 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,11 @@ on: pull_request: branches: [ master ] schedule: - # Runs at 15:00 UTC on Fri + # Runs at 15:00 UTC on Fri - cron: "0 15 * * 5" + workflow_dispatch: + # This allows running it on any branch manually: + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow env: CARGO_TERM_COLOR: always @@ -22,25 +25,44 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + rust: [stable, nightly] + # For reference: https://github.com/actions/virtual-environments#available-environments + os: [ubuntu-latest, windows-latest, macos-latest] + exclude: + # Each minute of MacOS CI counts as 10 minutes towards the limit + # (https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#minute-multipliers) + # and nightly doesn't benefit from caching much + # so this combination would take up the vast majority of the free CI limit. + - os: macos-latest + rust: nightly steps: - name: Install linux deps if: ${{ matrix.os == 'ubuntu-latest' }} + # Run update first or install might start failing eventually run: | sudo apt-get update sudo apt-get install --no-install-recommends -y pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev - run: rustup target add wasm32-unknown-unknown + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 + - name: Print versions run: rustc --version && cargo --version + - name: Build native - run: cargo build --verbose + # Use build instead of check since it needs to be built for tests anyway + run: cargo build --verbose --all-features + - name: Run tests run: cargo test --verbose --all-features - # Test WASM only on ubuntu - the result should be the same on any OS and ubuntu is the fastest. + - name: Build web + # Test WASM only on ubuntu - the result should be the same on any OS and ubuntu is the fastest. if: ${{ matrix.os == 'ubuntu-latest' }} run: cargo build --verbose --target wasm32-unknown-unknown @@ -51,13 +73,18 @@ jobs: - run: cargo fmt --version - run: cargo fmt -- --check - clippy: + lint: runs-on: ubuntu-latest steps: - - run: | + - name: Install linux deps + # Run update first or install might start failing eventually + run: | sudo apt-get update sudo apt-get install --no-install-recommends -y pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev + - uses: actions/checkout@v3 + # Use rust-toolchain because GHA tends to still have an old version for a few days after a new Rust release. + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 - run: cargo clippy --version