-
Notifications
You must be signed in to change notification settings - Fork 21
146 lines (132 loc) · 4.32 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
schedule:
- cron: '23 14 * * 2'
release:
name: build
jobs:
lint:
name: "Run hlint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up HLint
uses: haskell/actions/hlint-setup@v2
- name: Run HLint
uses: haskell/actions/hlint-run@v2
with:
fail-on: warning
fourmolu:
name: "Run fourmolu"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-fourmolu@v9
with:
version: "0.11.0.0"
generateMatrix:
name: "Generate matrix from cabal"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Extract the tested GHC versions
id: set-matrix
run: |
wget https://github.com/Kleidukos/get-tested/releases/download/v0.1.3.0/get-tested-0.1.3.0-linux-amd64 -O get-tested
chmod +x get-tested
./get-tested --ubuntu rhine/rhine.cabal >> $GITHUB_OUTPUT
build-cabal:
runs-on: ubuntu-latest
needs: generateMatrix
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
name: Haskell GHC ${{ matrix.ghc }} cabal
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
- name: Configure & plan
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore Cabal cache
uses: actions/cache/restore@v3
id: cache
env:
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: |
${{ steps.setup.outputs.cabal-store }}
dist-newstyle
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}
- name: Cabal build dependencies
run: cabal build all --enable-tests --only-dependencies
- name: Save Cabal dependency cache
uses: actions/cache/save@v3
if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Cabal build packages
run: cabal build all --enable-tests -fdev
- name: Cabal test
run: cabal test all --enable-tests --test-show-details=Always
build-stack:
runs-on: ubuntu-latest
needs: generateMatrix
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
name: Haskell GHC ${{ matrix.ghc }} stack
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
- name: Cache stack build artifacts
uses: freckle/stack-cache-action@v2
with:
stack-yaml: stack.${{ matrix.ghc }}.yaml
- name: Stack build and test
run: |
stack build --system-ghc --test --stack-yaml stack.${{ matrix.ghc }}.yaml
build-flake:
name: Nix Flake
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- name: Build default package (rhine)
run: nix build
- name: Build rhine-examples
run: nix build .#rhine-examples
- name: Build rhine-gloss
run: nix build .#rhine-gloss
- name: Build rhine-bayes
run: nix build .#rhine-bayes
- name: Build rhine-terminal
run: nix build .#rhine-terminal
- name: Run tests
run: nix develop -c cabal test all
# nix flake check breaks on IFD in multi-platform flake https://github.com/NixOS/nix/issues/4265
# - run: nix flake check