Skip to content

Commit b33f505

Browse files
authored
Update CI workflow using the example provided by haskell-actions/setup (#55)
1 parent cc5bac9 commit b33f505

File tree

3 files changed

+72
-29
lines changed

3 files changed

+72
-29
lines changed

.github/workflows/main.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,57 @@
1+
# The following workflow is based on the example provided by
2+
# haskell-actions/setup:
3+
#
4+
# https://github.com/haskell-actions/setup#model-cabal-workflow-with-caching
5+
16
name: CI
27

38
on: push
49

10+
concurrency:
11+
group: build-${{ github.ref }}
12+
cancel-in-progress: true
13+
514
jobs:
615
build:
716
runs-on: ubuntu-latest
817
strategy:
918
matrix:
10-
ghc: ['8.8', '8.10']
11-
19+
ghc-version: ['8.10', '8.8']
1220
steps:
13-
- uses: actions/checkout@v4
14-
- name: Setup Haskell
15-
uses: haskell/actions/setup@v2
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
- name: Setup Haskell tools
24+
uses: haskell-actions/setup@v2
25+
id: setup
1626
with:
17-
ghc-version: ${{ matrix.ghc }}
27+
ghc-version: ${{ matrix.ghc-version }}
1828
cabal-version: 'latest'
19-
- uses: actions/cache@v3.3.2
29+
cabal-update: true
30+
- name: Configure the build
31+
run: |
32+
cabal configure --enable-tests --disable-documentation
33+
cabal build all --dry-run
34+
- name: Restore cached dependencies
35+
uses: actions/cache/restore@v3
36+
id: cache
37+
env:
38+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
39+
with:
40+
path: ${{ steps.setup.outputs.cabal-store }}
41+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
42+
restore-keys: ${{ env.key }}-
43+
- name: Install dependencies
44+
if: steps.cache.outputs.cache-hit != 'true'
45+
run: cabal build all --only-dependencies
46+
- name: Save cached dependencies
47+
uses: actions/cache/save@v3
48+
if: steps.cache.outputs.cache-hit != 'true'
2049
with:
21-
path: ~/.cabal
22-
key: cabal--${{ matrix.ghc }}-${{ hashFiles('*/*.cabal') }}
23-
restore-keys: |
24-
cabal--${{ matrix.ghc }}-${{ hashFiles('*/*.cabal') }}
25-
cabal--${{ matrix.ghc }}-
26-
cabal-
27-
- run: cabal update
28-
- run: cabal configure --enable-tests
29-
- run: cabal build all --only-dependencies
30-
- run: cabal build all
31-
- run: cabal test all
50+
path: ${{ steps.setup.outputs.cabal-store }}
51+
key: ${{ steps.cache.outputs.cache-primary-key }}
52+
- name: Build
53+
run: cabal build all
54+
- name: Run tests
55+
run: cabal test all
3256
env:
3357
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }}

flake.lock

Lines changed: 29 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
inputs = {
33
flake-utils.url = "github:numtide/flake-utils";
4-
nixpkgs.url = "nixpkgs/nixos-22.11-small";
4+
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
55
};
66

77
outputs = { self, flake-utils, nixpkgs }:

0 commit comments

Comments
 (0)