diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79e2a02..1c30538 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,69 +4,39 @@ on: - master pull_request_target: -name: Rust +name: "Continuous Integration" + +concurrency: + group: ${{ github.repository }}-${{ github.workflow }} + cancel-in-progress: false jobs: - check: - name: Check + nix-matrix: runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} 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 + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 + - id: set-matrix + name: Generate Nix Matrix + run: | + set -euo pipefail + + matrix="$(nix eval --json '.#githubActions.matrix')" + echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" + + nix-build: + needs: nix-matrix + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 10 + matrix: ${{ fromJSON(needs.nix-matrix.outputs.matrix) }} 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 test - uses: actions-rs/cargo@v1 - with: - command: test - - lints: - name: Lints - 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: nightly - override: true - components: rustfmt, clippy - - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - - name: Run cargo clippy - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 + - run: nix build -L ".#${{ matrix.attr }}" --keep-going + - run: nix develop -c cargo test