-
-
Notifications
You must be signed in to change notification settings - Fork 49
175 lines (144 loc) · 5.66 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: CI
# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
push:
branches: [master]
jobs:
cabal:
name: cabal / ghc-${{ matrix.ghc }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
# Termonad sometimes requires VTE features that are only in recent releases of VTE.
# Older versions of Ubuntu may not have a new enough VTE, so we test on multiple
# versions of Ubuntu (and therefore multiple versions of VTE).
- ubuntu-22.04
- ubuntu-20.04
# - macOS-latest
cabal: ["latest"]
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.7"
steps:
- uses: actions/checkout@v3
#if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- uses: actions/cache@v3
name: Cache cabal-store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ matrix.os }}-${{ matrix.ghc }}-cabal
- name: Update apt
run: sudo apt-get update
- name: Install Required System Packages
run: sudo apt-get install gobject-introspection libgirepository1.0-dev libgtk-3-dev libvte-2.91-dev libpcre2-dev
- name: Build
run: |
cabal update
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=always
- name: Test
run: |
cabal test all --enable-tests
stack:
name: stack ${{ matrix.resolver }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
stack: ["latest"]
resolver:
- "--stack-yaml ./stack.yaml" # Stackage LTS
- "--stack-yaml ./stack-nightly.yaml" # Stackage Nightly
os:
# Termonad sometimes requires VTE features that are only in recent releases of VTE.
# Older versions of Ubuntu may not have a new enough VTE, so we test on multiple
# versions of Ubuntu (and therefore multiple versions of VTE).
- ubuntu-22.04
- ubuntu-20.04
# - macOS-latest
steps:
- uses: actions/checkout@v3
#if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
- uses: haskell/actions/setup@v2
name: Setup Haskell Stack
with:
stack-version: ${{ matrix.stack }}
enable-stack: true
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ matrix.os }}-stack-${{ matrix.resolver }}
- name: Update apt
run: sudo apt-get update
- name: Install Required System Packages
run: sudo apt-get install gobject-introspection libgirepository1.0-dev libgtk-3-dev libvte-2.91-dev libpcre2-dev
- name: Build
run: |
stack ${{ matrix.resolver }} build --test --bench --no-run-tests --no-run-benchmarks --flag termonad:buildexamples
- name: Test
run: |
stack ${{ matrix.resolver }} test --flag termonad:buildexamples
nix:
name: nix / ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix-build
- run: nix-build shell.nix
nix-flakes:
name: nix flakes / ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix build
- run: nix build .#devShell.x86_64-linux
nix-simple-cabal-shell:
name: nix simple cabal shell.nix / ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@v2
# TODO: These caches actually needs to be keyed on the hash of the
# ./nix-helpers/simple-cabal-shell.nix derivation. If that derivation
# changes, then we really, really should not reuse the same
# ~/.cabal/store directory (since there is the possibility of getting
# into a cabal hell, where Haskell libraries in the Cabal store are linked to
# different, incompatible system libraries).
#
# It is possible to get the hash of this derivation with a command like:
#
# $ nix eval --impure --raw --expr 'with (import <nixpkgs> {}).lib; let simpleCabalShell = import ./.nix-helpers/simple-cabal-shell.nix {}; in builtins.elemAt (splitString "-" (removePrefix (builtins.storeDir + "/") simpleCabalShell)) 0'
#
# Just need to load this into a variable, and throw it in the following key name
- uses: actions/cache@v3
name: Cache cabal store
with:
path: |
~/.cabal/store
~/.config/cabal/store
~/.local/state/cabal/store
key: nix-simple-cabal-shell
- name: cabal update
run: nix-shell ./.nix-helpers/simple-cabal-shell.nix --command 'cabal update'
- name: cabal build
run: nix-shell ./.nix-helpers/simple-cabal-shell.nix --command 'cabal build all --enable-tests --enable-benchmarks'