Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock file maintenance #54

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" },
}
110 changes: 79 additions & 31 deletions .config/project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,66 @@
lib,
pkgs,
self,
supportedSystems,
...
}: {
}: let
githubSystems = [
"macos-13" # x86_64-darwin
"macos-14" # aarch64-darwin
"ubuntu-22.04" # x86_64-linux
"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 {
systems = githubSystems;
packages = {
yaya = "core";
yaya-containers = "containers";
yaya-hedgehog = "hedgehog";
yaya-quickcheck = "quickcheck";
yaya-unsafe = "unsafe";
};
exclude = [
## TODO: This particular combination requires libgmp.
{
bounds = "--prefer-oldest";
ghc = "8.6.1";
os = "macos-13";
}
## TODO: This build often hangs for some reason.
{
bounds = "--prefer-oldest";
ghc = "8.8.1";
os = "windows-2022";
}
## TODO: For some reason, this combination fails to build
## ghc-paths-0.1.0.12.
{
ghc = "9.4.1";
os = "macos-14";
}
]
## GitHub can’t install GHC older than 9.4 on macos-14.
++ map (ghc: {
inherit ghc;
os = "macos-14";
}) (builtins.filter (ghc: lib.versionOlder ghc "9.4")
self.lib.nonNixTestedGhcVersions);
})
./hackage-publish.nix
./hlint.nix
];
Expand Down Expand Up @@ -48,6 +94,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 +131,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 +158,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
110 changes: 80 additions & 30 deletions .config/project/github-ci.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
{
## TODO: Map `systems` and `exclude` from Nixier values – perhaps flake-utils
## systems, and a bool for `--prefer-oldest`?
{ systems,
packages,
## TODO: Prefer ignoring most known failures once
## https://github.com/orgs/community/discussions/15452 is resolved.
exclude ? [],
}: {
lib,
pkgs,
self,
...
}: let
planName = "plan-\${{ runner.os }}-\${{ matrix.ghc }}\${{ matrix.bounds }}";
planName = "plan-\${{ matrix.os }}-\${{ matrix.ghc }}\${{ matrix.bounds }}";
## NB: Prefer the default compiler version.
ghc-version = "9.6.5";
## This should be the highest GHC version that this workflow built.
latest-ghc-version = "9.10.1";
cabal-version = "3.12.1.0";
runs-on = "ubuntu-22.04";
in {
services.github.workflow."build.yml".text = lib.generators.toYAML {} {
name = "CI";
Expand All @@ -20,37 +33,30 @@ in {
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";
}
];
ghc = self.lib.nonNixTestedGhcVersions;
os = systems;
exclude =
[
## GHCup can’t find this version for Linux.
{
ghc = "7.10.3";
os = "ubuntu-22.04";
}
]
++ exclude;
};
};
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" = {
inherit cabal-version;
ghc-version = "\${{ matrix.ghc }}";
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal v2-freeze $CONFIG";}
Expand All @@ -61,7 +67,7 @@ in {
''${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
'';
key = "\${{ runner.os }}-\${{ matrix.ghc }}-\${{ hashFiles('cabal.project.freeze') }}";
key = "\${{ matrix.os }}-\${{ matrix.ghc }}-\${{ hashFiles('cabal.project.freeze') }}";
};
}
## NB: The `doctests` suites don’t seem to get built without
Expand All @@ -80,19 +86,17 @@ 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";}
{
## 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;
};
"with" = {inherit cabal-version ghc-version;};
}
{
run = ''
Expand Down Expand Up @@ -128,7 +132,7 @@ in {
${
lib.concatMapStrings
(pkg: "--also " + pkg + " ")
self.lib.extraDependencyVersions
self.lib.extraDependencyVersions or []
} \
plans/*.json \
--cabal {} \;)"
Expand All @@ -140,6 +144,52 @@ 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";}
{
uses = "haskell-actions/setup@v2";
id = "setup-haskell-cabal";
"with" = {inherit cabal-version ghc-version;};
}
## The `-Wwarn` offsets an issue where warnings are causing failures.
{run = "cabal install cabal-plan -flicense-report --ghc-option=-Wwarn";}
{
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-${runs-on}-${latest-ghc-version}.json dist-newstyle/cache/plan.json
'';
}
{
name = "check if licenses have changed";
run = ''
${lib.toShellVar "packages" packages}
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"
} >"''${packages[''${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