@@ -3,47 +3,99 @@ name: Tests
33on :
44 pull_request :
55 push :
6- branches :
7- - master
6+ branches :
7+ - ' ** '
88
99jobs :
1010 build :
11- name : CI
11+ name : GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
1212 runs-on : ${{ matrix.os }}
1313 strategy :
1414 fail-fast : false
1515 matrix :
1616 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+ - ' 9.8'
19+ - ' 9.6'
20+ - ' 9.4'
21+ - ' 9.2'
22+ - ' 9.0'
23+ - ' 8.10'
24+ - ' 8.8'
25+ - ' 8.6'
26+ - ' 8.4'
27+ - ' 8.2'
2828
2929 steps :
30- - name : Clone project
31- uses : actions/checkout@v4
30+ - uses : actions/checkout@v4
3231
33- - name : Build and run tests
34- shell : bash
32+ - name : Set up GHC ${{ matrix.ghc-version }}
33+ uses : haskell-actions/setup@v2
34+ id : setup
35+ with :
36+ ghc-version : ${{ matrix.ghc-version }}
37+ # Defaults, added for clarity:
38+ cabal-version : ' latest'
39+ cabal-update : true
40+
41+ - name : Configure the build
3542 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 }}
43+ if [[ "${{ matrix.os }}" = "Windows" ]];
44+ then
45+ pacman -S --needed --noconfirm autoconf automake
46+ fi
47+ autoreconf -i
48+ cabal configure --enable-tests --enable-benchmarks --disable-documentation
49+ cabal build all --dry-run
50+ # The last step generates dist-newstyle/cache/plan.json for the cache key.
51+
52+ - name : Restore cached dependencies
53+ uses : actions/cache/restore@v3
54+ id : cache
55+ env :
56+ key : ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
57+ with :
58+ path : ${{ steps.setup.outputs.cabal-store }}
59+ key : ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
60+ restore-keys : ${{ env.key }}-
61+
62+ - name : Install dependencies
63+ # If we had an exact cache hit, the dependencies will be up to date.
64+ if : steps.cache.outputs.cache-hit != 'true'
65+ run : cabal build all --only-dependencies
66+
67+ # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
68+ - name : Save cached dependencies
69+ uses : actions/cache/save@v3
70+ # If we had an exact cache hit, trying to save the cache would error because of key clash.
71+ if : steps.cache.outputs.cache-hit != 'true'
72+ with :
73+ path : ${{ steps.setup.outputs.cabal-store }}
74+ key : ${{ steps.cache.outputs.cache-primary-key }}
75+
76+ - name : Build
77+ run : |
78+ cabal build process
79+
80+ - name : Source dist
81+ run : |
82+ cabal sdist all --ignore-project
83+
84+ # On Windows and with GHC >= 9.0, re-run the test-suite using WinIO.
85+ - name : Run tests
86+ run : |
87+ cabal run process-tests:test
88+ if (( "${{ matrix.os }}" = "Windows" && ${{ matrix.ghc-version }} >= "9.0" ));
89+ then
90+ cabal run process-tests:test -- +RTS --io-manager=native -RTS
91+ fi
92+
93+ - name : Build documentation
94+ run : cabal haddock process
95+
96+ - name : Check process.cabal
97+ run : cabal check
98+
99+ - name : Check process-tests.cabal
100+ working-directory : ./test
101+ run : cabal check
0 commit comments