diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 34ec64d..b8588da 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.16.6 +# version: 0.18.1 # -# REGENDATA ("0.16.6",["github","cached-io.cabal"]) +# REGENDATA ("0.18.1",["github","cached-io.cabal"]) # name: Haskell-CI on: @@ -28,14 +28,14 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.8.1 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.8.1 + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.2 + - compiler: ghc-9.6.4 compilerKind: ghc - compilerVersion: 9.6.2 + compilerVersion: 9.6.4 setup-method: ghcup allow-failure: false - compiler: ghc-9.4.5 @@ -58,32 +58,17 @@ jobs: 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 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.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - else - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y "$HCNAME" - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -95,20 +80,13 @@ jobs: 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.10.1.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.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - fi - + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" 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" diff --git a/cached-io.cabal b/cached-io.cabal index 27c6ef0..e0d0b28 100644 --- a/cached-io.cabal +++ b/cached-io.cabal @@ -12,7 +12,7 @@ author: SumAll, Inc. maintainer: Bellroy Tech Team category: Development build-type: Simple -tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.5 || ==9.6.2 || ==9.8.1 +tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.5 || ==9.6.4 || ==9.8.2 extra-doc-files: CHANGELOG.md README.md @@ -22,7 +22,7 @@ source-repository head location: https://github.com/bellroy/haskell-cached-io.git common deps - build-depends: base >=4.13.0.0 && <4.20 + build-depends: base >=4.13.0.0 && <4.21 library import: deps diff --git a/cached-io.nix b/cached-io.nix index 6278143..beea4b7 100644 --- a/cached-io.nix +++ b/cached-io.nix @@ -1,22 +1,13 @@ -{ mkDerivation -, lib -, base -, exceptions -, stm -, time -, transformers -}: +{ mkDerivation, base, exceptions, lib, stm, time, transformers }: mkDerivation { pname = "cached-io"; - version = "1.1.0.0"; + version = "1.3.0.0"; src = ./.; - libraryHaskellDepends = [ - base - exceptions - stm - time - transformers - ]; - description = "A simple library to cache a single IO action with timeout"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ base exceptions stm time transformers ]; + executableHaskellDepends = [ base ]; + description = "A simple library to cache IO actions"; license = lib.licenses.asl20; + mainProgram = "test-cachedIO"; } diff --git a/flake.lock b/flake.lock index 2d38fdc..5d002bd 100644 --- a/flake.lock +++ b/flake.lock @@ -1,15 +1,51 @@ { "nodes": { + "bellroy-nix-foss": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1719276333, + "narHash": "sha256-7pEJ5a+hbpeCmKqRt+N5ddhsBD8IwDRenMN8WPnB8MQ=", + "owner": "bellroy", + "repo": "bellroy-nix-foss", + "rev": "b6c032e0c9aeb1886538d9db10809bc441dd2bac", + "type": "github" + }, + "original": { + "owner": "bellroy", + "repo": "bellroy-nix-foss", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1709126324, - "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -20,23 +56,22 @@ }, "nixpkgs": { "locked": { - "lastModified": 1709608591, - "narHash": "sha256-d3KGhAaERREKkqc4NOsEg/MayQ1BjUOCueuHF86U3eA=", - "owner": "nixos", + "lastModified": 1719082008, + "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "08a2dc8fd3196a6efbb9a0d0b160ab4e452e19bc", + "rev": "9693852a2070b398ee123a329e68f0dab5526681", "type": "github" }, "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" } }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "bellroy-nix-foss": "bellroy-nix-foss" } }, "systems": { diff --git a/flake.nix b/flake.nix index 77252d4..e607675 100644 --- a/flake.nix +++ b/flake.nix @@ -2,53 +2,26 @@ description = "A simple library to cache a single IO action with timeout"; inputs = { - flake-utils.url = "github:numtide/flake-utils"; - nixpkgs.url = "github:nixos/nixpkgs"; + bellroy-nix-foss.url = "github:bellroy/bellroy-nix-foss"; }; - outputs = { self, flake-utils, nixpkgs }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { inherit system; }; - in - rec - { - # This becomes the list of package and devShell names. - supportedCompilers = [ - "ghc88" - "ghc810" - "ghc90" - "ghc92" - "ghc94" - "ghc96" - "ghc98" - ]; - - packages = builtins.listToAttrs ( - builtins.map - (compiler: { - name = compiler; - value = pkgs.haskell.packages.${compiler}.callPackage ./cached-io.nix { }; - }) - supportedCompilers - ); - - devShells' = (builtins.mapAttrs - (compiler: v: v.env.overrideAttrs (oldAttrs: { - buildInputs = oldAttrs.buildInputs - ++ [ pkgs.nixpkgs-fmt ] - ++ (with pkgs.haskell.packages.${compiler}; [ - cabal-fmt - cabal-install - doctest - haskell-ci - haskell-language-server - hlint - ]); - })) - packages - ); - - devShells = devShells' // { default = devShells'.ghc92; }; - }); + outputs = inputs: + inputs.bellroy-nix-foss.lib.haskellProject { + cabalPackages = [ + { + name = "cached-io"; + path = ./cached-io.nix; + } + ]; + supportedCompilers = [ + "ghc810" + "ghc90" + "ghc92" + "ghc94" + "ghc96" + "ghc98" + "ghc910" + ]; + defaultCompiler = "ghc96"; + }; }