Skip to content

Commit 93dd0a0

Browse files
committed
chore: use nix in ci
1 parent 62d8a53 commit 93dd0a0

File tree

1 file changed

+24
-47
lines changed

1 file changed

+24
-47
lines changed

.github/workflows/haskell.yml

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,71 +8,48 @@ permissions:
88
contents: read
99

1010
jobs:
11-
fourmolu:
11+
nix-ci:
1212
runs-on: ubuntu-latest
13+
env:
14+
NIX_CONFIG: accept-flake-config = true
1315

1416
steps:
1517
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16-
- uses: haskell-actions/run-fourmolu@3b7702b41516aa428dfe6e295dc73476ae58f69e # v11
17-
with:
18-
version: "0.17.0.0"
19-
build:
20-
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
21-
runs-on: ${{ matrix.os }}
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
os: [windows-latest, macos-latest, ubuntu-latest]
26-
ghc-version: ["9.12", "9.10", "9.8", "9.6", "9.4", "9.2"]
2718

28-
steps:
29-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- name: Check Nix flake inputs
20+
uses: DeterminateSystems/flake-checker-action@3164002371bc90729c68af0e24d5aacf20d7c9f6 # v12
21+
22+
- name: Install Nix
23+
uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
3024

31-
- name: Set up GHC ${{ matrix.ghc-version }}
32-
uses: haskell-actions/setup@96f3dafd067155f32643c2a0757ab71d2910e2c2 # v2.8.0
33-
id: setup
34-
with:
35-
ghc-version: ${{ matrix.ghc-version }}
25+
- name: Enable Nix cache
26+
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
3627

37-
- name: Installed minor versions of GHC, Cabal, and Stack
28+
- name: Show toolchain versions from nix shell
3829
shell: bash
3930
run: |
40-
GHC_VERSION=$(ghc --numeric-version)
41-
CABAL_VERSION=$(cabal --numeric-version)
42-
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}"
43-
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}"
31+
nix develop --command bash -lc 'ghc --numeric-version'
32+
nix develop --command bash -lc 'cabal --numeric-version'
33+
nix develop --command bash -lc 'stack --numeric-version || true'
34+
nix develop --command bash -lc 'fourmolu --version'
35+
36+
- name: Check formatting
37+
run: nix develop --command make format-check
4438

4539
- name: Check cabal file
46-
run: make cabal-check
40+
run: nix develop --command make cabal-check
4741

4842
- name: Configure the build
49-
run: make configure
50-
51-
- name: Restore cached dependencies
52-
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
53-
id: cache
54-
env:
55-
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
56-
with:
57-
path: ${{ steps.setup.outputs.cabal-store }}
58-
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
59-
restore-keys: ${{ env.key }}-
43+
run: nix develop --command make configure
6044

6145
- name: Build dependencies
62-
run: make deps
63-
64-
- name: Save cached dependencies
65-
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
66-
if: steps.cache.outputs.cache-hit != 'true'
67-
with:
68-
path: ${{ steps.setup.outputs.cabal-store }}
69-
key: ${{ steps.cache.outputs.cache-primary-key }}
46+
run: nix develop --command make deps
7047

7148
- name: Build the package
72-
run: make build
49+
run: nix develop --command make build
7350

7451
- name: Run tests
75-
run: make test
52+
run: nix develop --command make test
7653

7754
- name: Build documentation
78-
run: make docs
55+
run: nix develop --command make docs

0 commit comments

Comments
 (0)