Add GitHub CI and fix clippy warnings

This commit is contained in:
oxalica 2024-08-31 22:48:03 -04:00
parent 812d6c8602
commit 5fadffef4d
5 changed files with 106 additions and 1 deletions

89
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,89 @@
name: CI
on:
pull_request:
push:
permissions:
contents: read
env:
RUST_BACKTRACE: full
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
jobs:
style:
name: Code style
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust stable
run: |
rustup update --no-self-update stable
rustup default stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Rustfmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D clippy::dbg_macro -D clippy::todo
- name: Rustdoc
run: cargo doc --workspace
test:
strategy:
matrix:
rust: [stable]
name: Test ${{ matrix.rust }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ matrix.rust }}
run: |
rustup update --no-self-update ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --workspace --all-targets
- name: Test
run: cargo test --workspace --all-targets -- --include-ignored
nix-flake:
name: Flake package
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install nix
uses: cachix/install-nix-action@v26
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache nix store
uses: DeterminateSystems/magic-nix-cache-action@b46e247b898aa56e6d2d2e728dc6df6c84fdb738
with:
# I do NOT consent to share build cache between FlakeHub.
# This should NOT be the default.
use-flakehub: false
- name: Flake check
run: nix flake check --no-update-lock-file --show-trace
- name: Flake build
run: nix build --no-update-lock-file --show-trace --print-build-logs