Skip to content

Commit 8dc3221

Browse files
ulysses4evermergify[bot]
authored andcommitted
CI: add validation against GHC pre-release (currently: 9.6alpha3)
Had to block lib/cli-suite tests on Windows, see discussion starting here: - #8754 (comment) (cherry picked from commit 9e9a865)
1 parent eb2b8b8 commit 8dc3221

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

.github/workflows/validate.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,134 @@ jobs:
187187
if: matrix.cli != 'false'
188188
run: sh validate.sh $FLAGS -s cli-suite
189189

190+
# The job below is a copy-paste of validate with the necessary tweaks
191+
# to make all work with an upcoming GHC. Those tweaks include:
192+
# - ghcup needs the prerelease channel activated
193+
# - allow-newer for base libraries and Cabal* libraries
194+
# - (sometimes) disabling some parts on Windows because it's hard to figure
195+
# out why they fail
196+
validate-prerelease:
197+
name: Validate ${{ matrix.os }} ghc-prerelease
198+
runs-on: ${{ matrix.os }}
199+
outputs:
200+
GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }}
201+
strategy:
202+
matrix:
203+
os: ["ubuntu-20.04", "macos-latest", "windows-latest"]
204+
205+
steps:
206+
207+
- uses: actions/checkout@v3
208+
209+
# See https://github.com/haskell/cabal/pull/8739
210+
- name: Sudo chmod to permit ghcup to update its cache
211+
run: |
212+
if [[ "${{ runner.os }}" == "Linux" ]]; then
213+
sudo ls -lah /usr/local/.ghcup/cache
214+
sudo mkdir -p /usr/local/.ghcup/cache
215+
sudo ls -lah /usr/local/.ghcup/cache
216+
sudo chown -R $USER /usr/local/.ghcup
217+
sudo chmod -R 777 /usr/local/.ghcup
218+
fi
219+
220+
- name: ghcup
221+
run: |
222+
ghcup --version
223+
ghcup config set cache true
224+
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
225+
ghcup install ghc --set 9.6.0.20230210
226+
ghcup install cabal --set latest
227+
ghc --version
228+
cabal update
229+
230+
# See the following link for a breakdown of the following step
231+
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
232+
#
233+
# See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded
234+
- if: ${{ runner.os != 'Windows' }}
235+
uses: actions/cache@v3
236+
with:
237+
# validate.sh uses a special build dir
238+
path: |
239+
${{ steps.setup-haskell.outputs.cabal-store }}
240+
dist-*
241+
key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }}
242+
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419-
243+
244+
- name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)
245+
run: |
246+
git config --global protocol.file.allow always
247+
248+
# The '+exe' constraint below is important, otherwise cabal-install
249+
# might decide to build the library but not the executable which is
250+
# what we need.
251+
- name: Install cabal-plan
252+
run: |
253+
cd $(mktemp -d)
254+
cabal install cabal-plan --constraint='cabal-plan +exe' --allow-newer
255+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
256+
257+
# The tool is not essential to the rest of the test suite. If
258+
# hackage-repo-tool is not present, any test that requires it will
259+
# be skipped.
260+
# We want to keep this in the loop but we don't want to fail if
261+
# hackage-repo-tool breaks or fails to support a newer GHC version.
262+
- name: Install hackage-repo-tool
263+
continue-on-error: true
264+
run: |
265+
cd $(mktemp -d)
266+
cabal install hackage-repo-tool
267+
268+
# Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs
269+
- name: Install Autotools
270+
if: runner.os == 'macOS'
271+
run: |
272+
brew install automake
273+
274+
- name: Allow newer boot libraries
275+
run: |
276+
echo "allow-newer: base, template-haskell, ghc-prim, Cabal-syntax, Cabal-described, Cabal, cabal-install-solver, cabal-install" >> cabal.project.validate
277+
278+
- name: Set validate inputs
279+
run: |
280+
FLAGS="${{ env.COMMON_FLAGS }}"
281+
if [[ "${{ matrix.cli }}" == "false" ]]; then
282+
FLAGS="$FLAGS --lib-only"
283+
fi
284+
echo "FLAGS=$FLAGS" >> $GITHUB_ENV
285+
286+
- name: Validate print-config
287+
run: sh validate.sh $FLAGS -s print-config
288+
289+
- name: Validate print-tool-versions
290+
run: sh validate.sh $FLAGS -s print-tool-versions
291+
292+
- name: Validate build
293+
run: sh validate.sh $FLAGS -s build
294+
295+
- name: Validate lib-tests
296+
env:
297+
# `rawSystemStdInOut reports text decoding errors`
298+
# test does not find ghc without the full path in windows
299+
GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }}
300+
run: sh validate.sh $FLAGS -s lib-tests
301+
302+
- name: Validate lib-suite
303+
# see https://github.com/haskell/cabal/pull/8754#issuecomment-1435025848
304+
# for discussion about the trouble on Windows
305+
if: ${{ runner.os != 'Windows' }}
306+
run: sh validate.sh $FLAGS -s lib-suite
307+
308+
- name: Validate cli-tests
309+
if: matrix.cli != 'false'
310+
run: sh validate.sh $FLAGS -s cli-tests
311+
312+
- name: Validate cli-suite
313+
# see https://github.com/haskell/cabal/pull/8754#issuecomment-1435025848
314+
# for discussion about the trouble on Windows
315+
if: ( runner.os != 'Windows' ) && ( matrix.cli != 'false' )
316+
run: sh validate.sh $FLAGS -s cli-suite
317+
190318
validate-old-ghcs:
191319
name: Validate old ghcs ${{ matrix.extra-ghc }}
192320
runs-on: ubuntu-20.04

0 commit comments

Comments
 (0)