|
1 |
| -name: "/setup" |
| 1 | +name: "hlint-setup" |
2 | 2 | on:
|
| 3 | + pull_request: |
3 | 4 | push:
|
4 | 5 | branches:
|
5 |
| - - main |
6 |
| - paths-ignore: |
7 |
| - - "**.md" |
8 |
| - pull_request: |
9 |
| - paths-ignore: |
10 |
| - - "**.md" |
11 |
| - workflow_dispatch: |
12 |
| - |
13 |
| -defaults: |
14 |
| - run: |
15 |
| - shell: bash |
16 |
| - working-directory: setup |
| 6 | + - master |
| 7 | + - 'releases/*' |
17 | 8 |
|
18 | 9 | jobs:
|
19 |
| - test: |
20 |
| - name: Unit Tests - ${{ matrix.os }} |
21 |
| - runs-on: ${{ matrix.os }} |
22 |
| - strategy: |
23 |
| - matrix: |
24 |
| - os: [ubuntu-latest, macOS-latest, windows-latest] |
25 |
| - steps: |
26 |
| - - uses: actions/checkout@v4 |
27 |
| - - uses: actions/setup-node@v3 |
28 |
| - with: |
29 |
| - node-version: "16" |
30 |
| - cache: "npm" |
31 |
| - cache-dependency-path: setup/package-lock.json |
32 |
| - - run: npm ci --prefer-offline --no-audit --progress=false |
33 |
| - - run: npm run bundle |
34 |
| - - run: npm test |
35 |
| - |
36 |
| - install-haskell: |
37 |
| - name: GHC ${{ matrix.plan.ghc }}, Cabal ${{ matrix.plan.cabal }} - ${{ matrix.os }} |
38 |
| - runs-on: ${{ matrix.os }} |
39 |
| - strategy: |
40 |
| - |
41 |
| - # Let's see how the other installs are doing and not fail on the first |
42 |
| - fail-fast: false |
43 |
| - |
44 |
| - matrix: |
45 |
| - os: [ubuntu-latest, macOS-latest, windows-latest] |
46 |
| - plan: |
47 |
| - # Latest releases |
48 |
| - - ghc: latest |
49 |
| - cabal: latest |
50 |
| - # Recommended releases (update according to ghcup) |
51 |
| - # 9.4 will be recommended soon |
52 |
| - - ghc: "9.4" |
53 |
| - cabal: "3.8" |
54 |
| - - ghc: "9.2" |
55 |
| - cabal: "3.6" |
56 |
| - # Some previously recommended releases of ghc with matching cabal |
57 |
| - - ghc: "8.10" |
58 |
| - cabal: "3.2" |
59 |
| - - ghc: "8.8" |
60 |
| - cabal: "3.0" |
61 |
| - # cabal-3.0 install might have the Windows symlinking problem |
62 |
| - # https://github.com/haskell/cabal/issues/5748 |
63 |
| - - ghc: "8.6" |
64 |
| - cabal: "2.4" |
65 |
| - cabal_update: ["false"] |
66 |
| - # The following tests do not set 'cabal-update', which defaults to 'true' then. |
67 |
| - |
68 |
| - include: |
69 |
| - |
70 |
| - # Test #210 (XDG): is the cabal store-dir set to something meaningful? |
71 |
| - - os: ubuntu-latest |
72 |
| - plan: |
73 |
| - ghc: "9.6" |
74 |
| - cabal: "3.10" |
75 |
| - cabal_update: "true" |
76 |
| - # With choco, cabal 3.10.1.0 should map to 3.10.1.1 |
77 |
| - - os: windows-latest |
78 |
| - plan: |
79 |
| - ghc: "9.6" |
80 |
| - cabal: "3.10" |
81 |
| - cabal_update: "true" |
82 |
| - |
83 |
| - # Test some old versions |
84 |
| - - os: ubuntu-latest |
85 |
| - plan: |
86 |
| - ghc: "8.2.2" |
87 |
| - cabal: "2.4.1.0" |
88 |
| - cabal_update: "false" |
89 |
| - - os: ubuntu-20.04 |
90 |
| - plan: |
91 |
| - ghc: "7.4.2" |
92 |
| - cabal: "3.4" |
93 |
| - # ubuntu-20.04/hvr has of GHC 7 just 7.0.1, 7.0.4, 7.2.2, 7.4.2, 7.10.3 |
94 |
| - # and of cabal just 2.4, 3.0, 3.2, 3.4 |
95 |
| - # according to https://launchpad.net/~hvr/+archive/ubuntu/ghc?field.series_filter=focal |
96 |
| - |
97 |
| - # Test ghcup pre-release channel |
98 |
| - - os: ubuntu-latest |
99 |
| - ghcup_release_channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml" |
100 |
| - plan: |
101 |
| - ghc: "9.6.0.20230111" |
102 |
| - cabal: "3.8" |
103 |
| - |
104 |
| - # Test ghc nightly |
105 |
| - - os: ubuntu-latest |
106 |
| - ghcup_release_channel: "https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml" |
107 |
| - plan: |
108 |
| - ghc: "latest-nightly" |
109 |
| - cabal: "latest" |
110 |
| - |
111 |
| - # setup does something special for 7.10.3 (issue #79) |
112 |
| - - os: ubuntu-20.04 |
113 |
| - plan: |
114 |
| - ghc: "7.10.3" |
115 |
| - cabal: "3.6" |
116 |
| - - os: macOS-latest |
117 |
| - plan: |
118 |
| - ghc: "7.10.3" |
119 |
| - cabal: "3.4" |
120 |
| - |
121 |
| - # Andreas 2022-12-29, issue #98: GHC 7.10 failed to install on windows (choco) |
122 |
| - - os: windows-latest |
123 |
| - plan: |
124 |
| - ghc: "7.10" |
125 |
| - cabal: "3.0" |
126 |
| - |
127 |
| - # Test for issue #129: GHC 9.4.3 failed to install on windows (choco) |
128 |
| - - os: windows-latest |
129 |
| - plan: |
130 |
| - ghc: "9.4.3" |
131 |
| - cabal: "3.8.1.0" |
132 |
| - |
133 |
| - # Test ghcup on windows (PR #206) which choco does not have 9.4.5 |
134 |
| - - os: windows-latest |
135 |
| - plan: |
136 |
| - ghc: "9.4.5" |
137 |
| - cabal: "3.8" |
138 |
| - |
139 |
| - # Test GHC 9.4.4 on windows (Issue #245) |
140 |
| - - os: windows-latest |
141 |
| - plan: |
142 |
| - ghc: "9.4.4" |
143 |
| - cabal: "3.10.1.0" |
144 |
| - |
| 10 | + unit-tests: |
| 11 | + runs-on: ubuntu-latest |
145 | 12 | steps:
|
146 |
| - - uses: actions/checkout@v4 |
147 |
| - |
148 |
| - - uses: ./setup |
149 |
| - id: setup |
150 |
| - with: |
151 |
| - ghc-version: ${{ matrix.plan.ghc }} |
152 |
| - ghcup-release-channel: ${{ matrix.ghcup_release_channel }} |
153 |
| - cabal-version: ${{ matrix.plan.cabal }} |
154 |
| - cabal-update: ${{ matrix.cabal_update }} |
155 |
| - |
156 |
| - - name: Show installed versions and PATH |
157 |
| - run: | |
158 |
| - cabal --version |
159 |
| - ghc --version |
160 |
| - echo "$PATH" |
161 |
| -
|
162 |
| - - name: Confirm resolved and installed versions match |
163 |
| - shell: bash |
164 |
| - run: | |
165 |
| - CABALVER="$(cabal --numeric-version)" |
166 |
| - GHCVER="$(ghc --numeric-version)" |
167 |
| - echo "CABALVER=${CABALVER}" >> "${GITHUB_ENV}" |
168 |
| - echo "GHCVER=${GHCVER}" >> "${GITHUB_ENV}" |
169 |
| - if [[ "${{ steps.setup.outputs.ghc-version }}" == "latest-nightly" ]] |
170 |
| - then |
171 |
| - GHCVER_EXPECTED=$( \ |
172 |
| - curl "${{ matrix.ghcup_release_channel }}" | \ |
173 |
| - yq '.ghcupDownloads.GHC[] | select(.viTags[] | contains("LatestNightly")) | key' \ |
174 |
| - ) |
175 |
| - echo "Latest nightly: ${GHCVER_EXPECTED}" |
176 |
| - else |
177 |
| - GHCVER_EXPECTED="${{ steps.setup.outputs.ghc-version }}" |
178 |
| - fi |
179 |
| - [[ "${CABALVER}" == "${{ steps.setup.outputs.cabal-version }}" ]] && \ |
180 |
| - [[ "${GHCVER}" == "${GHCVER_EXPECTED}" ]] |
181 |
| -
|
182 |
| - - name: Test runghc |
183 |
| - run: | |
184 |
| - runghc --version |
185 |
| - runghc __tests__/hello.hs |
186 |
| -
|
187 |
| - - name: Build test project |
188 |
| - working-directory: setup/__tests__/project |
189 |
| - run: cabal build |
190 |
| - |
191 |
| - - name: Run test project |
192 |
| - working-directory: setup/__tests__/project |
193 |
| - run: cabal run |
194 |
| - |
195 |
| - - name: Install test project |
196 |
| - working-directory: setup/__tests__/project |
197 |
| - run: cabal install |
198 |
| - |
199 |
| - - name: Run installed test project |
200 |
| - run: hello-haskell-setup |
201 |
| - # This tests whether the default installdir has been added to the PATH (issue #130). |
202 |
| - |
203 |
| - - name: Build and run test with Hackage dependency |
204 |
| - if: ${{ matrix.cabal_update != 'false' }} |
205 |
| - working-directory: setup/__tests__/project-with-hackage-dependency |
206 |
| - run: cabal build && cabal run |
207 |
| - |
208 |
| - - name: Confirm installed and expected versions match |
209 |
| - shell: bash |
210 |
| - # check that if given in the matrix, the actual version matches: |
211 |
| - # - cabal: major version |
212 |
| - # - ghc: major and minor version |
213 |
| - # pure bash startsWith |
214 |
| - run: | |
215 |
| - if [[ "${{ matrix.plan.cabal }}" =~ ^([0-9]+\.[0-9]+) ]]; then cabalmajor="${BASH_REMATCH[1]}"; fi |
216 |
| - if [[ "${{ matrix.plan.ghc }}" =~ ^([0-9]+\.[0-9]+) ]]; then ghcmajor="${BASH_REMATCH[1]}"; fi |
217 |
| - if [[ "${{ matrix.plan.ghc }}" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]]; then ghcver="${BASH_REMATCH[1]}"; fi |
218 |
| - [[ "${CABALVER}" =~ ^"${cabalmajor}" ]] && [[ "${GHCVER}" =~ ^"${ghcmajor}" ]] && [[ "${GHCVER}" =~ ^"${ghcver}" ]] |
219 |
| -
|
220 |
| - test-fallback: |
221 |
| - name: Test GHC Installation Fallbacks - ${{ matrix.os }} |
222 |
| - runs-on: ${{ matrix.os }} |
223 |
| - strategy: |
224 |
| - matrix: |
225 |
| - os: [ubuntu-latest, macOS-latest, windows-latest] |
226 |
| - steps: |
227 |
| - - uses: actions/checkout@v4 |
228 |
| - - uses: ./setup |
229 |
| - id: setup |
230 |
| - env: |
231 |
| - RUNNER_DEBUG: "1" |
232 |
| - with: |
233 |
| - ghc-version: 8.21.5 |
234 |
| - - name: Error on success |
235 |
| - if: steps.setup.outputs.failed != 'true' |
236 |
| - # NB: 'failed' is an undeclared output of the setup action, used in debug mode |
237 |
| - run: | |
238 |
| - echo "Error: ghc 8.21.5 didn't fail to install" |
239 |
| -
|
240 |
| - install-stack: |
241 |
| - name: Stack ${{ matrix.stack }} ${{ matrix.os }} |
242 |
| - runs-on: ${{ matrix.os }} |
243 |
| - strategy: |
244 |
| - fail-fast: false |
245 |
| - matrix: |
246 |
| - os: [ubuntu-latest, macOS-latest, windows-latest] |
247 |
| - stack: ["latest", "2.3.3"] |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: "16" |
| 17 | + cache: "yarn" |
| 18 | + cache-dependency-path: .-setup/yarn.lock |
| 19 | + - run: yarn |
| 20 | + - run: yarn test |
248 | 21 |
|
| 22 | + test: |
| 23 | + runs-on: ubuntu-latest |
249 | 24 | steps:
|
250 |
| - - uses: actions/checkout@v4 |
251 |
| - |
252 |
| - - uses: ./setup |
253 |
| - id: setup |
254 |
| - with: |
255 |
| - enable-stack: true |
256 |
| - stack-no-global: true |
257 |
| - stack-version: ${{ matrix.stack }} |
258 |
| - |
259 |
| - - run: | |
260 |
| - stack --version |
261 |
| - stack --help |
262 |
| -
|
263 |
| - - name: Checking if returned stack-root output is correct |
264 |
| - shell: bash |
265 |
| - # NB: we invoke `stack path` twice, because the first time it |
266 |
| - # might install things (like MSYS2 on Windows) which clobber the output. |
267 |
| - run: | |
268 |
| - stack path --system-ghc |
269 |
| - expected_stack_root=$(stack path --system-ghc --stack-root) |
270 |
| -
|
271 |
| - if [ "${expected_stack_root}" != "${{ steps.setup.outputs.stack-root }}" ]; then |
272 |
| - echo "Stack-root does not match expected value" |
273 |
| - echo "Expected stack-root: ${expected_stack_root}" |
274 |
| - echo "Returned stack-root: ${{ steps.setup.outputs.stack-root }}" |
275 |
| - exit 1 |
276 |
| - fi |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + - uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: "16" |
| 29 | + cache: "yarn" |
| 30 | + cache-dependency-path: .-setup/yarn.lock |
| 31 | + - run: yarn |
| 32 | + - run: yarn compile |
| 33 | + - run: yarn package |
| 34 | + - uses: ./ |
| 35 | + - run: hlint --version |
0 commit comments