From 43f304c02c093c85af41f03bc00c4bde51082a53 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Tue, 17 Oct 2023 12:53:28 -0700 Subject: [PATCH 1/4] Update build for GHC 9.6.2 --- .github/workflows/haskell.yml | 4 +-- .github/workflows/nix.yml | 1 + flake.lock | 6 ++-- flake.nix | 65 +++++++++++++++-------------------- moat.cabal | 6 ++-- nix/cmark-gfm-cabal.patch | 13 +++++++ package.yaml | 2 +- src/Moat.hs | 12 +++---- 8 files changed, 56 insertions(+), 53 deletions(-) create mode 100644 nix/cmark-gfm-cabal.patch diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 18e3b80..600acef 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cabal: ["3.8"] - ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.4", "9.4.2"] + cabal: ["3.10"] + ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.4", "9.4.2", "9.6.2"] env: CONFIG: "--enable-tests" steps: diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 36e7c38..9a22d66 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -19,6 +19,7 @@ jobs: - ghc902 - ghc924 - ghc942 + - ghc962 steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v19 diff --git a/flake.lock b/flake.lock index b40eca7..a810dd6 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1675942811, - "narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=", + "lastModified": 1697059129, + "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "724bfc0892363087709bd3a5a1666296759154b1", + "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 607e432..ecc1d03 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ }: let systems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"]; - haskells = ["ghc902" "ghc924" "ghc942"]; + haskells = ["ghc902" "ghc924" "ghc942" "ghc962"]; eachSystem = nixpkgs.lib.genAttrs systems; @@ -20,16 +20,35 @@ latestHaskell = nixpkgs.lib.last haskells; pkgsBySystem = eachSystem (system: nixpkgs.legacyPackages.${system}); + + haskellPackages = eachSystem ( + system: let + pkgs = pkgsBySystem.${system}; + inherit (pkgs.haskell.lib) appendPatch; + in + eachHaskell ( + haskell: + pkgs.haskell.packages.${haskell}.override (prev: { + overrides = _: hprev: { + # Wants bytestring <0.12 + cmark-gfm = appendPatch hprev.cmark-gfm ./nix/cmark-gfm-cabal.patch; + }; + }) + ) + ); in { packages = eachSystem ( system: let - pkgs = pkgsBySystem.${system}; - - moats = builtins.listToAttrs (map (haskell: { - name = "moat-${haskell}"; - value = pkgs.haskell.packages.${haskell}.callPackage ./moat.nix {}; + moats = + nixpkgs.lib.mapAttrs' + (n: v: { + name = "moat-${n}"; + value = v; }) - haskells); + (eachHaskell ( + haskell: + haskellPackages.${system}.${haskell}.callPackage ./moat.nix {} + )); in moats // {default = moats."moat-${latestHaskell}";} ); @@ -37,40 +56,10 @@ devShells = eachSystem ( system: let pkgs = pkgsBySystem.${system}; - inherit - (pkgs.haskell.lib) - dontCheck - overrideCabal - ; - - enableSeparateBinOutput = drv: - if (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) - then overrideCabal drv (_: {enableSeparateBinOutput = false;}) - else drv; - - haskellOverlays = { - ghc902 = hself: hsuper: { - # Wants cabal == 3.6 - fourmolu = hsuper.fourmolu.overrideScope (lself: lsuper: { - Cabal = lself.Cabal_3_6_3_0; - }); - }; - ghc924 = hself: hsuper: { - # https://github.com/NixOS/nixpkgs/issues/140774 - ghcid = enableSeparateBinOutput hsuper.ghcid; - hls-fourmolu-plugin = dontCheck hsuper.hls-fourmolu-plugin; - }; - ghc942 = hself: hsuper: { - # https://github.com/NixOS/nixpkgs/issues/140774 - ghcid = dontCheck (enableSeparateBinOutput hsuper.ghcid); - }; - }; shells = eachHaskell ( haskell: let - hsPkgs = pkgs.haskell.packages.${haskell}.override (prev: { - overrides = haskellOverlays.${haskell}; - }); + hsPkgs = haskellPackages.${system}.${haskell}; in pkgs.mkShell { name = "moat-${haskell}-shell"; diff --git a/moat.cabal b/moat.cabal index 6202ed9..dfd9eab 100644 --- a/moat.cabal +++ b/moat.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.1. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack @@ -54,7 +54,7 @@ library , primitive >=0.6.4 && <0.9 , template-haskell >=2.11 && <2.21 , text >=1.2 && <2.1 - , th-abstraction >=0.3 && <0.6 + , th-abstraction >=0.3 && <0.7 , th-compat >=0.1.0 && <0.2 , time >=1.8 && <1.13 , unordered-containers ==0.2.* @@ -130,7 +130,7 @@ test-suite spec , primitive >=0.6.4 && <0.9 , template-haskell >=2.11 && <2.21 , text >=1.2 && <2.1 - , th-abstraction >=0.3 && <0.6 + , th-abstraction >=0.3 && <0.7 , th-compat >=0.1.0 && <0.2 , time >=1.8 && <1.13 , unordered-containers ==0.2.* diff --git a/nix/cmark-gfm-cabal.patch b/nix/cmark-gfm-cabal.patch new file mode 100644 index 0000000..ad6e628 --- /dev/null +++ b/nix/cmark-gfm-cabal.patch @@ -0,0 +1,13 @@ +diff --git a/cmark-gfm.cabal b/cmark-gfm.cabal +index 23277d8..4fc84b7 100644 +--- a/cmark-gfm.cabal ++++ b/cmark-gfm.cabal +@@ -69,7 +69,7 @@ library + exposed-modules: CMarkGFM + build-depends: base >=4.5 && < 5.0, + text >= 1.0 && < 2.1, +- bytestring >= 0.11.5 && < 0.12 ++ bytestring + if impl(ghc < 7.6) + build-depends: ghc-prim >= 0.2 + default-language: Haskell2010 diff --git a/package.yaml b/package.yaml index 1f18319..b5ec750 100644 --- a/package.yaml +++ b/package.yaml @@ -26,7 +26,7 @@ dependencies: - primitive >= 0.6.4 && < 0.9 - template-haskell >= 2.11 && < 2.21 - text >= 1.2 && < 2.1 - - th-abstraction >= 0.3 && < 0.6 + - th-abstraction >= 0.3 && < 0.7 - th-compat >= 0.1.0 && < 0.2 - time >= 1.8 && < 1.13 - unordered-containers >= 0.2 && < 0.3 diff --git a/src/Moat.hs b/src/Moat.hs index da5d17c..9864114 100644 --- a/src/Moat.hs +++ b/src/Moat.hs @@ -734,12 +734,12 @@ consToMoatType o@Options {..} parentName parentDoc instTys variant ts bs = \case else mkNewtypeInstance o parentDoc instTys con Newtype -> do if - | newtypeTag -> do - mkTypeTag o parentName instTys con - | typeAlias -> do - mkTypeAlias parentName parentDoc instTys con - | otherwise -> do - mkNewtype o parentName parentDoc instTys con + | newtypeTag -> do + mkTypeTag o parentName instTys con + | typeAlias -> do + mkTypeAlias parentName parentDoc instTys con + | otherwise -> do + mkNewtype o parentName parentDoc instTys con _ -> do mkProd o parentName parentDoc instTys ts con _ -> do From b283c74f7f8d3b3e4193eb38866e6fc2f08aa2ab Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Tue, 17 Oct 2023 13:38:18 -0700 Subject: [PATCH 2/4] Synchronize with hydra-built ghcs --- .github/workflows/haskell.yml | 2 +- .github/workflows/nix.yml | 8 ++++---- flake.nix | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 600acef..d71fac4 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: cabal: ["3.10"] - ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.4", "9.4.2", "9.6.2"] + ghc: ["8.8.4", "8.10.7", "9.0.2", "9.2.8", "9.4.6", "9.6.3"] env: CONFIG: "--enable-tests" steps: diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 9a22d66..77fe7c6 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -16,10 +16,10 @@ jobs: fail-fast: false matrix: ghc: - - ghc902 - - ghc924 - - ghc942 - - ghc962 + - ghc90 + - ghc92 + - ghc94 + - ghc96 steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v19 diff --git a/flake.nix b/flake.nix index ecc1d03..7db8b29 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ }: let systems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"]; - haskells = ["ghc902" "ghc924" "ghc942" "ghc962"]; + haskells = ["ghc90" "ghc92" "ghc94" "ghc96"]; eachSystem = nixpkgs.lib.genAttrs systems; From 375c8b4e530b48cf5e4f236a86ac41661af16595 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Tue, 17 Oct 2023 13:38:55 -0700 Subject: [PATCH 3/4] CI: Cancel in-progress jobs for the same PR/push ref --- .github/workflows/haskell.yml | 3 +++ .github/workflows/nix.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index d71fac4..eebf097 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -16,6 +16,9 @@ jobs: matrix: cabal: ["3.10"] ghc: ["8.8.4", "8.10.7", "9.0.2", "9.2.8", "9.4.6", "9.6.3"] + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.cabal }}-${{matrix.ghc}} + cancel-in-progress: true env: CONFIG: "--enable-tests" steps: diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 77fe7c6..963e5d7 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -20,6 +20,9 @@ jobs: - ghc92 - ghc94 - ghc96 + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.ghc }} + cancel-in-progress: true steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v19 From c3055d3b6e7b72146d374632f7ce6cc6da9b0bc1 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Tue, 17 Oct 2023 13:53:34 -0700 Subject: [PATCH 4/4] CI: use haskell-actions/setup --- .github/workflows/haskell.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index eebf097..6b463f8 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -14,20 +14,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cabal: ["3.10"] - ghc: ["8.8.4", "8.10.7", "9.0.2", "9.2.8", "9.4.6", "9.6.3"] + ghc: ["8.8", "8.10", "9.0", "9.2", "9.4", "9.6"] concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.cabal }}-${{matrix.ghc}} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{matrix.ghc}} cancel-in-progress: true env: CONFIG: "--enable-tests" steps: - uses: actions/checkout@v3 - - uses: haskell/actions/setup@v2.3 + - uses: haskell-actions/setup@v2.5.1 id: setup-haskell-cabal with: ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} + cabal-update: false - run: cabal v2-update - run: cabal v2-freeze $CONFIG - uses: actions/cache@v3