From b77f0e610f5aa738853ee7c0e16ff6bec55ae4ca Mon Sep 17 00:00:00 2001 From: David Vollbracht Date: Tue, 9 Sep 2025 15:04:19 -0500 Subject: [PATCH] Sets up multi ghc build --- .github/workflows/build.yml | 34 ---------- .github/workflows/main.yml | 108 ++++++++++++++++++++++++++++++++ .gitignore | 1 + compose.override.github.yml | 5 -- optparse-repl.cabal | 12 +++- package.yaml | 19 +++++- scripts/build | 2 +- scripts/format-repo | 1 + scripts/lib/run-in-container.sh | 2 +- scripts/test-all | 35 +++++++++++ stack-base.yaml | 6 ++ stack-ghc-8.10.yaml | 5 ++ stack-ghc-8.10.yaml.lock | 26 ++++++++ stack-ghc-9.0.yaml | 2 + stack-ghc-9.0.yaml.lock | 12 ++++ stack-ghc-9.10.yaml | 2 + stack-ghc-9.10.yaml.lock | 12 ++++ stack-ghc-9.2.yaml | 2 + stack-ghc-9.2.yaml.lock | 12 ++++ stack-ghc-9.4.yaml | 2 + stack-ghc-9.4.yaml.lock | 12 ++++ stack-ghc-9.6.yaml | 2 + stack-ghc-9.6.yaml.lock | 12 ++++ stack-ghc-9.8.yaml | 2 + stack-ghc-9.8.yaml.lock | 12 ++++ stack.yaml | 52 +-------------- stack.yaml.lock | 10 +-- 27 files changed, 299 insertions(+), 103 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/main.yml delete mode 100644 compose.override.github.yml create mode 100755 scripts/test-all create mode 100644 stack-base.yaml create mode 100644 stack-ghc-8.10.yaml create mode 100644 stack-ghc-8.10.yaml.lock create mode 100644 stack-ghc-9.0.yaml create mode 100644 stack-ghc-9.0.yaml.lock create mode 100644 stack-ghc-9.10.yaml create mode 100644 stack-ghc-9.10.yaml.lock create mode 100644 stack-ghc-9.2.yaml create mode 100644 stack-ghc-9.2.yaml.lock create mode 100644 stack-ghc-9.4.yaml create mode 100644 stack-ghc-9.4.yaml.lock create mode 100644 stack-ghc-9.6.yaml create mode 100644 stack-ghc-9.6.yaml.lock create mode 100644 stack-ghc-9.8.yaml create mode 100644 stack-ghc-9.8.yaml.lock diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 9dbe167..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: optparse-repl CI - -on: - push: - -defaults: - run: - shell: bash - -jobs: - build: - runs-on: [self-hosted, linux, x64] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Cache - uses: actions/cache@v4 - env: - cache-version: v1 - with: - key: ${{ env.cache-version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} - restore-keys: | - ${{ env.cache-version }}- - path: | - ./stack-root - - - name: Build - run: | - set -e - mkdir -p ./stack-root - mv compose.override.github.yml compose.override.yml - echo "PROJECT_DIR=$PWD" >> .env - ./scripts/build diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..52e61fd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,108 @@ +name: Build and Test + +on: + push: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +defaults: + run: + shell: bash + +jobs: + find-stack-yamls: + name: Find stack.yamls for GHC Matrix + runs-on: ubuntu-22.04 + outputs: + stack-yamls: ${{ steps.set-output.outputs.stack-yamls }} + steps: + - name: Find Stack Yamls + id: set-output + uses: flipstone/github-actions/find-stack-ghc-yamls@bef3396e6c3777767d1d4837203cfdb2635b4933 + + build: + name: Build and Test + needs: find-stack-yamls + runs-on: ubuntu-22.04 + strategy: + max-parallel: 5 + matrix: + stack-yaml: ${{ fromJson(needs.find-stack-yamls.outputs.stack-yamls) }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache + uses: actions/cache@v4 + env: + cache-version: v3 + with: + key: ${{ env.cache-version }}-${{ matrix.stack-yaml }}-${{ hashFiles(matrix.stack-yaml, 'stack-base.yaml', 'package.yaml') }} + restore-keys: | + ${{ env.cache-version }}-${{ matrix.stack-yaml }}- + path: | + ./stack-root + + - name: Setup Stack + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 + with: + stack-root: ./stack-root + + - name: Build and test + run: ./scripts/test --stack-yaml ${{ matrix.stack-yaml }} + + formatting-check: + name: Formatting Check + runs-on: ubuntu-22.04 + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Stack (for docker env) + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 + with: + stack-root: ./stack-root + + - name: Format and Check for Diff + run: ./scripts/format-repo + + cabal-check: + name: Cabal Check + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Stack (for docker env) + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 + with: + stack-root: ./stack-root + + - name: Check for Hackage releasable issues + run: docker compose run --rm dev cabal check + + cabal-latest-build: + name: Cabal Build + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Stack (for docker env) + uses: flipstone/github-actions/setup-dockerized-stack@bef3396e6c3777767d1d4837203cfdb2635b4933 + with: + stack-root: ./stack-root + + - name: Build with cabal and latest ghc+deps + # When a new ghc version is released, we might not be able to build all the dependencies for + # a little while. So we need to allow failure here. It is a very unfortunate situation that + # github does not give us a better UX for this as the closest thing to a required check is + # not configured here, but seemingly only through the api/webui for "branch protection" + continue-on-error: true + run: scripts/cabal-latest diff --git a/.gitignore b/.gitignore index e2cfcc4..182e92e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .stack-work/ *~ .env +test-all-logs/ diff --git a/compose.override.github.yml b/compose.override.github.yml deleted file mode 100644 index 5fc4473..0000000 --- a/compose.override.github.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: - dev: - tty: false - volumes: - - ./stack-root:/stack-root diff --git a/optparse-repl.cabal b/optparse-repl.cabal index 04c5936..b366cd8 100644 --- a/optparse-repl.cabal +++ b/optparse-repl.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: optparse-repl -version: 0.1.0.2 +version: 0.1.0.3 description: Please see the README on GitHub at homepage: https://github.com/flipstone/optparse-repl#readme bug-reports: https://github.com/flipstone/optparse-repl/issues @@ -37,10 +37,16 @@ library build-depends: base >=4.7 && <5 , isocline ==1.0.* - , optparse-applicative >=0.17 && <0.19 + , optparse-applicative >=0.16 && <0.19 , safe-exceptions ==0.1.* default-language: Haskell2010 if flag(strict) - ghc-options: -Weverything -Werror -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-missing-kind-signatures -Wno-prepositive-qualified-module -Wno-implicit-prelude -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-missing-deriving-strategies -Wno-all-missed-specialisations -Wno-missed-specialisations + ghc-options: -Weverything -Werror -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-implicit-prelude -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-missing-deriving-strategies -Wno-all-missed-specialisations -Wno-missed-specialisations + if impl (ghc >= 9.2) + ghc-options: -Wno-missing-kind-signatures + if impl (ghc >= 9.8) + ghc-options: -Wno-missing-role-annotations -Wno-missing-poly-kind-signatures + if impl (ghc >= 9.10) + ghc-options: -Wno-defaulted-exception-context else ghc-options: -Wall diff --git a/package.yaml b/package.yaml index 0b3211b..42ad170 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: optparse-repl -version: 0.1.0.2 +version: 0.1.0.3 github: "flipstone/optparse-repl" license: MIT author: "Flipstone Technology Partners" @@ -18,10 +18,13 @@ extra-source-files: # common to point users to the README.md file. description: Please see the README on GitHub at +tested-with: + GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.8, GHC == 9.4.8, GHC == 9.6.7, GHC == 9.8.4, GHC == 9.10.2 + dependencies: - base >= 4.7 && < 5 - isocline >= 1.0 && < 1.1 -- optparse-applicative >= 0.17 && < 0.19 +- optparse-applicative >= 0.16 && < 0.19 - safe-exceptions >= 0.1 && < 0.2 flags: @@ -38,7 +41,6 @@ when: - -Werror - -Wno-missing-local-signatures - -Wno-monomorphism-restriction - - -Wno-missing-kind-signatures - -Wno-prepositive-qualified-module - -Wno-implicit-prelude - -Wno-safe @@ -47,6 +49,17 @@ when: - -Wno-missing-deriving-strategies - -Wno-all-missed-specialisations - -Wno-missed-specialisations + when: + - condition: impl (ghc >= 9.2) + ghc-options: + - -Wno-missing-kind-signatures + - condition: impl (ghc >= 9.8) + ghc-options: + - -Wno-missing-role-annotations + - -Wno-missing-poly-kind-signatures + - condition: impl (ghc >= 9.10) + ghc-options: + - -Wno-defaulted-exception-context else: ghc-options: - -Wall diff --git a/scripts/build b/scripts/build index 5d3e299..ac91dc7 100755 --- a/scripts/build +++ b/scripts/build @@ -5,4 +5,4 @@ set -e source scripts/lib/run-in-container.sh ./scripts/format-repo -./scripts/test +./scripts/test-all diff --git a/scripts/format-repo b/scripts/format-repo index f6cec49..decc88e 100755 --- a/scripts/format-repo +++ b/scripts/format-repo @@ -5,6 +5,7 @@ set -e source scripts/lib/run-in-container.sh if [ "$CI" ]; then + git config --global --add safe.directory $PWD MODE=check else MODE=inplace diff --git a/scripts/lib/run-in-container.sh b/scripts/lib/run-in-container.sh index 9a5fadd..5f3d0cb 100644 --- a/scripts/lib/run-in-container.sh +++ b/scripts/lib/run-in-container.sh @@ -3,5 +3,5 @@ if [ "$IN_DEV_CONTAINER" ]; then : else docker compose build - exec docker compose run dev $0 "$@" + exec docker compose run --rm dev $0 "$@" fi diff --git a/scripts/test-all b/scripts/test-all new file mode 100755 index 0000000..156c41f --- /dev/null +++ b/scripts/test-all @@ -0,0 +1,35 @@ +#!/bin/sh + +# +# This script will run compile and run the tests against all the +# stack*.yaml files that are found in the root of the repo, reporting +# whether each one passed or failed. +# +# It is generally useful for doing a final check before pushing, rather +# then as the regular edit/compile/test loop to get feedback during +# development. + +. scripts/lib/run-in-container.sh + +rm -rf test-all-logs +mkdir test-all-logs + +for stack_file in stack-ghc*.yaml; do + log_file="./test-all-logs/$stack_file.log" + + echo "Testing with $stack_file... " + if stack --stack-yaml "$stack_file" test >"$log_file" 2>&1; then + echo "Passed" + else + SOME_TEST_FAILED=1 + echo "Failed, see $log_file for details" + fi +done + +if [ "$SOME_TEST_FAILED" ]; then + echo "" + echo "!!" + echo "!! At least one test failed above. Be sure to check it out!" + echo "!!" + exit 1 +fi diff --git a/stack-base.yaml b/stack-base.yaml new file mode 100644 index 0000000..5b950ab --- /dev/null +++ b/stack-base.yaml @@ -0,0 +1,6 @@ +packages: + - . + +flags: + optparse-repl: + strict: true diff --git a/stack-ghc-8.10.yaml b/stack-ghc-8.10.yaml new file mode 100644 index 0000000..d44d294 --- /dev/null +++ b/stack-ghc-8.10.yaml @@ -0,0 +1,5 @@ +<<: !include stack-base.yaml +resolver: lts-18.28 +extra-deps: + - isocline-1.0.9@sha256:0127f3051694b0c55fad87debdfa590fe4184faebe1e0fe1e552c9bebfba2bc6,2419 + - optparse-applicative-0.18.1.0@sha256:f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82,5289 diff --git a/stack-ghc-8.10.yaml.lock b/stack-ghc-8.10.yaml.lock new file mode 100644 index 0000000..759df42 --- /dev/null +++ b/stack-ghc-8.10.yaml.lock @@ -0,0 +1,26 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: +- completed: + hackage: isocline-1.0.9@sha256:0127f3051694b0c55fad87debdfa590fe4184faebe1e0fe1e552c9bebfba2bc6,2419 + pantry-tree: + sha256: 6516783ba24687efeeebb2c32efc9138bb0d8c4d3faa42c69770805cb121959b + size: 2061 + original: + hackage: isocline-1.0.9@sha256:0127f3051694b0c55fad87debdfa590fe4184faebe1e0fe1e552c9bebfba2bc6,2419 +- completed: + hackage: optparse-applicative-0.18.1.0@sha256:f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82,5289 + pantry-tree: + sha256: abb295c7aaf194c4cd9ea7201b63e069168ad97cc965e89ec71e09a7c1262de4 + size: 3124 + original: + hackage: optparse-applicative-0.18.1.0@sha256:f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82,5289 +snapshots: +- completed: + sha256: 428ec8d5ce932190d3cbe266b9eb3c175cd81e984babf876b64019e2cbe4ea68 + size: 590100 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/28.yaml + original: lts-18.28 diff --git a/stack-ghc-9.0.yaml b/stack-ghc-9.0.yaml new file mode 100644 index 0000000..a0e4afc --- /dev/null +++ b/stack-ghc-9.0.yaml @@ -0,0 +1,2 @@ +<<: !include stack-base.yaml +resolver: lts-19.33 diff --git a/stack-ghc-9.0.yaml.lock b/stack-ghc-9.0.yaml.lock new file mode 100644 index 0000000..53255a7 --- /dev/null +++ b/stack-ghc-9.0.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4 + size: 619204 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml + original: lts-19.33 diff --git a/stack-ghc-9.10.yaml b/stack-ghc-9.10.yaml new file mode 100644 index 0000000..8390a05 --- /dev/null +++ b/stack-ghc-9.10.yaml @@ -0,0 +1,2 @@ +<<: !include stack-base.yaml +resolver: lts-24.8 diff --git a/stack-ghc-9.10.yaml.lock b/stack-ghc-9.10.yaml.lock new file mode 100644 index 0000000..eb8c6ac --- /dev/null +++ b/stack-ghc-9.10.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: d347039f81388e16ea93ddaf9ff1850abfba8f8680ff75fbdd177692542ceb26 + size: 726286 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/8.yaml + original: lts-24.8 diff --git a/stack-ghc-9.2.yaml b/stack-ghc-9.2.yaml new file mode 100644 index 0000000..27f9594 --- /dev/null +++ b/stack-ghc-9.2.yaml @@ -0,0 +1,2 @@ +<<: !include stack-base.yaml +resolver: lts-20.26 diff --git a/stack-ghc-9.2.yaml.lock b/stack-ghc-9.2.yaml.lock new file mode 100644 index 0000000..4cbf276 --- /dev/null +++ b/stack-ghc-9.2.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: 5a59b2a405b3aba3c00188453be172b85893cab8ebc352b1ef58b0eae5d248a2 + size: 650475 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/26.yaml + original: lts-20.26 diff --git a/stack-ghc-9.4.yaml b/stack-ghc-9.4.yaml new file mode 100644 index 0000000..85b8dea --- /dev/null +++ b/stack-ghc-9.4.yaml @@ -0,0 +1,2 @@ +<<: !include stack-base.yaml +resolver: lts-21.22 diff --git a/stack-ghc-9.4.yaml.lock b/stack-ghc-9.4.yaml.lock new file mode 100644 index 0000000..7df3396 --- /dev/null +++ b/stack-ghc-9.4.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: afd5ba64ab602cabc2d3942d3d7e7dd6311bc626dcb415b901eaf576cb62f0ea + size: 640060 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/22.yaml + original: lts-21.22 diff --git a/stack-ghc-9.6.yaml b/stack-ghc-9.6.yaml new file mode 100644 index 0000000..8336e0f --- /dev/null +++ b/stack-ghc-9.6.yaml @@ -0,0 +1,2 @@ +<<: !include stack-base.yaml +resolver: lts-22.44 diff --git a/stack-ghc-9.6.yaml.lock b/stack-ghc-9.6.yaml.lock new file mode 100644 index 0000000..8d134eb --- /dev/null +++ b/stack-ghc-9.6.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: 238fa745b64f91184f9aa518fe04bdde6552533d169b0da5256670df83a0f1a9 + size: 721141 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/44.yaml + original: lts-22.44 diff --git a/stack-ghc-9.8.yaml b/stack-ghc-9.8.yaml new file mode 100644 index 0000000..86a7cd6 --- /dev/null +++ b/stack-ghc-9.8.yaml @@ -0,0 +1,2 @@ +<<: !include stack-base.yaml +resolver: lts-23.0 diff --git a/stack-ghc-9.8.yaml.lock b/stack-ghc-9.8.yaml.lock new file mode 100644 index 0000000..d76fcfa --- /dev/null +++ b/stack-ghc-9.8.yaml.lock @@ -0,0 +1,12 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: 9444fadfa30b67a93080254d53872478c087592ad64443e47c546cdcd13149ae + size: 678857 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/0.yaml + original: lts-23.0 diff --git a/stack.yaml b/stack.yaml index 1a87845..377a483 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,51 +1 @@ -resolver: lts-22.39 -system-ghc: true -install-ghc: false - -# User packages to be built. -# Various formats can be used as shown in the example below. -# -# packages: -# - some-directory -# - https://example.com/foo/bar/baz-0.0.2.tar.gz -# subdirs: -# - auto-update -# - wai -packages: -- . -# Dependency packages to be pulled from upstream that are not in the resolver. -# These entries can reference officially published versions as well as -# forks / in-progress versions pinned to a git hash. For example: -# -# extra-deps: -# - acme-missiles-0.3 -# - git: https://github.com/commercialhaskell/stack.git -# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a -# -# extra-deps: [] - -# Override default flag values for local packages and extra-deps -flags: - optparse-repl: - strict: true - -# Extra package databases containing global packages -# extra-package-dbs: [] - -# Control whether we use the GHC we find on the path -# system-ghc: true -# -# Require a specific version of stack, using version ranges -# require-stack-version: -any # Default -# require-stack-version: ">=2.9" -# -# Override the architecture used by stack, especially useful on Windows -# arch: i386 -# arch: x86_64 -# -# Extra directories used by stack for building -# extra-include-dirs: [/path/to/dir] -# extra-lib-dirs: [/path/to/dir] -# -# Allow a newer minor version of GHC than the snapshot specifies -# compiler-check: newer-minor +<<: !include stack-ghc-9.6.yaml diff --git a/stack.yaml.lock b/stack.yaml.lock index 297acd5..8d134eb 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -1,12 +1,12 @@ # This file was autogenerated by Stack. # You should not edit this file by hand. # For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files +# https://docs.haskellstack.org/en/stable/topics/lock_files packages: [] snapshots: - completed: - sha256: 6c5aeace2ca5ecde793a9e0acfaa730ec8f384aa2f6183a2a252f5f9ec55d623 - size: 720039 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/39.yaml - original: lts-22.39 + sha256: 238fa745b64f91184f9aa518fe04bdde6552533d169b0da5256670df83a0f1a9 + size: 721141 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/44.yaml + original: lts-22.44