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

Only check with -Werror in CI #1431

Merged
merged 1 commit into from
May 15, 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
25 changes: 25 additions & 0 deletions .github/workflows/ci-nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,31 @@ jobs:
body-file: comment-body.md
reactions: rocket

nix-flake-check:
name: "nix flake check"
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4

- name: ❄ Prepare nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000

- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v14
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: ❄ Nix Flake Check
run: |
nix flake check -L


build-specification:
name: "Build specification using nix"
runs-on: ubuntu-latest
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ Besides these general build instructions, some components might document
additional steps and useful tools in their `README.md` files, e.g. the
[docs](./docs/README.md) or the [hydra-cluster](./hydra-cluster/README.md)

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

### Coding standards

Expand Down
4 changes: 0 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ packages:
package *
ghc-options: -j8

-- Warnings as errors for local packages
program-options
ghc-options: -Werror

-- Always build tests and benchmarks of local packages
tests: True
benchmarks: True
Expand Down
32 changes: 31 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@
with pkgs.lib.attrsets;
mapAttrs' (name: value: nameValuePair (s + name) value) attrs;

addWerror = x: x.override { ghcOptions = [ "-Werror" ]; };

componentsToWerrors = n: x:
builtins.listToAttrs
([
{
name = "${n}-werror";
value = addWerror x.components.library;
}
]) // lib.attrsets.mergeAttrsList (map
(y:
lib.mapAttrs'
(k: v: {
name = "${n}-${y}-${k}-werror";
value = addWerror v;
})
x.components."${y}") [ "benchmarks" "exes" "sublibs" "tests" ]);
locallycompact marked this conversation as resolved.
Show resolved Hide resolved
in
rec {
legacyPackages = hsPkgs;
Expand Down Expand Up @@ -133,7 +150,20 @@
src = self;
exe = "${packages.plutus-merkle-tree-tests}/bin/tests";
};
} //
} // lib.attrsets.mergeAttrsList (map (x: componentsToWerrors x hsPkgs.${x}) [
"cardano-api-classy"
"hydra-cardano-api"
"hydra-chain-observer"
"hydra-cluster"
"hydra-explorer"
"hydra-node"
"hydra-plutus"
"hydra-plutus-extras"
"hydra-test-utils"
"hydra-tui"
"plutus-cbor"
"plutus-merkle-tree"
]) //
(if pkgs.stdenv.isLinux then
{
inherit (packages)
Expand Down
1 change: 1 addition & 0 deletions hydra-node/test/Hydra/Model/Payment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ instance IsTx Payment where
type UTxOType Payment = [(CardanoSigningKey, Value)]
type ValueType Payment = Value
txId = error "undefined"
txSpendingUTxO = error "undefined"
locallycompact marked this conversation as resolved.
Show resolved Hide resolved
balance = foldMap snd
hashUTxO = encodeUtf8 . show @Text

Expand Down