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

Sync with the latest Flaky template #36

Merged
merged 5 commits into from
Mar 1, 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
2 changes: 1 addition & 1 deletion .config/mustache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"name":"yaya",
"repo":"sellout/yaya",
"summary":"Yet another … yet another recursion scheme library for Haskell",
"version":"0.1.0"},
"version":"0.1.0.0"},
"type":{"name":"haskell"}
}
67 changes: 50 additions & 17 deletions .config/project/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{config, flaky, lib, pkgs, self, ...}: {
{
config,
flaky,
lib,
pkgs,
self,
...
}: {
project = {
name = "yaya";
summary = "Yet another … yet another recursion scheme library for Haskell";
Expand Down Expand Up @@ -75,30 +82,56 @@
## CI
services.garnix = {
enable = true;
builds.exclude = [
# TODO: Remove once garnix-io/garnix#285 is fixed.
"homeConfigurations.x86_64-darwin-${config.project.name}-example"
];
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}.*"
"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
(map (ghc: "CI / build (${ghc}) (pull_request)") self.lib.nonNixTestedGhcVersions
++ lib.concatLists (lib.concatMap flaky.lib.garnixChecks [
(sys: lib.concatMap (ghc: [
(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: [
"homeConfig ${sys}-${config.project.name}-example"
"package default [${sys}]"
## FIXME: These are duplicated from the base config
"check formatter [${sys}]"
"devShell default [${sys}]"
])
]));
(self.lib.testedGhcVersions sys))
(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
services.flakehub.enable = true;
Expand Down
17 changes: 11 additions & 6 deletions .config/project/github-ci.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{lib, self, ...}: {
{lib, pkgs, self, ...}: {
services.github.workflow."build.yml".text = lib.generators.toYAML {} {
name = "CI";
on = {
Expand All @@ -11,10 +11,12 @@
jobs.build = {
strategy = {
fail-fast = false;
matrix.os = ["macos-13" "ubuntu-22.04" "windows-2022"];
## TODO: Populate this as the difference between supported versions and
## available nix package sets.
matrix.ghc = self.lib.nonNixTestedGhcVersions;
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"];
};
};
runs-on = "\${{ matrix.os }}";
env.CONFIG = "--enable-tests --enable-benchmarks";
Expand All @@ -25,7 +27,7 @@
id = "setup-haskell-cabal";
"with" = {
ghc-version = "\${{ matrix.ghc }}";
cabal-version = "3.10";
cabal-version = pkgs.cabal-install.version;
};
}
{run = "cabal v2-update";}
Expand All @@ -40,6 +42,9 @@
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";}
];
};
Expand Down
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.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![built with garnix](https://img.shields.io/endpoint?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Fsellout%2Fyaya)](https://garnix.io)
[![Packaging status](https://repology.org/badge/tiny-repos/haskell:yaya.svg)](https://repology.org/project/haskell:yaya/versions)
[![latest packaged version(s)](https://repology.org/badge/latest-versions/haskell:yaya.svg)](https://repology.org/project/haskell:yaya/versions)
[![latest packaged versions](https://repology.org/badge/latest-versions/haskell:yaya.svg)](https://repology.org/project/haskell:yaya/versions)

Yet another … yet another recursion scheme library for Haskell

Expand Down Expand Up @@ -33,7 +33,7 @@ To mitigate some of those issues for versioning, we assume the following usage:

- modules should be imported using `PackageImports`, so that adding modules is a _minor_ change;
- modules should be imported qualified, so that adding definitions is a _minor_ change;
- adding instances can't be mitigated in the same way, and it's not uncommon for downstream libraries to add orphans instances when they're omitted from upstream libraries. However, since these conflicts can only happen via direct dependencies, and represent an explicit downstream workaround, it's reasonable to expect a quick downstream update to remove or conditionalize the workaround. So, this is considered a _minor major_ change;
- adding instances can't be mitigated in the same way, and it's not uncommon for downstream libraries to add orphans instances when they're omitted from upstream libraries. However, since these conflicts can only happen via direct dependencies, and represent an explicit downstream workaround, its reasonable to expect a quick downstream update to remove or conditionalize the workaround. So, this is considered a _minor major_ change;
- deprecation is considered a _revision_ change, however it will often be paired with _minor_ changes. `-Werror` can cause this to fail, but published libraries shouldn't be compiled with `-Werror`.

## building & development
Expand Down
3 changes: 0 additions & 3 deletions Setup.hs

This file was deleted.

3 changes: 2 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
program-options
ghc-options: -Werror
ghc-options:
-Werror

tests: True

Expand Down
14 changes: 14 additions & 0 deletions containers/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- __NB__: `custom-setup` doesn’t have any way to specify extensions, so any we
-- want need to be specified here.
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}

module Main (main) where

import safe "base" System.IO (IO)
import "cabal-doctest" Distribution.Extra.Doctest (defaultMainWithDoctests)

main :: IO ()
main = defaultMainWithDoctests "doctests"
1 change: 1 addition & 0 deletions containers/src/Yaya/Containers/Pattern/IntMap.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Yaya.Containers.Pattern.IntMap
Expand Down
1 change: 1 addition & 0 deletions containers/src/Yaya/Containers/Pattern/IntSet.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Yaya.Containers.Pattern.IntSet
Expand Down
1 change: 1 addition & 0 deletions containers/src/Yaya/Containers/Pattern/Map.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Yaya.Containers.Pattern.Map
Expand Down
1 change: 1 addition & 0 deletions containers/src/Yaya/Containers/Pattern/Set.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Yaya.Containers.Pattern.Set
Expand Down
10 changes: 10 additions & 0 deletions containers/tests/doctests.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Main (main) where

import "base" Data.Function (($))
import "base" Data.Semigroup (Semigroup ((<>)))
import "base" System.IO (IO)
import "doctest" Test.DocTest (doctest)
import "this" Build_doctests (flags, module_sources, pkgs)

main :: IO ()
main = doctest $ flags <> pkgs <> module_sources
Loading
Loading