Skip to content

CI: Improve GitHub actions #8

CI: Improve GitHub actions

CI: Improve GitHub actions #8

Workflow file for this run

name: Rust
on:
push:
branches:
- main
merge_group: {}
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
jobs:
build:
name: Build
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/rust
name: Setup
with:
name: text-xxx
components: clippy
- name: Build
run: cargo build --verbose --all-targets --all-features --locked
clippy:
name: Clippy
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/rust
name: Setup
with:
name: text-xxx
components: clippy
- name: Clippy
run: cargo clippy --all --all-targets --all-features --workspace -- --deny warnings
test:
name: Test
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/rust
name: Setup
with:
name: text-xxx
components: clippy
- name: Test
run: cargo test --verbose --all-features --workspace
format:
name: Test Formatting
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo +nightly fmt --version
- run: cargo +nightly fmt --all -- --check
udeps:
name: Check Unused Dependencies
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: udeps-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
udeps-${{ runner.os }}-
- uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-udeps
run: cargo install --force cargo-udeps
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run cargo-udeps
run: cargo udeps
comments:
name: Check Code Comments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Forgotten TODOs
run: bash tools/todos.sh