@@ -3,47 +3,114 @@ name: Tests
3
3
on :
4
4
pull_request :
5
5
push :
6
- branches :
7
- - master
6
+ branches :
7
+ - ' ** '
8
8
9
9
jobs :
10
10
build :
11
- name : CI
11
+ name : GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
12
12
runs-on : ${{ matrix.os }}
13
13
strategy :
14
14
fail-fast : false
15
15
matrix :
16
16
os : [ubuntu-latest, macos-latest, windows-latest]
17
- args :
18
- - " --resolver ghc-9.8.1"
19
- - " --resolver ghc-9.6.3"
20
- - " --resolver ghc-9.4.7"
21
- - " --resolver ghc-9.2.8"
22
- - " --resolver ghc-9.0.1"
23
- - " --resolver ghc-8.10.4"
24
- - " --resolver ghc-8.8.4"
25
- - " --resolver ghc-8.6.5"
26
- - " --resolver ghc-8.4.4"
27
- - " --resolver ghc-8.2.2"
17
+ ghc-version :
18
+ - ' latest'
19
+ - ' 9.8'
20
+ - ' 9.6'
21
+ - ' 9.4'
22
+ - ' 9.2'
23
+ - ' 9.0'
24
+ - ' 8.10'
25
+ - ' 8.8'
26
+ - ' 8.6'
27
+ - ' 8.4'
28
+ - ' 8.2'
29
+
30
+ exclude :
31
+ # Exclude GHC 8.2 on Windows (GHC bug: undefined reference to `__stdio_common_vswprintf_s')
32
+ - os : windows-latest
33
+ ghc-version : ' 8.2'
28
34
29
35
steps :
30
- - name : Clone project
31
- uses : actions/checkout@v4
36
+ - uses : actions/checkout@v4
37
+
38
+ - name : Set up GHC ${{ matrix.ghc-version }}
39
+ uses : haskell-actions/setup@v2
40
+ id : setup
41
+ with :
42
+ ghc-version : ${{ matrix.ghc-version }}
43
+ # Defaults, added for clarity:
44
+ cabal-version : ' latest'
45
+ cabal-update : true
46
+
47
+ - name : Set up autotools (Windows)
48
+ if : ${{ runner.os == 'Windows' }}
49
+ uses : msys2/setup-msys2@v2
50
+ with :
51
+ update : true
52
+ install : >-
53
+ autotools
54
+
55
+ - name : Run autoreconf (Windows)
56
+ if : ${{ runner.os == 'Windows' }}
57
+ run : autoreconf -i
58
+ shell : " msys2 {0}"
32
59
33
- - name : Build and run tests
34
- shell : bash
60
+ - name : Run autoreconf (Linux & Mac)
61
+ if : ${{ runner.os != 'Windows' }}
62
+ run : autoreconf -i
63
+
64
+ - name : Configure the build
35
65
run : |
36
- set -ex
37
- stack upgrade
38
- stack --version
39
- if [[ "${{ runner.os }}" = 'Windows' ]]
40
- then
41
- # Looks like a bug in Stack, this shouldn't break things
42
- ls C:/ProgramData/Chocolatey/bin/
43
- rm -rf C:/ProgramData/Chocolatey/bin/ghc*
44
- stack ${{ matrix.args }} exec pacman -- --sync --refresh --noconfirm autoconf
45
- fi
46
- stack build
47
- stack sdist --test-tarball
48
- cd test
49
- stack test --bench --no-run-benchmarks --haddock --no-terminal ${{ matrix.args }}
66
+ cabal configure --enable-tests --enable-benchmarks --disable-documentation
67
+ cabal build all --dry-run
68
+ # The last step generates dist-newstyle/cache/plan.json for the cache key.
69
+
70
+ - name : Restore cached dependencies
71
+ uses : actions/cache/restore@v3
72
+ id : cache
73
+ env :
74
+ key : ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
75
+ with :
76
+ path : ${{ steps.setup.outputs.cabal-store }}
77
+ key : ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
78
+ restore-keys : ${{ env.key }}-
79
+
80
+ - name : Install dependencies
81
+ # If we had an exact cache hit, the dependencies will be up to date.
82
+ if : steps.cache.outputs.cache-hit != 'true'
83
+ run : cabal build process --only-dependencies
84
+
85
+ # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
86
+ - name : Save cached dependencies
87
+ uses : actions/cache/save@v3
88
+ # If we had an exact cache hit, trying to save the cache would error because of key clash.
89
+ if : steps.cache.outputs.cache-hit != 'true'
90
+ with :
91
+ path : ${{ steps.setup.outputs.cabal-store }}
92
+ key : ${{ steps.cache.outputs.cache-primary-key }}
93
+
94
+ - name : Build
95
+ run : cabal build process
96
+
97
+ - name : Run tests
98
+ run : cabal run process-tests:test
99
+
100
+ # On Windows and with GHC >= 9.0, re-run the test-suite using WinIO.
101
+ - name : Re-run tests with WinIO (Windows && GHC >= 9.0)
102
+ if : ${{ runner.os == 'Windows' && matrix.ghc-version >= '9.0' }}
103
+ run : cabal run process-tests:test -- +RTS --io-manager=native -RTS
104
+
105
+ - name : Source dist
106
+ run : cabal sdist all --ignore-project
107
+
108
+ - name : Build documentation
109
+ run : cabal haddock process
110
+
111
+ - name : Check process.cabal
112
+ run : cabal check
113
+
114
+ - name : Check process-tests.cabal
115
+ working-directory : ./test
116
+ run : cabal check
0 commit comments