This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
168 lines (153 loc) · 5.18 KB
/
workflow.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
name: "/setup"
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
defaults:
run:
working-directory: setup
jobs:
test:
name: Unit Tests - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
cache-dependency-path: setup/package-lock.json
- run: npm ci --prefer-offline --no-audit --progress=false
- run: npm run bundle
- run: npm test
install-haskell:
name: GHC ${{ matrix.ghc }}, Cabal ${{ matrix.cabal }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
# Let's see how the other installs are doing and not fail on the first
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
ghc: ["latest", "9.2"]
cabal: ["latest", "3.2.0.0"]
cabal_update: ["false"]
# The following tests do not set 'cabal-update', which defaults to 'true' then.
include:
- os: ubuntu-latest
ghc: "8.2.2"
cabal: "2.4.1.0"
cabal_update: "false"
- os: ubuntu-18.04
ghc: "7.4.1"
cabal: "3.4"
# Test ghcup pre-release channel
- os: ubuntu-latest
ghc: "9.6.0.20230111"
ghcup_release_channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml"
cabal: "3.8"
# setup does something special for 7.10.3 (issue #79)
- os: ubuntu-20.04
ghc: "7.10.3"
cabal: "3.6"
- os: macOS-latest
ghc: "7.10.3"
cabal: "3.4"
# Andreas 2022-12-29, issue #98: GHC 7.10 failed to install on windows (choco)
- os: windows-latest
ghc: "7.10"
cabal: "3.0"
# Test for issue #129: GHC 9.4.3 failed to install on windows (choco)
- os: windows-latest
ghc: "9.4.3"
cabal: "3.8.1.0"
- os: windows-latest
ghc: "9.2.5"
cabal: "3.6"
steps:
- uses: actions/checkout@v3
- uses: ./setup
with:
ghc-version: ${{ matrix.ghc }}
ghcup-release-channel: ${{ matrix.ghcup_release_channel }}
cabal-version: ${{ matrix.cabal }}
cabal-update: ${{ matrix.cabal_update }}
- name: Show installed versions
run: |
cabal --version
ghc --version
- name: Test runghc
run: |
runghc --version
runghc __tests__/hello.hs
- name: Build test project
working-directory: setup/__tests__/project
run: cabal build
- name: Run test project
working-directory: setup/__tests__/project
run: cabal run
- name: Install test project
working-directory: setup/__tests__/project
run: cabal install
- name: Run installed test project
run: hello-haskell-setup
# This tests whether the default installdir has been added to the PATH (issue #130).
- name: Build and run test with Hackage dependency
if: ${{ matrix.cabal_update != 'false' }}
working-directory: setup/__tests__/project-with-hackage-dependency
run: cabal build && cabal run
- name: Confirm installed and expected versions match
shell: bash
# check that if given in the matrix, the actual version matches:
# - cabal: major version
# - ghc: major and minor version
# pure bash startsWith
run: |
CABALVER="$(cabal --numeric-version)"
GHCVER="$(ghc --numeric-version)"
if [[ "${{ matrix.cabal }}" =~ ^([0-9]+\.[0-9]+) ]]; then cabalmajor="${BASH_REMATCH[1]}"; fi
if [[ "${{ matrix.ghc }}" =~ ^([0-9]+\.[0-9]+) ]]; then ghcmajor="${BASH_REMATCH[1]}"; fi
if [[ "${{ matrix.ghc }}" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]]; then ghcver="${BASH_REMATCH[1]}"; fi
[[ "${CABALVER}" =~ ^"${cabalmajor}" ]] && [[ "${GHCVER}" =~ ^"${ghcmajor}" ]] && [[ "${GHCVER}" =~ ^"${ghcver}" ]]
test-fallback:
name: Test GHC Installation Fallbacks - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: ./setup
id: setup
env:
RUNNER_DEBUG: "1"
with:
ghc-version: 8.21.5
- name: Error on success
if: steps.setup.outputs.failed == 'true'
run: |
echo "Error: ghc 8.21.5 didn't fail to install"
install-stack:
name: Stack ${{ matrix.stack }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
stack: ["latest", "1.9.1"]
steps:
- uses: actions/checkout@v3
- uses: ./setup
with:
enable-stack: true
stack-no-global: true
stack-version: ${{ matrix.stack }}
- run: |
stack --version
stack --help