Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into more-instances
Browse files Browse the repository at this point in the history
  • Loading branch information
sellout committed Mar 24, 2024
2 parents fd28f56 + a14bf56 commit 02a8668
Show file tree
Hide file tree
Showing 30 changed files with 378 additions and 1,845 deletions.
5 changes: 4 additions & 1 deletion .config/project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

imports = [
./github-ci.nix
./hackage-publish.nix
./hlint.nix
];

Expand Down Expand Up @@ -134,7 +135,9 @@
]));

## publishing
services.flakehub.enable = true;
# NB: Can’t use IFD on FlakeHub (see DeterminateSystems/flakehub-push#69), so
# this is disabled until we have a way to build Haskell without IFD.
services.flakehub.enable = false;
services.github.enable = true;
services.github.settings.repository.topics = ["recursion-schemes"];
}
151 changes: 114 additions & 37 deletions .config/project/github-ci.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{lib, pkgs, self, ...}: {
{
lib,
pkgs,
self,
...
}: let
planName = "plan-\${{ runner.os }}-\${{ matrix.ghc }}\${{ matrix.bounds }}";
in {
services.github.workflow."build.yml".text = lib.generators.toYAML {} {
name = "CI";
on = {
Expand All @@ -8,45 +15,115 @@
"synchronize"
];
};
jobs.build = {
strategy = {
fail-fast = false;
matrix = {
## TODO: Populate this as the difference between supported versions
## and available nix package sets.
ghc = self.lib.nonNixTestedGhcVersions;
os = ["macos-13" "ubuntu-22.04" "windows-2022"];
jobs = {
build = {
strategy = {
fail-fast = false;
matrix = {
ghc = self.lib.nonNixTestedGhcVersions;
os = ["macos-13" "ubuntu-22.04" "windows-2022"];
bounds = ["--prefer-oldest" ""];
exclude = [
## This combination currently fails due to a libgmp issue.
## Hopefully, constraining based on the remaining cases will
## result in bounds that eliminate the problem.
{
ghc = "8.6.1";
os = "macos-13";
bounds = "--prefer-oldest";
}
## These jobs are currently hanging at the end of the build.
{
ghc = "8.10.1";
os = "windows-2022";
}
];
};
};
runs-on = "\${{ matrix.os }}";
env.CONFIG = "--enable-tests --enable-benchmarks \${{ matrix.bounds }}";
steps = [
{uses = "actions/checkout@v4";}
{
## TODO: Uses deprecated Node.js, see haskell-actions/setup#72
uses = "haskell-actions/setup@v2";
id = "setup-haskell-cabal";
"with" = {
ghc-version = "\${{ matrix.ghc }}";
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal v2-freeze $CONFIG";}
{
uses = "actions/cache@v4";
"with" = {
path = ''
''${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
'';
key = "\${{ runner.os }}-\${{ matrix.ghc }}-\${{ hashFiles('cabal.project.freeze') }}";
};
}
## NB: The `doctests` suites don’t seem to get built without
## explicitly doing so before running the tests.
{run = "cabal v2-build all $CONFIG";}
{run = "cabal v2-test all $CONFIG";}
{run = "mv dist-newstyle/cache/plan.json ${planName}.json";}
{
name = "Upload build plan as artifact";
uses = "actions/upload-artifact@v4";
"with" = {
name = planName;
path = "${planName}.json";
};
}
];
};
runs-on = "\${{ matrix.os }}";
env.CONFIG = "--enable-tests --enable-benchmarks";
steps = [
{uses = "actions/checkout@v4";}
{
uses = "haskell-actions/setup@v2";
id = "setup-haskell-cabal";
"with" = {
ghc-version = "\${{ matrix.ghc }}";
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal v2-update";}
{run = "cabal v2-freeze $CONFIG";}
{
uses = "actions/cache@v4";
"with" = {
path = ''
''${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
check-bounds = {
runs-on = "ubuntu-22.04";
needs = ["build"];
steps = [
{uses = "actions/checkout@v4";}
{
## TODO: Uses deprecated Node.js, see haskell-actions/setup#72
uses = "haskell-actions/setup@v2";
id = "setup-haskell-cabal";
"with" = {
## NB: `cabal-plan-bounds` doesn’t yet support GHC 9.8.
ghc-version = "9.6.3";
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal install cabal-plan-bounds";}
{
name = "download Cabal plans";
uses = "actions/download-artifact@v4";
"with" = {
path = "plans";
pattern = "plan-*";
merge-multiple = true;
};
}
{
name = "Cabal plans considered in generated bounds";
run = "find plans/";
}
{
name = "check if bounds have changed";
## TODO: Simplify this once cabal-plan-bounds supports a `--check`
## option.
run = ''
diffs="$(find . \
-name '*.cabal' \
-exec cabal-plan-bounds --dry-run plans/*.json --cabal {} \;)"
if [[ -n "$diffs" ]]; then
echo "$diffs"
exit 1
fi
'';
key = "\${{ runner.os }}-\${{ matrix.ghc }}-\${{ hashFiles('cabal.project.freeze') }}";
};
}
## NB: The `doctests` suites don’t seem to get built without explicitly
## doing so before running the tests.
{run = "cabal v2-build all $CONFIG";}
{run = "cabal v2-test all $CONFIG";}
];
}
];
};
};
};
}
50 changes: 50 additions & 0 deletions .config/project/hackage-publish.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
lib,
pkgs,
self,
...
}: let
packagesPath = "\${{ runner.temp }}/packages/";
in {
services.github.workflow."hackage-publish.yml".text = lib.generators.toYAML {} {
name = "Publish release to Hackage";
on = {
push.tags = ["v?[0-9]+.[0-9]+.[0-9]+*"];
workflow_dispatch.inputs.tag = {
description = "The existing version to publish to Hackage";
type = "string";
required = true;
};
};
jobs.hackage-publish = {
runs-on = "ubuntu-latest";
permissions = {
id-token = "write";
contents = "read";
};
steps = [
{
uses = "actions/checkout@v4";
"with".ref = "\${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}";
}
{
uses = "haskell-actions/setup@v2";
id = "setup-haskell-cabal";
"with" = {
ghc-version = lib.last self.lib.nonNixTestedGhcVersions;
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal v2-sdist --output-directory='${packagesPath}' all";}
{
uses = "haskell-actions/hackage-publish@v1";
"with" = {
inherit packagesPath;
hackageToken = "\${{ secrets.HACKAGE_AUTH_TOKEN }}";
publish = false;
};
}
];
};
};
}
2 changes: 1 addition & 1 deletion .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/settings.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 0 additions & 27 deletions .github/workflows/flakehub-publish.yml

This file was deleted.

Loading

0 comments on commit 02a8668

Please sign in to comment.