From f5059119b855342342953b168d0b986af4aab6e6 Mon Sep 17 00:00:00 2001 From: Adithya Kumar Date: Mon, 10 Jun 2024 22:53:38 +0530 Subject: [PATCH] Add ghc-head to the github CI --- .github/workflows/packcheck.yml | 14 +++++++++++++- cabal.project.ghc-head | 18 ++++++++++++++++++ packcheck.cabal | 3 ++- packcheck.sh | 13 ++++++++++++- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 cabal.project.ghc-head diff --git a/.github/workflows/packcheck.yml b/.github/workflows/packcheck.yml index c6f5e29..87b756a 100644 --- a/.github/workflows/packcheck.yml +++ b/.github/workflows/packcheck.yml @@ -51,6 +51,7 @@ jobs: # For updating see: https://downloads.haskell.org/~ghcup/ GHCUP_VERSION: 0.1.20.0 GHCVER: ${{ matrix.ghc_version }} + GHCUP_GHC_OPTIONS: ${{ matrix.ghcup_ghc_options }} # RESOLVER: ${{ matrix.stack_resolver }} # ------------------------------------------------------------------------ @@ -68,7 +69,7 @@ jobs: # ------------------------------------------------------------------------ CABAL_CHECK_RELAX: y CABAL_HACKAGE_MIRROR: "hackage.haskell.org:http://hackage.fpcomplete.com" - CABAL_PROJECT: "cabal.project" + CABAL_PROJECT: ${{ matrix.cabal_project }} # ------------------------------------------------------------------------ # Where to find the required tools @@ -110,19 +111,30 @@ jobs: # Adding any element to the list will increase the number of matrix # elements proportional to the cross product. include: + + - name: ci + command: cabal + runner: ubuntu-latest + ghc_version: head + cabal_project: cabal.project.ghc-head + ghcup_ghc_options: -u https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-linux-deb10-int_native-validate.tar.xz?job=x86_64-linux-deb10-int_native-validate + - name: ci command: cabal runner: ubuntu-latest ghc_version: 9.8.1 + cabal_project: cabal.project - name: ci command: stack runner: ubuntu-latest + cabal_project: cabal.project - name: ci ghc_version: 9.8.1 command: cabal runner: macos-latest + cabal_project: cabal.project - name: ci command: hlint diff --git a/cabal.project.ghc-head b/cabal.project.ghc-head new file mode 100644 index 0000000..30e4840 --- /dev/null +++ b/cabal.project.ghc-head @@ -0,0 +1,18 @@ +-- See head.hackage: +-- info at https://ghc.gitlab.haskell.org/head.hackage/ +-- source at https://gitlab.haskell.org/ghc/head.hackage/ + +packages: packcheck.cabal + +repository head.hackage.ghc.haskell.org + url: https://ghc.gitlab.haskell.org/head.hackage/ + secure: True + key-threshold: 3 + root-keys: + f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 + 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 + 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d + +active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override + +allow-newer: all diff --git a/packcheck.cabal b/packcheck.cabal index 2d4b282..e3aca40 100644 --- a/packcheck.cabal +++ b/packcheck.cabal @@ -4,7 +4,7 @@ synopsis: Universal build and CI testing for Haskell packages description: This package contains a universal CI/build script @packcheck.sh@ and config files designed such that you can just copy over - @.github\/workflows/packcheck.yml@, @appveyor.yml@ or @.circleci/config.yml@ + @.github\/workflows/packcheck.yml@, @appveyor.yml@ or @.circleci/config.yml@ to your package repo and your package is CI ready in a jiffy. You can build and test packages on local machine as well. For local testing, copy @packcheck.sh@ to your local machine, put it in your @@ -54,6 +54,7 @@ extra-source-files: appveyor.yml cabal.project.coveralls cabal.project + cabal.project.ghc-head packcheck.sh packcheck-safe.sh packcheck-remote.sh diff --git a/packcheck.sh b/packcheck.sh index 40cbfec..2905fe2 100755 --- a/packcheck.sh +++ b/packcheck.sh @@ -105,6 +105,16 @@ function run_verbose() { bash -c "$*" } +function run_verbose_errexit_with() { + local errScript="$1"; + shift + if ! run_verbose "$*"; + then + eval "$errScript" + die "Command [$*] failed. Exiting." + fi +} + function run_verbose_errexit() { run_verbose "$*" || die "Command [$*] failed. Exiting." } @@ -942,7 +952,8 @@ ghcup_install() { if test "$tool" = "ghc" then - run_verbose_errexit ghcup install ghc $GHCUP_GHC_OPTIONS $tool_ver + run_verbose_errexit_with "cat /usr/local/.ghcup/logs/*" \ + ghcup install ghc $GHCUP_GHC_OPTIONS $tool_ver else run_verbose_errexit ghcup install $tool $tool_ver fi