Skip to content

Commit bcba9ec

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

File tree

1 file changed

+21
-47
lines changed

1 file changed

+21
-47
lines changed

.github/workflows/haskell.yml

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,71 +8,45 @@ 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: Install Nix
20+
uses: DeterminateSystems/nix-installer-action@main
3021

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 }}
22+
- name: Enable Nix cache
23+
uses: DeterminateSystems/magic-nix-cache-action@main
3624

37-
- name: Installed minor versions of GHC, Cabal, and Stack
25+
- name: Show toolchain versions from nix shell
3826
shell: bash
3927
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}"
28+
nix develop --command bash -lc 'ghc --numeric-version'
29+
nix develop --command bash -lc 'cabal --numeric-version'
30+
nix develop --command bash -lc 'stack --numeric-version || true'
31+
nix develop --command bash -lc 'fourmolu --version'
32+
33+
- name: Check formatting
34+
run: nix develop --command make format-check
4435

4536
- name: Check cabal file
46-
run: make cabal-check
37+
run: nix develop --command make cabal-check
4738

4839
- 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 }}-
40+
run: nix develop --command make configure
6041

6142
- 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 }}
43+
run: nix develop --command make deps
7044

7145
- name: Build the package
72-
run: make build
46+
run: nix develop --command make build
7347

7448
- name: Run tests
75-
run: make test
49+
run: nix develop --command make test
7650

7751
- name: Build documentation
78-
run: make docs
52+
run: nix develop --command make docs

0 commit comments

Comments
 (0)