summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yaml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/ci.yaml')
-rw-r--r--.github/workflows/ci.yaml87
1 files changed, 40 insertions, 47 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f084a2a..68f9f35 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,8 +1,8 @@
-name: CI
+name: "CI"
on:
push:
- branches: [main]
+ branches: [ "main" ]
paths:
- "**.nix"
- "**.rs"
@@ -18,71 +18,64 @@ on:
jobs:
build:
- name: Build
+ name: "Build (${{ matrix.os }})"
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest]
+ include:
+ - os: "ubuntu-latest"
+ use-nix: true
+ - os: "windows-latest"
+ use-nix: false
runs-on: ${{ matrix.os }}
steps:
- - name: Checkout repository
- uses: actions/checkout@v4
+ - name: "Checkout repository"
+ uses: "actions/checkout@v4"
- - name: Install Rust
- uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: "Install Nix"
+ if: ${{ matrix.use-nix }}
+ uses: "cachix/install-nix-action@v30"
- - name: Run build
- run: |
- cargo build --locked --release
-
- nix:
- name: Nix
-
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v13
+ - name: "Setup Nix cache"
+ if: ${{ matrix.use-nix }}
+ uses: "DeterminateSystems/magic-nix-cache-action@v8"
- - name: Setup Nix cache
- uses: DeterminateSystems/magic-nix-cache-action@v7
+ - name: "Install Rust"
+ if: ${{ !matrix.use-nix }}
+ uses: "actions-rust-lang/setup-rust-toolchain@v1"
- - name: Run flake checks
+ - name: "Run cargo build"
+ if: ${{ !matrix.use-nix }}
run: |
- nix build --print-build-logs --show-trace
-
- rustfmt:
- name: Rustfmt
-
- runs-on: ubuntu-latest
+ cargo build --locked --release
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
+ - name: "Evaluate flake.nix"
+ if: ${{ matrix.use-nix }}
+ run: nix flake check --no-build --show-trace
- - name: Install Rust
- uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- components: rustfmt
+ - name: "Run nix build"
+ if: ${{ matrix.use-nix }}
+ run: |
+ nix build --print-build-logs
- - name: Run rustfmt
- uses: actions-rust-lang/rustfmt@v1
+ - name: "Build Flake checks"
+ if: ${{ matrix.os == 'ubuntu-latest' }}
+ run: |
+ nix flake check --print-build-logs
release-gate:
- name: CI Release gate
- needs: [build, rustfmt, nix]
+ name: "CI Release gate"
+ needs: [ "build" ]
if: ${{ always() }}
- runs-on: ubuntu-latest
+ runs-on: "ubuntu-latest"
steps:
- - name: Exit with error
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
- run: exit 1
+ - name: "Exit with error"
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
+ run: |
+ exit 1