pixels/.github/workflows/ci.yml
Jay Oster 0819b8f60c
Update GitHub Actions (#322)
* Update GitHub Actions

- actions-rs is unmaintained.
  - See: https://github.com/actions-rs/toolchain/issues/216
- Enable rust-cache
- Cargo.lock was removed in #63 but it's necessary for reproducible builds in CI.
  - The lock file is ignored by dependents.
  - Our separate `pixels-ci-rust-version` repo also ignores it, so CI will still be able to tell us if the crate build ever breaks due to unlocked dependencies.
  -  See the `rust-version` job in ci.yml.
2022-12-17 16:52:45 -08:00

139 lines
3.5 KiB
YAML

name: CI
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'
jobs:
checks:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- 1.65.0
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Update apt repos
run: sudo apt -y update
- name: Install dependencies
run: sudo apt -y install libgtk-3-dev libudev-dev
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: common
- name: Cargo check
run: cargo check --workspace
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Update apt repos
run: sudo apt -y update
- name: Install dependencies
run: sudo apt -y install libgtk-3-dev libudev-dev
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: common
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo doc
run: cargo doc --workspace --no-deps
- name: Cargo clippy
run: cargo clippy --workspace --tests -- -D warnings
tests:
name: Test
runs-on: ubuntu-latest
needs: [checks, lints]
strategy:
matrix:
rust:
- stable
- beta
- 1.65.0
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Update apt repos
run: sudo apt -y update
- name: Install dependencies
run: sudo apt -y install libgtk-3-dev libudev-dev
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: common
- name: Cargo test
run: cargo test --workspace
wasm:
name: WASM
runs-on: ubuntu-latest
needs: [checks, lints]
strategy:
matrix:
example:
- minimal-web
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Update apt repos
run: sudo apt -y update
- name: Install dependencies
run: sudo apt -y install libgtk-3-dev libudev-dev
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: common
- name: WASM build
run: cargo run-wasm --build-only ${{ matrix.example }}
# See https://github.com/parasyte/pixels-ci-rust-version
rust-version:
name: Rust-Version
runs-on: ubuntu-latest
needs: [checks, lints]
strategy:
matrix:
rust:
- 1.59.0
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: parasyte/pixels-ci-rust-version
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: common
- name: Cargo build
run: cargo build