-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from sellout/adopt-flaky
Adopt Flaky
- Loading branch information
Showing
432 changed files
with
13,893 additions
and
7,166 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{"project":{ | ||
"description":"This library gives an extremely abstract presentation of various CT and abstract algebra concepts.", | ||
"name":"haskerwaul", | ||
"repo":"sellout/haskerwaul", | ||
"summary":"Category-parametric programming", | ||
"version":"0.1.0.0"}, | ||
"type":{"name":"haskell"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{ | ||
config, | ||
flaky, | ||
lib, | ||
pkgs, | ||
self, | ||
supportedSystems, | ||
... | ||
}: let | ||
githubSystems = ["macos-13" "ubuntu-22.04" "windows-2022"]; | ||
in { | ||
project = { | ||
name = "haskerwaul"; | ||
summary = "Category-parametric programming"; | ||
|
||
devPackages = [ | ||
pkgs.cabal-install | ||
pkgs.graphviz | ||
]; | ||
}; | ||
|
||
imports = [ | ||
(import ./github-ci.nix githubSystems) | ||
./hackage-publish.nix | ||
./hlint.nix | ||
]; | ||
|
||
## dependency management | ||
services.renovate.enable = true; | ||
|
||
## development | ||
programs = { | ||
direnv.enable = true; | ||
# This should default by whether there is a .git file/dir (and whether it’s | ||
# a file (worktree) or dir determines other things – like where hooks | ||
# are installed. | ||
git = { | ||
enable = true; | ||
ignores = [ | ||
# Cabal build | ||
"dist-newstyle" | ||
]; | ||
}; | ||
}; | ||
|
||
## formatting | ||
editorconfig.enable = true; | ||
|
||
programs = { | ||
treefmt = { | ||
enable = true; | ||
## Haskell formatter | ||
programs.ormolu.enable = true; | ||
}; | ||
vale = { | ||
enable = true; | ||
excludes = [ | ||
"*.cabal" | ||
"*.hs" | ||
"*.lhs" | ||
"./cabal.project" | ||
]; | ||
vocab.${config.project.name}.accept = [ | ||
"bugfix" | ||
"comonad" | ||
"conditionalize" | ||
"functor" | ||
"GADT" | ||
"Kleisli" | ||
"Kmett" | ||
]; | ||
}; | ||
}; | ||
|
||
## CI | ||
services.garnix = { | ||
enable = true; | ||
builds = { | ||
exclude = [ | ||
# TODO: Remove once garnix-io/garnix#285 is fixed. | ||
"homeConfigurations.x86_64-darwin-${config.project.name}-example" | ||
]; | ||
include = lib.mkForce ( | ||
[ | ||
"homeConfigurations.*" | ||
"nixosConfigurations.*" | ||
] | ||
++ lib.concatLists ( | ||
flaky.lib.garnixChecks | ||
( | ||
sys: | ||
[ | ||
"checks.${sys}.*" | ||
"devShells.${sys}.default" | ||
"packages.${sys}.default" | ||
] | ||
++ lib.concatMap (ghc: [ | ||
"devShells.${sys}.${ghc}" | ||
"packages.${sys}.${ghc}_all" | ||
]) | ||
(self.lib.testedGhcVersions sys) | ||
) | ||
) | ||
); | ||
}; | ||
}; | ||
## FIXME: Shouldn’t need `mkForce` here (or to duplicate the base contexts). | ||
## Need to improve module merging. | ||
services.github.settings.branches.main.protection.required_status_checks.contexts = | ||
lib.mkForce | ||
(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${ghc} [${sys}]" | ||
"package ghc${sys}_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 | ||
# this is disabled until we have a way to build Haskell without IFD. | ||
services.flakehub.enable = false; | ||
services.github.enable = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
githubSystems: { | ||
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 = { | ||
push.branches = ["main"]; | ||
pull_request.types = [ | ||
"opened" | ||
"synchronize" | ||
]; | ||
}; | ||
jobs = { | ||
build = { | ||
strategy = { | ||
fail-fast = false; | ||
matrix = { | ||
ghc = self.lib.nonNixTestedGhcVersions; | ||
os = githubSystems; | ||
bounds = ["--prefer-oldest" ""]; | ||
}; | ||
}; | ||
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"; | ||
}; | ||
} | ||
]; | ||
}; | ||
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 | ||
''; | ||
} | ||
]; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
lib, | ||
pkgs, | ||
self, | ||
... | ||
}: { | ||
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/hackage-publish@v1"; | ||
"with" = { | ||
hackageToken = "\${{ secrets.HACKAGE_AUTH_TOKEN }}"; | ||
packagesPath = "\${{ runner.temp }}/packages"; | ||
publish = false; | ||
}; | ||
} | ||
]; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.