-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (101 loc) · 3.4 KB
/
build-and-test.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
name: Build and Test
on: push
jobs:
build-with-cabal:
name: ${{ matrix.os }} / ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
# - ubuntu-20.04
- ubuntu-22.04
# - macos-11
# - macos-12
- macos-13
# - windows-2019
- windows-2022
ghc:
- 8.2.2
- 8.4.4
- 8.6.5
- 8.8.2
- 8.10.7
- 9.0.2
- 9.2.8
- 9.4.8
- 9.6.4
- 9.8.1
cabal:
- '3.10'
exclude:
# ghc-8.2.2 fails to install
- os: ubuntu-22.04
ghc: 8.2.2
# build fails with linker error
- os: windows-2022
ghc: 8.2.2
- os: windows-2019
ghc: 8.2.2
env:
builddocs: ${{ matrix.ghc == '9.4.5' }}
runtests: ${{ matrix.ghc == '8.4.4' || matrix.ghc == '9.4.5' }}
tests-to-run: # e.g. -t=EXAMPLE
testcmd: cabal run -- darcs-test -j=6 -f=123 -i=yn -c=yn --hide
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
# avoid occasional timeouts in test scripts that access darcs.net:
DARCS_CONNECTION_TIMEOUT: 15
steps:
- name: Configure git
if: runner.os == 'Windows'
run: git config --global core.autocrlf input
- name: Checkout
uses: actions/checkout@v3
- name: Setup Haskell
id: setup-haskell-cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure
run: cabal configure --enable-tests -fwarn-as-error
- name: Cabal freeze
run: cabal freeze
- name: Restore cabal store from cache
uses: actions/cache/restore@v3
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: cabal-store-${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: cabal-store-${{ matrix.os }}-ghc-${{ matrix.ghc }}-
- name: Build dependencies (with docs)
if: env.builddocs == 'true'
run: cabal build --only-dependencies --enable-documentation
- name: Build dependencies (without docs)
if: env.builddocs == 'false'
run: cabal build --only-dependencies --disable-documentation
- name: Save cabal store to cache
uses: actions/cache/save@v3
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: cabal-store-${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
- name: Build
run: cabal build
- name: Haddock
if: env.builddocs == 'true'
run: cabal haddock lib:darcs
- name: Run tests on Linux
if: runner.os == 'Linux' && env.runtests == 'true'
run: |
sudo apt-get install lighttpd
${{ env.testcmd }} ${{ env.tests-to-run }}
- name: Run tests on MacOS
if: runner.os == 'macos' && env.runtests == 'true'
run: |
brew install lighttpd
brew install gnu-sed
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
${{ env.testcmd }} ${{ env.tests-to-run }}
- name: Run tests on Windows
if: runner.os == 'Windows' && env.runtests == 'true'
# running the tests for all three patch formats takes over an hour
run: cabal run -- darcs-test -j=6 -f=2 -s=sn -i=yn ${{ env.tests-to-run }} --hide