Skip to content

Commit

Permalink
Sync Flaky template
Browse files Browse the repository at this point in the history
  • Loading branch information
sellout committed Aug 5, 2024
1 parent 261740d commit 55ee034
Show file tree
Hide file tree
Showing 26 changed files with 701 additions and 498 deletions.
1 change: 0 additions & 1 deletion .config/mustache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"name": "yaya",
"repo": "sellout/yaya",
"summary": "Yet another … yet another recursion scheme library for Haskell",
"version": "0.1.0.0",
},
"type": { "name": "haskell" },
}
70 changes: 39 additions & 31 deletions .config/project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@
lib,
pkgs,
self,
supportedSystems,
...
}: {
}: let
githubSystems = ["macos-13" "ubuntu-22.04" "windows-2022"];
in {
project = {
name = "yaya";
summary = "Yet another … yet another recursion scheme library for Haskell";

devPackages = [
pkgs.cabal-install
pkgs.graphviz
## So cabal-plan(-bounds) can be built in a devShell, since it doesn’t
## work in Nix proper.
pkgs.zlib
];
};

imports = [
./github-ci.nix
(import ./github-ci.nix githubSystems [config.project.name])
./hackage-publish.nix
./hlint.nix
];
Expand Down Expand Up @@ -48,6 +54,7 @@
enable = true;
## Haskell formatter
programs.ormolu.enable = true;
settings.formatter.prettier.excludes = ["*/docs/license-report.md"];
};
vale = {
enable = true;
Expand Down Expand Up @@ -84,29 +91,25 @@
services.garnix = {
enable = true;
builds = {
exclude = [
# TODO: Remove once garnix-io/garnix#285 is fixed.
"homeConfigurations.x86_64-darwin-${config.project.name}-example"
];
## TODO: Remove once garnix-io/garnix#285 is fixed.
exclude = ["homeConfigurations.x86_64-darwin-example"];
include = lib.mkForce (
[
"homeConfigurations.*"
"nixosConfigurations.*"
]
++ lib.concatLists (
flaky.lib.garnixChecks
(
sys:
[
"checks.${sys}.*"
"packages.${sys}.default"
]
++ lib.concatMap (ghc: [
"devShells.${sys}.${ghc}"
"packages.${sys}.${ghc}_all"
])
(self.lib.testedGhcVersions sys)
)
++ flaky.lib.forGarnixSystems supportedSystems (
sys:
[
"checks.${sys}.*"
"devShells.${sys}.default"
"packages.${sys}.default"
]
++ lib.concatMap (ghc: [
"devShells.${sys}.${ghc}"
"packages.${sys}.${ghc}_all"
])
(self.lib.testedGhcVersions sys)
)
);
};
Expand All @@ -115,24 +118,29 @@
## Need to improve module merging.
services.github.settings.branches.main.protection.required_status_checks.contexts =
lib.mkForce
(map (ghc: "CI / build (${ghc}) (pull_request)") self.lib.nonNixTestedGhcVersions
++ lib.concatLists (lib.concatMap flaky.lib.garnixChecks [
(sys:
lib.concatMap (ghc: [
"devShell ${ghc} [${sys}]"
"package ${ghc}_all [${sys}]"
])
(self.lib.testedGhcVersions sys))
(sys: [
(["check-bounds"]
++ lib.concatMap (sys:
lib.concatMap (ghc: [
"build (${ghc}, ${sys})"
"build (--prefer-oldest, ${ghc}, ${sys})"
])
self.lib.nonNixTestedGhcVersions)
githubSystems
++ flaky.lib.forGarnixSystems supportedSystems (sys:
lib.concatMap (ghc: [
"devShell ${ghc} [${sys}]"
"package ${ghc}_all [${sys}]"
])
(self.lib.testedGhcVersions sys)
++ [
"homeConfig ${sys}-${config.project.name}-example"
"package default [${sys}]"
## FIXME: These are duplicated from the base config
"check formatter [${sys}]"
"check project-manager-files [${sys}]"
"check vale [${sys}]"
"devShell default [${sys}]"
])
]));
]));

## publishing
# NB: Can’t use IFD on FlakeHub (see DeterminateSystems/flakehub-push#69), so
Expand Down
85 changes: 65 additions & 20 deletions .config/project/github-ci.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
githubSystems: haskellPackages: {
lib,
pkgs,
self,
...
}: let
planName = "plan-\${{ runner.os }}-\${{ matrix.ghc }}\${{ matrix.bounds }}";
## NB: `cabal-plan-bounds` doesn’t yet support GHC 9.8.
ghc-version = "9.6.3";
runs-on = "ubuntu-22.04";
in {
services.github.workflow."build.yml".text = lib.generators.toYAML {} {
name = "CI";
Expand All @@ -20,22 +23,14 @@ in {
strategy = {
fail-fast = false;
matrix = {
ghc = self.lib.nonNixTestedGhcVersions;
os = ["macos-13" "ubuntu-22.04" "windows-2022"];
bounds = ["--prefer-oldest" ""];
ghc = self.lib.nonNixTestedGhcVersions;
os = githubSystems;
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.
## GHCup can’t find this version for Linux.
{
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";
ghc = "7.10.3";
os = "ubuntu-22.04";
}
];
};
Expand All @@ -45,12 +40,11 @@ in {
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;
ghc-version = "\${{ matrix.ghc }}";
};
}
{run = "cabal v2-freeze $CONFIG";}
Expand Down Expand Up @@ -80,7 +74,10 @@ in {
];
};
check-bounds = {
runs-on = "ubuntu-22.04";
inherit runs-on;
## Some "build" jobs are a bit flaky. This can give us useful bounds
## information even without all of the build plans.
"if" = "always()";
needs = ["build"];
steps = [
{uses = "actions/checkout@v4";}
Expand All @@ -89,8 +86,7 @@ in {
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";
inherit ghc-version;
cabal-version = pkgs.cabal-install.version;
};
}
Expand Down Expand Up @@ -128,7 +124,7 @@ in {
${
lib.concatMapStrings
(pkg: "--also " + pkg + " ")
self.lib.extraDependencyVersions
self.lib.extraDependencyVersions or []
} \
plans/*.json \
--cabal {} \;)"
Expand All @@ -140,6 +136,55 @@ in {
}
];
};
check-licenses = {
inherit runs-on;
## Some "build" jobs are a bit flaky. Since this only uses one of the
## jobs from the matrix, we run it regardless of build failures.
"if" = "always()";
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" = {
inherit ghc-version;
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal install cabal-plan -flicense-report";}
{
name = "download Cabal plans";
uses = "actions/download-artifact@v4";
"with" = {
path = "plans";
pattern = "plan-*";
merge-multiple = true;
};
}
{
run = ''
mkdir -p dist-newstyle/cache
mv plans/plan-''${{ runner.os }}-9.8.1.json dist-newstyle/cache/plan.json
'';
}
{
name = "check if licenses have changed";
run = ''
${lib.toShellVar "packages" haskellPackages}
for package in "''${packages[@]}"; do
{
echo "**NB**: This captures the licenses associated with a particular set of dependency versions. If your own build solves differently, it’s possible that the licenses may have changed, or even that the set of dependencies itself is different. Please make sure you run [\`cabal-plan license-report\`](https://hackage.haskell.org/package/cabal-plan) on your own components rather than assuming this is authoritative."
echo
cabal-plan license-report "$package:lib:$package"
} >"$package/docs/license-report.md"
done
git diff --exit-code */docs/license-report.md
'';
}
];
};
};
};
}
2 changes: 1 addition & 1 deletion .github/renovate.json

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

Loading

0 comments on commit 55ee034

Please sign in to comment.