From 555d81d1101a74c4b304aa23415ed32f30af1ebf Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 12 Jul 2022 13:05:59 +0200 Subject: [PATCH 1/2] Haskell-CI on Github actions for GHCs 7.0 - 9.4 --- .github/workflows/haskell-ci.yml | 322 +++++++++++++++++++ cabal.haskell-ci | 2 + core/test-framework.cabal | 18 +- example/test-framework-example.cabal | 18 +- hunit/test-framework-hunit.cabal | 18 +- quickcheck2/test-framework-quickcheck2.cabal | 19 +- 6 files changed, 393 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/haskell-ci.yml diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml new file mode 100644 index 0000000..1d33cce --- /dev/null +++ b/.github/workflows/haskell-ci.yml @@ -0,0 +1,322 @@ +# This GitHub workflow config has been generated by a script via +# +# haskell-ci 'github' 'cabal.project' +# +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# +# For more information, see https://github.com/haskell-CI/haskell-ci +# +# version: 0.15.20220710 +# +# REGENDATA ("0.15.20220710",["github","cabal.project"]) +# +name: Haskell-CI +on: + push: + branches: + - master + - ci* + pull_request: + branches: + - master + - ci* +jobs: + linux: + name: Haskell-CI - Linux - ${{ matrix.compiler }} + runs-on: ubuntu-20.04 + timeout-minutes: + 60 + container: + image: buildpack-deps:bionic + continue-on-error: ${{ matrix.allow-failure }} + strategy: + matrix: + include: + - compiler: ghc-9.4.0.20220623 + compilerKind: ghc + compilerVersion: 9.4.0.20220623 + setup-method: ghcup + allow-failure: true + - compiler: ghc-9.2.3 + compilerKind: ghc + compilerVersion: 9.2.3 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.0.2 + compilerKind: ghc + compilerVersion: 9.0.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-8.10.7 + compilerKind: ghc + compilerVersion: 8.10.7 + setup-method: ghcup + allow-failure: false + - compiler: ghc-8.8.4 + compilerKind: ghc + compilerVersion: 8.8.4 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.6.5 + compilerKind: ghc + compilerVersion: 8.6.5 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.4.4 + compilerKind: ghc + compilerVersion: 8.4.4 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.2.2 + compilerKind: ghc + compilerVersion: 8.2.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.0.2 + compilerKind: ghc + compilerVersion: 8.0.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.10.3 + compilerKind: ghc + compilerVersion: 7.10.3 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.8.4 + compilerKind: ghc + compilerVersion: 7.8.4 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.6.3 + compilerKind: ghc + compilerVersion: 7.6.3 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.4.2 + compilerKind: ghc + compilerVersion: 7.4.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.2.2 + compilerKind: ghc + compilerVersion: 7.2.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.0.4 + compilerKind: ghc + compilerVersion: 7.0.4 + setup-method: hvr-ppa + allow-failure: false + fail-fast: false + steps: + - name: apt + run: | + apt-get update + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 + if [ "${{ matrix.setup-method }}" = ghcup ]; then + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + apt-get update + apt-get install -y libxml2-dev + else + apt-add-repository -y 'ppa:hvr/ghc' + apt-get update + apt-get install -y "$HCNAME" libxml2-dev + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + fi + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: Set PATH and environment variables + run: | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" + HCDIR=/opt/$HCKIND/$HCVER + if [ "${{ matrix.setup-method }}" = ghcup ]; then + HC=$HOME/.ghcup/bin/$HCKIND-$HCVER + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" + echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + else + HC=$HCDIR/bin/$HCKIND + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" + echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + fi + + HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" + echo "GHCJSARITH=0" >> "$GITHUB_ENV" + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: env + run: | + env + - name: write cabal config + run: | + mkdir -p $CABAL_DIR + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz + echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan + rm -f cabal-plan.xz + chmod a+x $HOME/.cabal/bin/cabal-plan + cabal-plan --version + - name: checkout + uses: actions/checkout@v2 + with: + path: source + - name: initial cabal.project for sdist + run: | + touch cabal.project + echo "packages: $GITHUB_WORKSPACE/source/./core" >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/./hunit" >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/./quickcheck2" >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/./example" >> cabal.project + cat cabal.project + - name: sdist + run: | + mkdir -p sdist + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist + - name: unpack + run: | + mkdir -p unpacked + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; + - name: generate cabal.project + run: | + PKGDIR_test_framework="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-[0-9.]*')" + echo "PKGDIR_test_framework=${PKGDIR_test_framework}" >> "$GITHUB_ENV" + PKGDIR_test_framework_hunit="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-hunit-[0-9.]*')" + echo "PKGDIR_test_framework_hunit=${PKGDIR_test_framework_hunit}" >> "$GITHUB_ENV" + PKGDIR_test_framework_quickcheck2="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-quickcheck2-[0-9.]*')" + echo "PKGDIR_test_framework_quickcheck2=${PKGDIR_test_framework_quickcheck2}" >> "$GITHUB_ENV" + PKGDIR_test_framework_example="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-example-[0-9.]*')" + echo "PKGDIR_test_framework_example=${PKGDIR_test_framework_example}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local + touch cabal.project + touch cabal.project.local + echo "packages: ${PKGDIR_test_framework}" >> cabal.project + echo "packages: ${PKGDIR_test_framework_hunit}" >> cabal.project + echo "packages: ${PKGDIR_test_framework_quickcheck2}" >> cabal.project + echo "packages: ${PKGDIR_test_framework_example}" >> cabal.project + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework-hunit" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework-quickcheck2" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework-example" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + cat >> cabal.project <> cabal.project + fi + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(test-framework|test-framework-example|test-framework-hunit|test-framework-quickcheck2)$/; }' >> cabal.project.local + cat cabal.project + cat cabal.project.local + - name: dump install plan + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + cabal-plan + - name: cache + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- + - name: install dependencies + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all + - name: build w/o tests + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: build + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always + - name: tests + run: | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + - name: cabal check + run: | + cd ${PKGDIR_test_framework} || false + ${CABAL} -vnormal check + cd ${PKGDIR_test_framework_hunit} || false + ${CABAL} -vnormal check + cd ${PKGDIR_test_framework_quickcheck2} || false + ${CABAL} -vnormal check + cd ${PKGDIR_test_framework_example} || false + ${CABAL} -vnormal check + - name: haddock + run: | + $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + - name: unconstrained build + run: | + rm -f cabal.project.local + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 43e4c23..25b219a 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,3 +1,5 @@ +branches: master ci* + apt: libxml2-dev raw-project diff --git a/core/test-framework.cabal b/core/test-framework.cabal index a633014..5392601 100644 --- a/core/test-framework.cabal +++ b/core/test-framework.cabal @@ -13,7 +13,23 @@ Maintainer: Libraries List Homepage: http://haskell.github.io/test-framework/ Bug-Reports: https://github.com/haskell/test-framework/issues Build-Type: Simple -Tested-With: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4 + +Tested-With: + GHC == 9.4.1 + GHC == 9.2.3 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + GHC == 7.10.3 + GHC == 7.8.4 + GHC == 7.6.3 + GHC == 7.4.2 + GHC == 7.2.2 + GHC == 7.0.4 Extra-Source-Files: ChangeLog.md diff --git a/example/test-framework-example.cabal b/example/test-framework-example.cabal index d6907ce..910de65 100644 --- a/example/test-framework-example.cabal +++ b/example/test-framework-example.cabal @@ -10,7 +10,23 @@ Author: Max Bolingbroke Maintainer: Max Bolingbroke Homepage: http://batterseapower.github.com/test-framework/ Build-Type: Simple -Tested-With: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4 + +Tested-With: + GHC == 9.4.1 + GHC == 9.2.3 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + GHC == 7.10.3 + GHC == 7.8.4 + GHC == 7.6.3 + GHC == 7.4.2 + GHC == 7.2.2 + GHC == 7.0.4 Executable test-framework-example default-language: Haskell2010 diff --git a/hunit/test-framework-hunit.cabal b/hunit/test-framework-hunit.cabal index 1a045da..43bee65 100644 --- a/hunit/test-framework-hunit.cabal +++ b/hunit/test-framework-hunit.cabal @@ -11,7 +11,23 @@ Homepage: http://haskell.github.io/test-framework/ Bug-Reports: https://github.com/haskell/test-framework/issues Build-Type: Simple Description: @HUnit@ support for the @test-framework@ package. -Tested-With: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4 + +Tested-With: + GHC == 9.4.1 + GHC == 9.2.3 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + GHC == 7.10.3 + GHC == 7.8.4 + GHC == 7.6.3 + GHC == 7.4.2 + GHC == 7.2.2 + GHC == 7.0.4 Library Default-Language: Haskell2010 diff --git a/quickcheck2/test-framework-quickcheck2.cabal b/quickcheck2/test-framework-quickcheck2.cabal index d06dc37..a292c1a 100644 --- a/quickcheck2/test-framework-quickcheck2.cabal +++ b/quickcheck2/test-framework-quickcheck2.cabal @@ -12,7 +12,24 @@ Homepage: http://haskell.github.io/test-framework/ Bug-Reports: https://github.com/haskell/test-framework/issues Build-Type: Simple Description: Allows @QuickCheck-2@ properties to be used with the . -Tested-With: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4 + +Tested-With: + GHC == 9.4.1 + GHC == 9.2.3 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + GHC == 7.10.3 + GHC == 7.8.4 + GHC == 7.6.3 + GHC == 7.4.2 + GHC == 7.2.2 + GHC == 7.0.4 + extra-source-files: ChangeLog.md Library From ea040fae8f60d91cadce90d90ddf7a422175c5d6 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 12 Jul 2022 13:47:43 +0200 Subject: [PATCH 2/2] Relax time to <1.13 --- core/test-framework.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/test-framework.cabal b/core/test-framework.cabal index 5392601..9478cc0 100644 --- a/core/test-framework.cabal +++ b/core/test-framework.cabal @@ -68,7 +68,7 @@ Library , containers >= 0.1 && < 0.7 , regex-posix >= 0.72 && < 0.97 , old-locale >= 1.0 && < 1.1 - , time >= 1.1.2 && < 1.10 + , time >= 1.1.2 && < 1.13 , xml >= 1.3.5 && < 1.4 , hostname >= 1.0 && < 1.1