Skip to content

Use Leafwing-Studios/cargo-cache in CI #5

Use Leafwing-Studios/cargo-cache in CI

Use Leafwing-Studios/cargo-cache in CI #5

Workflow file for this run

name: Create Caches
on:
schedule:
# Run at 0:00 daily. (Basically as early as possible.)
- cron: 0 0 * * *
workflow_dispatch:
# TODO: Remove this. It is for testing purposes only.
pull_request:
# Prevent this workflow from being run more than once at a time.
concurrency:
group: ${{ github.workflow }}
jobs:
build:
name: Build
strategy:
# Don't cancel everything if one configuration happens to fail.
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Build workspace
# Exclude bevy_dylib because it causes a linker error on Windows due to exporting more than 65k objects.
run: cargo build --workspace --exclude bevy_dylib
- name: Save cache
uses: ./.github/actions/cache
with:
kind: build
toolchain: ${{ matrix.toolchain }}
action: save
check:
name: Check
strategy:
# Don't cancel everything if one configuration happens to fail.
fail-fast: false
matrix:
include:
- os: ubuntu-latest
toolchain: nightly
target: default
- os: macos-latest
toolchain: nightly
target: default
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Check workspace
if: ${{ matrix.target == 'default' }}
run: cargo check --workspace
- name: Save cache
uses: ./.github/actions/cache
with:
kind: check
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
action: save
check-wasm:
name: Check WASM
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: stable
target: wasm
- os: ubuntu-latest
toolchain: nightly
target: wasm-atomics
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust (WASM)
if: ${{ matrix.target == 'wasm' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown
- name: Install Rust (WASM Atomics)
if: ${{ matrix.target == 'wasm-atomics' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown
components: rust-src
- name: Check workspace
if: ${{ matrix.target == 'wasm' }}
run: cargo check --target wasm32-unknown-unknown
- name: Check workspace
if: ${{ matrix.target == 'wasm-atomics' }}
run: cargo check --target wasm32-unknown-unknown -Z build-std=std,panic_abort
env:
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory"
- name: Save cache
uses: ./.github/actions/cache
with:
kind: check
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
action: save
doc:
name: Doc
strategy:
# Don't cancel everything if one configuration happens to fail.
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain: [nightly]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
with:
wayland: true
xkb: true
- name: Document workspace
run: |
cargo doc --workspace --all-features --no-deps --document-private-items
cargo test --workspace --doc
- name: Save cache
uses: ./.github/actions/cache
with:
kind: doc
toolchain: ${{ matrix.toolchain }}
action: save