From de8e51884e90bbc4fb0a67aa877a7c75ba602cec Mon Sep 17 00:00:00 2001 From: Joseph LaFreniere Date: Sun, 4 Jun 2023 00:47:39 -0500 Subject: [PATCH] Run linting, formatting, and tests in CI using Nix --- .github/workflows/ci.yml | 64 +++++++--------------------------------- 1 file changed, 10 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 154f3b2..594b73d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,69 +1,25 @@ # Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md # -# While our "example" application has the platform-specific code, -# for simplicity we are compiling and testing everything on the Ubuntu environment only. -# For multi-OS testing see the `cross.yml` workflow. +# While our "example" application has platform-specific code, +# for simplicity we are compiling and testing everything in a nix-on-Linux environment only. on: [push, pull_request] name: ci jobs: - check: - name: Check - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - - test: - name: Test Suite - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install nix - uses: cachix/install-nix-action@v18 - - - name: Run tests - run: nix develop --command cargo test - - lints: + nix-flake-check: name: Lints runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, clippy + - name: Install nix + uses: cachix/install-nix-action@v21 - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - name: Ensure the build succeeds + run: nix build - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + - name: Run `nix flake check` to run formatters, linters, and tests + run: nix flake check --print-build-logs