diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index baf4ac1..a64b7b0 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' 'unliftio-servant-server.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","unliftio-servant-server.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: unliftio-servant-server.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: @@ -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,6 +173,13 @@ 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_unliftio_servant_server} || false + doctest -XHaskell2010 src - name: cabal check run: | cd ${PKGDIR_unliftio_servant_server} || false @@ -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 diff --git a/flake.lock b/flake.lock index e9368b2..ab2c51c 100644 --- a/flake.lock +++ b/flake.lock @@ -3,16 +3,15 @@ "bellroy-nix-foss": { "inputs": { "flake-utils": "flake-utils", - "haskell-ci": "haskell-ci", "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1724294608, - "narHash": "sha256-08ckkY81cvEbRM6Fvog0leRVvF2yzqFLnEWCDmE1LQM=", + "lastModified": 1733824700, + "narHash": "sha256-1CK1PJE1z7dYEJSGaFHCtxDVcONh1AUZasqEhpf823E=", "owner": "bellroy", "repo": "bellroy-nix-foss", - "rev": "0966286b1f39ae7601bd6be79dd0405e7267a493", + "rev": "9758ab8a249a695cc1a5fe686b6a66d5f50319d8", "type": "github" }, "original": { @@ -42,11 +41,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -77,29 +76,13 @@ "type": "github" } }, - "haskell-ci": { - "flake": false, - "locked": { - "lastModified": 1720460048, - "narHash": "sha256-k3YCC4RIVxocXYbNHkmGYvlsoFlv5XZmk1DYfVQMaPs=", - "owner": "haskell-ci", - "repo": "haskell-ci", - "rev": "5e5b27d74f90e73905c4f56f4aefe521f97879f0", - "type": "github" - }, - "original": { - "owner": "haskell-ci", - "repo": "haskell-ci", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1724177844, - "narHash": "sha256-G7Mf9uN9m8FimeP3eMHu/dOC4QS8QAzo0h4ZIlDHcCA=", + "lastModified": 1733686850, + "narHash": "sha256-NQEO/nZWWGTGlkBWtCs/1iF1yl2lmQ1oY/8YZrumn3I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d13fa5a45a34e7c8be33474f58003914430bdc5a", + "rev": "dd51f52372a20a93c219e8216fe528a648ffcbf4", "type": "github" }, "original": { @@ -110,11 +93,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", "type": "github" }, "original": { @@ -135,11 +118,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1724159077, - "narHash": "sha256-AddE0u6WbA5R7uxumw1Ka0oG5dv3cTtN0ppO/M/e0cg=", + "lastModified": 1733665616, + "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "1064a45e81a4e19cda98741b71219d9f4f136900", + "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", "type": "github" }, "original": { diff --git a/unliftio-servant-server.cabal b/unliftio-servant-server.cabal index 6aac5ec..101828e 100644 --- a/unliftio-servant-server.cabal +++ b/unliftio-servant-server.cabal @@ -37,7 +37,7 @@ library -fprint-expanded-synonyms -fwarn-unused-do-bind build-depends: - , base >=4.14 && <4.20 + , base >=4.14 && <4.21 , mtl >=2.2.2 && <2.4 , servant >=0.19 && <0.21 , servant-server >=0.19 && <0.21