From 0eebc98b7ab09f10c625a154dfbda975f83c5169 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Mon, 13 May 2024 12:45:07 +0000 Subject: [PATCH] Add -Werror checks --- .github/workflows/nix-flake-check.yaml | 27 ++++++++++++++++++++++++++ flake.nix | 11 +++++++++++ hydra-cluster/hydra-cluster.cabal | 3 +-- hydra-node/test/Hydra/Model/Payment.hs | 1 + 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/nix-flake-check.yaml diff --git a/.github/workflows/nix-flake-check.yaml b/.github/workflows/nix-flake-check.yaml new file mode 100644 index 00000000000..3688cb8dc79 --- /dev/null +++ b/.github/workflows/nix-flake-check.yaml @@ -0,0 +1,27 @@ +name: "Nix Flake Check" + +jobs: + build-test: + name: "Build & test" + 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 diff --git a/flake.nix b/flake.nix index 05afacd8af7..854cce053b4 100644 --- a/flake.nix +++ b/flake.nix @@ -98,6 +98,8 @@ with pkgs.lib.attrsets; mapAttrs' (name: value: nameValuePair (s + name) value) attrs; + addWerror = x: x.override { ghcOptions = [ "-Werror" ]; }; + in rec { legacyPackages = hsPkgs; @@ -133,6 +135,15 @@ src = self; exe = "${packages.plutus-merkle-tree-tests}/bin/tests"; }; + hydra-cardano-api-werror = addWerror hsPkgs.hydra-cardano-api.components.library; + hydra-cluster-werror = addWerror hsPkgs.hydra-cluster.components.library; + hydra-chain-observer-werror = addWerror hsPkgs.hydra-chain-observer.components.exes.hydra-chain-observer; + hydra-plutus-werror = addWerror hsPkgs.hydra-plutus.components.library; + hydra-plutus-tests-werror = addWerror hsPkgs.hydra-plutus.components.exes.tests; + hydra-node-werror = addWerror hsPkgs.hydra-node.components.library; + hydra-node-tests-werror = addWerror hsPkgs.hydra-node.components.tests.tests; + hydra-tui-werror = addWerror hsPkgs.hydra-tui.components.library; + hydra-tui-tests-werror = addWerror hsPkgs.hydra-tui.components.tests.tests; } // (if pkgs.stdenv.isLinux then { diff --git a/hydra-cluster/hydra-cluster.cabal b/hydra-cluster/hydra-cluster.cabal index 4d326c6f8c3..c568cf8b24f 100644 --- a/hydra-cluster/hydra-cluster.cabal +++ b/hydra-cluster/hydra-cluster.cabal @@ -85,7 +85,7 @@ library build-depends: , aeson , async - , base >=4.7 && <5 + , base >=4.7 && <5 , bytestring , cardano-slotting , containers @@ -103,7 +103,6 @@ library , lens , lens-aeson , optparse-applicative - , plutus-ledger-api:plutus-ledger-api-testlib >=1.9.1.0 , process , QuickCheck , req diff --git a/hydra-node/test/Hydra/Model/Payment.hs b/hydra-node/test/Hydra/Model/Payment.hs index 6be421cc140..b5ef6dab88f 100644 --- a/hydra-node/test/Hydra/Model/Payment.hs +++ b/hydra-node/test/Hydra/Model/Payment.hs @@ -86,6 +86,7 @@ instance IsTx Payment where type UTxOType Payment = [(CardanoSigningKey, Value)] type ValueType Payment = Value txId = error "undefined" + txSpendingUTxO = error "undefined" balance = foldMap snd hashUTxO = encodeUtf8 . show @Text