Skip to content

Commit 23eae35

Browse files
Add -Werror checks
1 parent cf535c7 commit 23eae35

File tree

5 files changed

+59
-8
lines changed

5 files changed

+59
-8
lines changed

.github/workflows/ci-nix.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,31 @@ jobs:
233233
body-file: comment-body.md
234234
reactions: rocket
235235

236+
nix-flake-check:
237+
name: "nix flake check"
238+
runs-on: ubuntu-latest
239+
steps:
240+
- name: 📥 Checkout repository
241+
uses: actions/checkout@v4
242+
243+
- name: ❄ Prepare nix
244+
uses: cachix/install-nix-action@v26
245+
with:
246+
extra_nix_config: |
247+
accept-flake-config = true
248+
log-lines = 1000
249+
250+
- name: ❄ Cachix cache of nix derivations
251+
uses: cachix/cachix-action@v14
252+
with:
253+
name: cardano-scaling
254+
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
255+
256+
- name: ❄ Nix Flake Check
257+
run: |
258+
nix flake check -L
259+
260+
236261
build-specification:
237262
name: "Build specification using nix"
238263
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ Besides these general build instructions, some components might document
112112
additional steps and useful tools in their `README.md` files, e.g. the
113113
[docs](./docs/README.md) or the [hydra-cluster](./hydra-cluster/README.md)
114114

115-
Warnings are treated as errors for the whole project. To ease development, it
116-
might be handy to it off locally in a `cabal.project.local` with: `cabal
117-
configure --ghc-options -Wwarn`.
115+
While warnings are not treated as errors during builds, CI will check for it
116+
before we merge any contributions.
118117

119118
### Coding standards
120119

cabal.project

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ packages:
3535
package *
3636
ghc-options: -j8
3737

38-
-- Warnings as errors for local packages
39-
program-options
40-
ghc-options: -Werror
41-
4238
-- Always build tests and benchmarks of local packages
4339
tests: True
4440
benchmarks: True

flake.nix

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@
9898
with pkgs.lib.attrsets;
9999
mapAttrs' (name: value: nameValuePair (s + name) value) attrs;
100100

101+
addWerror = x: x.override { ghcOptions = [ "-Werror" ]; };
102+
103+
componentsToWerrors = n: x:
104+
builtins.listToAttrs
105+
([
106+
{
107+
name = "${n}-werror";
108+
value = addWerror x.components.library;
109+
}
110+
]) // lib.attrsets.mergeAttrsList (map
111+
(y:
112+
lib.mapAttrs'
113+
(k: v: {
114+
name = "${n}-${y}-${k}-werror";
115+
value = addWerror v;
116+
})
117+
x.components."${y}") [ "benchmarks" "exes" "sublibs" "tests" ]);
101118
in
102119
rec {
103120
legacyPackages = hsPkgs;
@@ -133,7 +150,20 @@
133150
src = self;
134151
exe = "${packages.plutus-merkle-tree-tests}/bin/tests";
135152
};
136-
} //
153+
} // lib.attrsets.mergeAttrsList (map (x: componentsToWerrors x hsPkgs.${x}) [
154+
"cardano-api-classy"
155+
"hydra-cardano-api"
156+
"hydra-chain-observer"
157+
"hydra-cluster"
158+
"hydra-explorer"
159+
"hydra-node"
160+
"hydra-plutus"
161+
"hydra-plutus-extras"
162+
"hydra-test-utils"
163+
"hydra-tui"
164+
"plutus-cbor"
165+
"plutus-merkle-tree"
166+
]) //
137167
(if pkgs.stdenv.isLinux then
138168
{
139169
inherit (packages)

hydra-node/test/Hydra/Model/Payment.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ instance IsTx Payment where
8686
type UTxOType Payment = [(CardanoSigningKey, Value)]
8787
type ValueType Payment = Value
8888
txId = error "undefined"
89+
txSpendingUTxO = error "undefined"
8990
balance = foldMap snd
9091
hashUTxO = encodeUtf8 . show @Text
9192

0 commit comments

Comments
 (0)