diff --git a/.config/project/github-ci.nix b/.config/project/github-ci.nix index 21b5fe9..6ed9d38 100644 --- a/.config/project/github-ci.nix +++ b/.config/project/github-ci.nix @@ -5,6 +5,7 @@ ... }: let planName = "plan-\${{ runner.os }}-\${{ matrix.ghc }}\${{ matrix.bounds }}"; + cabalFilePattern = "planned-bounds.cabal"; in { services.github.workflow."build.yml".text = lib.generators.toYAML {} { name = "CI"; @@ -96,7 +97,7 @@ in { } {run = "cabal install cabal-plan-bounds";} { - name = "Load plans"; + name = "download Cabal plans"; uses = "actions/download-artifact@v4"; "with" = { path = "plans"; @@ -104,12 +105,17 @@ in { merge-multiple = true; }; } - {run = "find plans/";} - {run = "find . -name '*.cabal' -exec cabal-plan-bounds plans/*.json --cabal {} \\;";} - {run = "git diff **/*.cabal";} { - name = "Fail if .cabal file was changed"; - run = "git diff-files --quiet **/*.cabal || exit 1"; + name = "Cabal plans considered in generated bounds"; + run = "find plans/"; + } + { + name = "update generated bounds"; + run = "find . -name '${cabalFilePattern}' -exec cabal-plan-bounds plans/*.json --cabal {} \\;"; + } + { + name = "check if bounds have changed"; + run = "git diff --exit-code ${cabalFilePattern}"; } ]; }; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03e116c..ecef5b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1 +1 @@ -{"jobs":{"build":{"env":{"CONFIG":"--enable-tests --enable-benchmarks ${{ matrix.bounds }}"},"runs-on":"${{ matrix.os }}","steps":[{"uses":"actions/checkout@v4"},{"id":"setup-haskell-cabal","uses":"haskell-actions/setup@v2","with":{"cabal-version":"3.10.2.1","ghc-version":"${{ matrix.ghc }}"}},{"run":"cabal v2-freeze $CONFIG"},{"uses":"actions/cache@v4","with":{"key":"${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}","path":"${{ steps.setup-haskell-cabal.outputs.cabal-store }}\ndist-newstyle\n"}},{"run":"cabal v2-build all $CONFIG"},{"run":"cabal v2-test all $CONFIG"},{"run":"mv dist-newstyle/cache/plan.json plan-${{ runner.os }}-${{ matrix.ghc }}${{ matrix.bounds }}.json"},{"name":"Upload build plan as artifact","uses":"actions/upload-artifact@v4","with":{"name":"plan-${{ runner.os }}-${{ matrix.ghc }}${{ matrix.bounds }}","path":"plan-${{ runner.os }}-${{ matrix.ghc }}${{ matrix.bounds }}.json"}}],"strategy":{"fail-fast":false,"matrix":{"bounds":["--prefer-oldest",""],"exclude":[{"bounds":"--prefer-oldest","ghc":"8.6.1","os":"macos-13"},{"ghc":"8.10.1","os":"windows-2022"}],"ghc":["8.6.1","8.8.1","8.10.1","9.0.1","9.2.1","9.4.1","9.6.1","9.8.1"],"os":["macos-13","ubuntu-22.04","windows-2022"]}}},"check-bounds":{"needs":["build"],"runs-on":"ubuntu-22.04","steps":[{"uses":"actions/checkout@v4"},{"id":"setup-haskell-cabal","uses":"haskell-actions/setup@v2","with":{"cabal-version":"3.10.2.1","ghc-version":"9.6.3"}},{"run":"cabal install cabal-plan-bounds"},{"name":"Load plans","uses":"actions/download-artifact@v4","with":{"merge-multiple":true,"path":"plans","pattern":"plan-*"}},{"run":"find plans/"},{"run":"find . -name '*.cabal' -exec cabal-plan-bounds plans/*.json --cabal {} \\;"},{"run":"git diff **/*.cabal"},{"name":"Fail if .cabal file was changed","run":"git diff-files --quiet **/*.cabal || exit 1"}]}},"name":"CI","on":{"pull_request":{"types":["opened","synchronize"]},"push":{"branches":["main"]}}} \ No newline at end of file +{"jobs":{"build":{"env":{"CONFIG":"--enable-tests --enable-benchmarks ${{ matrix.bounds }}"},"runs-on":"${{ matrix.os }}","steps":[{"uses":"actions/checkout@v4"},{"id":"setup-haskell-cabal","uses":"haskell-actions/setup@v2","with":{"cabal-version":"3.10.2.1","ghc-version":"${{ matrix.ghc }}"}},{"run":"cabal v2-freeze $CONFIG"},{"uses":"actions/cache@v4","with":{"key":"${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}","path":"${{ steps.setup-haskell-cabal.outputs.cabal-store }}\ndist-newstyle\n"}},{"run":"cabal v2-build all $CONFIG"},{"run":"cabal v2-test all $CONFIG"},{"run":"mv dist-newstyle/cache/plan.json plan-${{ runner.os }}-${{ matrix.ghc }}${{ matrix.bounds }}.json"},{"name":"Upload build plan as artifact","uses":"actions/upload-artifact@v4","with":{"name":"plan-${{ runner.os }}-${{ matrix.ghc }}${{ matrix.bounds }}","path":"plan-${{ runner.os }}-${{ matrix.ghc }}${{ matrix.bounds }}.json"}}],"strategy":{"fail-fast":false,"matrix":{"bounds":["--prefer-oldest",""],"exclude":[{"bounds":"--prefer-oldest","ghc":"8.6.1","os":"macos-13"},{"ghc":"8.10.1","os":"windows-2022"}],"ghc":["8.6.1","8.8.1","8.10.1","9.0.1","9.2.1","9.4.1","9.6.1","9.8.1"],"os":["macos-13","ubuntu-22.04","windows-2022"]}}},"check-bounds":{"needs":["build"],"runs-on":"ubuntu-22.04","steps":[{"uses":"actions/checkout@v4"},{"id":"setup-haskell-cabal","uses":"haskell-actions/setup@v2","with":{"cabal-version":"3.10.2.1","ghc-version":"9.6.3"}},{"run":"cabal install cabal-plan-bounds"},{"name":"download Cabal plans","uses":"actions/download-artifact@v4","with":{"merge-multiple":true,"path":"plans","pattern":"plan-*"}},{"name":"Cabal plans considered in generated bounds","run":"find plans/"},{"name":"update generated bounds","run":"find . -name 'planned-bounds.cabal' -exec cabal-plan-bounds plans/*.json --cabal {} \\;"},{"name":"check if bounds have changed","run":"git diff --exit-code planned-bounds.cabal"}]}},"name":"CI","on":{"pull_request":{"types":["opened","synchronize"]},"push":{"branches":["main"]}}} \ No newline at end of file diff --git a/planned-bounds.cabal b/planned-bounds.cabal new file mode 100644 index 0000000..25f1067 --- /dev/null +++ b/planned-bounds.cabal @@ -0,0 +1,35 @@ +cabal-version: 3.4 + +name: planned-bounds +version: 0.1.0.0 +synopsis: Dependency bounds as determined by `cabal-plan-bounds`. +description: This is a non-built package intended to catch changes in our + dependency bounds. The actual packages use slightly different + bounds in some cases (always accompanied by a comment), and a + clearer syntax (see cabal-plan-bounds#18). This allows us to still + have a check that fails and forces us to review changes without + having to match `cabal-plan-bounds`’ results exactly. + +library + build-depends: + Cabal, + QuickCheck, + base, + bifunctors, + cabal-doctest, + comonad, + containers, + deriving-compat, + doctest, + either, + foldable1-classes-compat, + free, + hedgehog, + kan-extensions, + lens, + profunctors, + splitmix, + strict, + template-haskell, + th-abstraction, + transformers