From 8005bd76a848a0832ef5ca8d13053bd45d801e3b Mon Sep 17 00:00:00 2001 From: Michael Webb Date: Tue, 10 Dec 2024 22:44:21 +1100 Subject: [PATCH] Use get-tested instead of haskell-ci --- .github/workflows/haskell-ci.yml | 124 ++++++++++++++----------------- 1 file changed, 55 insertions(+), 69 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 890ae2a..317102d 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -1,64 +1,28 @@ -# This GitHub workflow config has been generated by a script via -# -# haskell-ci 'github' 'cached-io.cabal' -# -# 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.19.20240708 -# -# REGENDATA ("0.19.20240708",["github","cached-io.cabal"]) -# -name: Haskell-CI +name: Haskell CI on: - push - - pull_request jobs: - linux: - name: Haskell-CI - Linux - ${{ matrix.compiler }} + generate-matrix: + name: "Generate matrix from cabal" + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} runs-on: ubuntu-20.04 - timeout-minutes: - 60 + steps: + - name: Extract the tested GHC versions + id: set-matrix + uses: kleidukos/get-tested@a0aa3f2d4ab0d10daa49dc9ee8c706d673fb0e02 + with: + cabal-file: cached-io.cabal + ubuntu-version: "20.04" + version: 0.1.7.1 + tests: + name: ${{ matrix.ghc }} on ${{ matrix.os }} + needs: generate-matrix + runs-on: ${{ matrix.os }} container: image: buildpack-deps:jammy - continue-on-error: ${{ matrix.allow-failure }} strategy: - matrix: - include: - - compiler: ghc-9.8.2 - compilerKind: ghc - compilerVersion: 9.8.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.6.6 - compilerKind: ghc - compilerVersion: 9.6.6 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.4.5 - compilerKind: ghc - compilerVersion: 9.4.5 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.2.4 - compilerKind: ghc - compilerVersion: 9.2.4 - 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 - fail-fast: false + matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} steps: - name: apt run: | @@ -70,9 +34,9 @@ jobs: "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} + HCKIND: ghc + HCNAME: ghc-${{ matrix.ghc }} + HCVER: ${{ matrix.ghc }} - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH @@ -95,9 +59,9 @@ jobs: echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} + HCKIND: ghc + HCNAME: ghc-${{ matrix.ghc }} + HCVER: ${{ matrix.ghc }} - name: env run: | env @@ -133,6 +97,11 @@ jobs: - name: update cabal index run: | $CABAL v2-update -v + - name: cache (tools) + uses: actions/cache/restore@v4 + with: + key: ${{ runner.os }}-${{ matrix.ghc }}-tools-ac1dc7e1 + path: ~/.haskell-ci-tools - name: install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -142,6 +111,16 @@ jobs: rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan cabal-plan --version + - name: install doctest + run: | + $CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.22.0' + doctest --version + - name: save cache (tools) + uses: actions/cache/save@v4 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.ghc }}-tools-ac1dc7e1 + path: ~/.haskell-ci-tools - name: checkout uses: actions/checkout@v4 with: @@ -161,17 +140,17 @@ jobs: find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; - name: generate cabal.project run: | - PKGDIR_cached_io="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/cached-io-[0-9.]*')" - echo "PKGDIR_cached_io=${PKGDIR_cached_io}" >> "$GITHUB_ENV" + PKGDIR_aws_arn="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/aws-arn-[0-9.]*')" + echo "PKGDIR_aws_arn=${PKGDIR_aws_arn}" >> "$GITHUB_ENV" rm -f cabal.project cabal.project.local touch cabal.project touch cabal.project.local - echo "packages: ${PKGDIR_cached_io}" >> cabal.project - echo "package cached-io" >> cabal.project + echo "packages: ${PKGDIR_aws_arn}" >> cabal.project + echo "package aws-arn" >> cabal.project echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(aws-arn)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -181,9 +160,9 @@ jobs: - name: restore cache uses: actions/cache/restore@v4 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} path: ~/.cabal/store - restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- + restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- - name: install dependencies run: | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all @@ -194,9 +173,16 @@ jobs: - 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: doctest + run: | + cd ${PKGDIR_aws_arn} || false + doctest -XHaskell2010 src - name: cabal check run: | - cd ${PKGDIR_cached_io} || false + cd ${PKGDIR_aws_arn} || false ${CABAL} -vnormal check - name: haddock run: | @@ -209,5 +195,5 @@ jobs: uses: actions/cache/save@v4 if: always() with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} path: ~/.cabal/store