diff --git a/.github/workflows/check-cabal-gild.yml b/.github/workflows/check-cabal-gild.yml new file mode 100644 index 0000000000..9e8d24d7a9 --- /dev/null +++ b/.github/workflows/check-cabal-gild.yml @@ -0,0 +1,53 @@ +name: Check cabal-gild format + +on: + merge_group: + pull_request: + +# When pushing branches (and/or updating PRs), we do want to cancel previous +# build runs. We assume they are stale now; and do not want to spend CI time and +# resources on continuing to continue those runs. This is what the concurrency.group +# value lets us express. When using merge queues, we now have to consider +# - runs triggers by commits per pull-request +# we want to cancel any previous run. So they should all get the same group (per PR) +# - runs refs/heads/gh-readonly-queue/ (they should all get their +# unique git ref, we don't want to cancel any of the ones in the queue) +# - if it's neither, we fall back to the run_id (this is a unique number for each +# workflow run; it does not change if you "rerun" a job) +concurrency: + group: ${{ github.workflow }}-${{ github.event.type }}-${{ startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.ref || github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + check-cabal-gild: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + env: + CARDANO_GUILD_VERSION: "1.3.1.2" + + steps: + - name: Download cardano-gild + run: | + cardano_gild_path="$(mktemp -d)" + version="${{env.CARDANO_GUILD_VERSION}}" + curl -sL \ + "https://github.com/tfausak/cabal-gild/releases/download/$version/cabal-gild-$version-linux-x64.tar.gz" \ + | tar -C "$cardano_gild_path" -xz + + echo "PATH=$cardano_gild_path:$PATH" >> "$GITHUB_ENV" + + - uses: actions/checkout@v3 + + - name: Run cardano-gild over all modified files + run: | + git add . + git stash + git fetch origin ${{ github.base_ref }} --unshallow + for x in $(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}..HEAD "*.cabal" | tr '\n' ' '); do + cabal-gild -i "$x" -o "$x" + done + git --no-pager diff --exit-code + diff --git a/cardano-api-gen/cardano-api-gen.cabal b/cardano-api-gen/cardano-api-gen.cabal index a63830ddea..84626b5815 100644 --- a/cardano-api-gen/cardano-api-gen.cabal +++ b/cardano-api-gen/cardano-api-gen.cabal @@ -1,47 +1,51 @@ cabal-version: 3.0 +name: cardano-api-gen +version: 8.2.1.0 +synopsis: Generators for the cardano api +description: Generators for the cardano api. +category: + Cardano, + API, + Test, -name: cardano-api-gen -version: 8.2.1.0 -synopsis: Generators for the cardano api -description: Generators for the cardano api. -category: Cardano, - API, - Test, -copyright: 2020-2023 Input Output Global Inc (IOG). -author: IOHK -maintainer: operations@iohk.io -license: Apache-2.0 -license-files: LICENSE - NOTICE -build-type: Simple -extra-source-files: README.md, CHANGELOG.md +copyright: 2020-2023 Input Output Global Inc (IOG). +author: IOHK +maintainer: operations@iohk.io +license: Apache-2.0 +license-files: + LICENSE + NOTICE -common project-config - default-language: Haskell2010 - default-extensions: OverloadedStrings - build-depends: base >= 4.14 && < 4.20 +build-type: Simple +extra-source-files: + CHANGELOG.md + README.md - ghc-options: -Wall - -Wcompat - -Wincomplete-record-updates - -Wincomplete-uni-patterns - -Wpartial-fields - -Wredundant-constraints - -Wunused-packages +common project-config + default-language: Haskell2010 + default-extensions: OverloadedStrings + build-depends: base >=4.14 && <4.20 + ghc-options: + -Wall + -Wcompat + -Wincomplete-record-updates + -Wincomplete-uni-patterns + -Wpartial-fields + -Wredundant-constraints + -Wunused-packages library - import: project-config - - build-depends: cardano-api:gen - - hs-source-dirs: src + import: project-config + build-depends: cardano-api:gen + hs-source-dirs: src -- These modules should match those in cardano-api:gen - exposed-modules: Test.Gen.Cardano.Api.Empty - reexported-modules: Test.Gen.Cardano.Api - , Test.Gen.Cardano.Api.Metadata - , Test.Gen.Cardano.Api.ProtocolParameters - , Test.Gen.Cardano.Api.Typed - , Test.Gen.Cardano.Crypto.Seed - , Test.Hedgehog.Golden.ErrorMessage - , Test.Hedgehog.Roundtrip.Bech32 - , Test.Hedgehog.Roundtrip.CBOR + exposed-modules: Test.Gen.Cardano.Api.Empty + reexported-modules: + Test.Gen.Cardano.Api, + Test.Gen.Cardano.Api.Metadata, + Test.Gen.Cardano.Api.ProtocolParameters, + Test.Gen.Cardano.Api.Typed, + Test.Gen.Cardano.Crypto.Seed, + Test.Hedgehog.Golden.ErrorMessage, + Test.Hedgehog.Roundtrip.Bech32, + Test.Hedgehog.Roundtrip.CBOR, diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 7197b3393a..3a8484c2fa 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -1,409 +1,411 @@ cabal-version: 3.4 - -name: cardano-api -version: 9.0.0.0 -synopsis: The cardano API -description: The cardano API. -category: Cardano, - API, -copyright: 2020-2023 Input Output Global Inc (IOG). -author: IOHK -maintainer: operations@iohk.io -license: Apache-2.0 -license-files: LICENSE - NOTICE -build-type: Simple -extra-doc-files: README.md, CHANGELOG.md +name: cardano-api +version: 9.0.0.0 +synopsis: The cardano API +description: The cardano API. +category: + Cardano, + API, + +copyright: 2020-2023 Input Output Global Inc (IOG). +author: IOHK +maintainer: operations@iohk.io +license: Apache-2.0 +license-files: + LICENSE + NOTICE + +build-type: Simple +extra-doc-files: + CHANGELOG.md + README.md common project-config - default-language: Haskell2010 - default-extensions: OverloadedStrings - build-depends: base >= 4.14 && < 4.20 - - ghc-options: -Wall - -Wcompat - -Wincomplete-record-updates - -Wincomplete-uni-patterns - -Wno-unticked-promoted-constructors - -Wpartial-fields - -Wredundant-constraints - -Wunused-packages + default-language: Haskell2010 + default-extensions: OverloadedStrings + build-depends: base >=4.14 && <4.20 + ghc-options: + -Wall + -Wcompat + -Wincomplete-record-updates + -Wincomplete-uni-patterns + -Wno-unticked-promoted-constructors + -Wpartial-fields + -Wredundant-constraints + -Wunused-packages if impl(ghc < 9) - ghc-options: -Wno-incomplete-patterns + ghc-options: -Wno-incomplete-patterns common maybe-unix if !os(windows) - build-depends: unix + build-depends: unix common maybe-Win32 if os(windows) - build-depends: Win32 + build-depends: Win32 common text - if impl(ghc == 8.10.7) && os(darwin) && arch(aarch64) - build-depends: text >= 1.2.5.0 + if impl(ghc == 8.10.7)&& os(darwin)&& arch(aarch64) + build-depends: text >=1.2.5.0 else - build-depends: text >= 2.0 + build-depends: text >=2.0 library internal - import: project-config, maybe-unix, maybe-Win32, text - - visibility: public - - hs-source-dirs: internal - + import: project-config, maybe-unix, maybe-Win32, text + visibility: public + hs-source-dirs: internal -- Do not expose any additional modules. The correct way -- to expose new functionality is via Cardano.Api or -- Cardano.Api.Shelley - exposed-modules: Cardano.Api.Address - Cardano.Api.Anchor - Cardano.Api.Block - Cardano.Api.Certificate - Cardano.Api.Convenience.Construction - Cardano.Api.Convenience.Query - Cardano.Api.DeserialiseAnyOf - Cardano.Api.DRepMetadata - Cardano.Api.Eon.AllegraEraOnwards - Cardano.Api.Eon.AlonzoEraOnwards - Cardano.Api.Eon.BabbageEraOnwards - Cardano.Api.Eon.ByronToAlonzoEra - Cardano.Api.Eon.ConwayEraOnwards - Cardano.Api.Eon.MaryEraOnwards - Cardano.Api.Eon.ShelleyBasedEra - Cardano.Api.Eon.ShelleyEraOnly - Cardano.Api.Eon.ShelleyToAllegraEra - Cardano.Api.Eon.ShelleyToAlonzoEra - Cardano.Api.Eon.ShelleyToBabbageEra - Cardano.Api.Eon.ShelleyToMaryEra - Cardano.Api.Eras - Cardano.Api.Eras.Case - Cardano.Api.Eras.Core - Cardano.Api.Error - Cardano.Api.Feature - Cardano.Api.Fees - Cardano.Api.Genesis - Cardano.Api.GenesisParameters - Cardano.Api.Governance.Actions.ProposalProcedure - Cardano.Api.Governance.Actions.VotingProcedure - Cardano.Api.Governance.Poll - Cardano.Api.Hash - Cardano.Api.HasTypeProxy - Cardano.Api.InMode - Cardano.Api.IO - Cardano.Api.IO.Base - Cardano.Api.IO.Compat - Cardano.Api.IO.Compat.Posix - Cardano.Api.IO.Compat.Win32 - Cardano.Api.IPC - Cardano.Api.IPC.Monad - Cardano.Api.IPC.Version - Cardano.Api.Json - Cardano.Api.Keys.Byron - Cardano.Api.Keys.Class - Cardano.Api.Keys.Praos - Cardano.Api.Keys.Read - Cardano.Api.Keys.Shelley - Cardano.Api.Ledger.Lens - Cardano.Api.LedgerState - Cardano.Api.LedgerEvents.ConvertLedgerEvent - Cardano.Api.LedgerEvents.Rule.BBODY.DELEGS - Cardano.Api.LedgerEvents.Rule.BBODY.LEDGER - Cardano.Api.LedgerEvents.Rule.TICK.NEWEPOCH - Cardano.Api.LedgerEvents.Rule.TICK.RUPD - Cardano.Api.LedgerEvents.Rule.BBODY.UTXOW - Cardano.Api.LedgerEvents.LedgerEvent - Cardano.Api.Modes - Cardano.Api.Monad.Error - Cardano.Api.NetworkId - Cardano.Api.OperationalCertificate - Cardano.Api.Pretty - Cardano.Api.Protocol - Cardano.Api.Protocol.Version - Cardano.Api.ProtocolParameters - Cardano.Api.Query - Cardano.Api.Query.Expr - Cardano.Api.Query.Types - Cardano.Api.ReexposeLedger - Cardano.Api.ReexposeNetwork - Cardano.Api.Rewards - Cardano.Api.Script - Cardano.Api.ScriptData - Cardano.Api.SerialiseBech32 - Cardano.Api.SerialiseCBOR - Cardano.Api.SerialiseJSON - Cardano.Api.SerialiseLedgerCddl - Cardano.Api.SerialiseRaw - Cardano.Api.SerialiseTextEnvelope - Cardano.Api.SerialiseUsing - Cardano.Api.SpecialByron - Cardano.Api.StakePoolMetadata - Cardano.Api.Tx.Body - Cardano.Api.Tx.Sign - Cardano.Api.TxIn - Cardano.Api.TxMetadata - Cardano.Api.Utils - Cardano.Api.Value - Cardano.Api.ValueParser - Cardano.Api.Via.ShowOf - -- TODO: Eliminate in the future when - -- we create wrapper types for the ledger types - -- in this module - Cardano.Api.Orphans - - build-depends: aeson >= 1.5.6.0 - , aeson-pretty >= 0.8.5 - , attoparsec - , base16-bytestring >= 1.0 - , base58-bytestring - , bech32 >= 1.1.0 - , bytestring - , cardano-binary - , cardano-crypto - , cardano-crypto-class ^>= 2.1.2 - , cardano-crypto-wrapper ^>= 1.5 - , cardano-data >= 1.0 - , cardano-ledger-alonzo >= 1.10 - , cardano-ledger-allegra >= 1.5 - , cardano-ledger-api ^>= 1.9.2 - , cardano-ledger-babbage >= 1.8.2 - , cardano-ledger-binary ^>= 1.3.3 - , cardano-ledger-byron >= 1.0.1 - , cardano-ledger-conway >= 1.16 - , cardano-ledger-core:{cardano-ledger-core, testlib} >= 1.13.2 - , cardano-ledger-mary >= 1.6.1 - , cardano-ledger-shelley >= 1.12 - , cardano-protocol-tpraos >= 1.2 - , cardano-slotting >= 0.2.0.0 - , cardano-strict-containers >= 0.1 - , cborg - , containers - , contra-tracer - , data-default-class - , deepseq - , directory - , either - , errors - , FailT - , filepath - , formatting - , groups - , iproute - , memory - , microlens - , mtl - , network - , optparse-applicative-fork - , ouroboros-consensus ^>= 0.20 - , ouroboros-consensus-cardano ^>= 0.18 - , ouroboros-consensus-diffusion ^>= 0.17 - , ouroboros-consensus-protocol ^>= 0.9.0.1 - , ouroboros-network - , ouroboros-network-api ^>= 0.7.3 - , ouroboros-network-framework - , ouroboros-network-protocols - , parsec - , plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>= 1.30 - , prettyprinter - , prettyprinter-ansi-terminal - , prettyprinter-configurable ^>= 1.30 - , random - , safe-exceptions - , scientific - , serialise - , small-steps ^>= 1.1 - , sop-core - , stm - , strict-sop-core - , time - , transformers - , transformers-except ^>= 0.1.3 - , typed-protocols ^>= 0.1.1 - , unordered-containers >= 0.2.11 - , vector - , yaml + exposed-modules: + Cardano.Api.Address + Cardano.Api.Anchor + Cardano.Api.Block + Cardano.Api.Certificate + Cardano.Api.Convenience.Construction + Cardano.Api.Convenience.Query + Cardano.Api.DeserialiseAnyOf + Cardano.Api.DRepMetadata + Cardano.Api.Eon.AllegraEraOnwards + Cardano.Api.Eon.AlonzoEraOnwards + Cardano.Api.Eon.BabbageEraOnwards + Cardano.Api.Eon.ByronToAlonzoEra + Cardano.Api.Eon.ConwayEraOnwards + Cardano.Api.Eon.MaryEraOnwards + Cardano.Api.Eon.ShelleyBasedEra + Cardano.Api.Eon.ShelleyEraOnly + Cardano.Api.Eon.ShelleyToAllegraEra + Cardano.Api.Eon.ShelleyToAlonzoEra + Cardano.Api.Eon.ShelleyToBabbageEra + Cardano.Api.Eon.ShelleyToMaryEra + Cardano.Api.Eras + Cardano.Api.Eras.Case + Cardano.Api.Eras.Core + Cardano.Api.Error + Cardano.Api.Feature + Cardano.Api.Fees + Cardano.Api.Genesis + Cardano.Api.GenesisParameters + Cardano.Api.Governance.Actions.ProposalProcedure + Cardano.Api.Governance.Actions.VotingProcedure + Cardano.Api.Governance.Poll + Cardano.Api.Hash + Cardano.Api.HasTypeProxy + Cardano.Api.InMode + Cardano.Api.IO + Cardano.Api.IO.Base + Cardano.Api.IO.Compat + Cardano.Api.IO.Compat.Posix + Cardano.Api.IO.Compat.Win32 + Cardano.Api.IPC + Cardano.Api.IPC.Monad + Cardano.Api.IPC.Version + Cardano.Api.Json + Cardano.Api.Keys.Byron + Cardano.Api.Keys.Class + Cardano.Api.Keys.Praos + Cardano.Api.Keys.Read + Cardano.Api.Keys.Shelley + Cardano.Api.Ledger.Lens + Cardano.Api.LedgerState + Cardano.Api.LedgerEvents.ConvertLedgerEvent + Cardano.Api.LedgerEvents.Rule.BBODY.DELEGS + Cardano.Api.LedgerEvents.Rule.BBODY.LEDGER + Cardano.Api.LedgerEvents.Rule.TICK.NEWEPOCH + Cardano.Api.LedgerEvents.Rule.TICK.RUPD + Cardano.Api.LedgerEvents.Rule.BBODY.UTXOW + Cardano.Api.LedgerEvents.LedgerEvent + Cardano.Api.Modes + Cardano.Api.Monad.Error + Cardano.Api.NetworkId + Cardano.Api.OperationalCertificate + Cardano.Api.Pretty + Cardano.Api.Protocol + Cardano.Api.Protocol.Version + Cardano.Api.ProtocolParameters + Cardano.Api.Query + Cardano.Api.Query.Expr + Cardano.Api.Query.Types + Cardano.Api.ReexposeLedger + Cardano.Api.ReexposeNetwork + Cardano.Api.Rewards + Cardano.Api.Script + Cardano.Api.ScriptData + Cardano.Api.SerialiseBech32 + Cardano.Api.SerialiseCBOR + Cardano.Api.SerialiseJSON + Cardano.Api.SerialiseLedgerCddl + Cardano.Api.SerialiseRaw + Cardano.Api.SerialiseTextEnvelope + Cardano.Api.SerialiseUsing + Cardano.Api.SpecialByron + Cardano.Api.StakePoolMetadata + Cardano.Api.Tx.Body + Cardano.Api.Tx.Sign + Cardano.Api.TxIn + Cardano.Api.TxMetadata + Cardano.Api.Utils + Cardano.Api.Value + Cardano.Api.ValueParser + Cardano.Api.Via.ShowOf + Cardano.Api.Orphans -- TODO: Eliminate in the future when we create wrapper types for the ledger types in this module + + build-depends: + FailT, + aeson >=1.5.6.0, + aeson-pretty >=0.8.5, + attoparsec, + base16-bytestring >=1.0, + base58-bytestring, + bech32 >=1.1.0, + bytestring, + cardano-binary, + cardano-crypto, + cardano-crypto-class ^>=2.1.2, + cardano-crypto-wrapper ^>=1.5, + cardano-data >=1.0, + cardano-ledger-allegra >=1.5, + cardano-ledger-alonzo >=1.10, + cardano-ledger-api ^>=1.9.2, + cardano-ledger-babbage >=1.8.2, + cardano-ledger-binary ^>=1.3.3, + cardano-ledger-byron >=1.0.1, + cardano-ledger-conway >=1.16, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.13.2, + cardano-ledger-mary >=1.6.1, + cardano-ledger-shelley >=1.12, + cardano-protocol-tpraos >=1.2, + cardano-slotting >=0.2.0.0, + cardano-strict-containers >=0.1, + cborg, + containers, + contra-tracer, + data-default-class, + deepseq, + directory, + either, + errors, + filepath, + formatting, + groups, + iproute, + memory, + microlens, + mtl, + network, + optparse-applicative-fork, + ouroboros-consensus ^>=0.20, + ouroboros-consensus-cardano ^>=0.18, + ouroboros-consensus-diffusion ^>=0.17, + ouroboros-consensus-protocol ^>=0.9.0.1, + ouroboros-network, + ouroboros-network-api ^>=0.7.3, + ouroboros-network-framework, + ouroboros-network-protocols, + parsec, + plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.30, + prettyprinter, + prettyprinter-ansi-terminal, + prettyprinter-configurable ^>=1.30, + random, + safe-exceptions, + scientific, + serialise, + small-steps ^>=1.1, + sop-core, + stm, + strict-sop-core, + time, + transformers, + transformers-except ^>=0.1.3, + typed-protocols ^>=0.1.1, + unordered-containers >=0.2.11, + vector, + yaml, library - import: project-config - - hs-source-dirs: src - + import: project-config + hs-source-dirs: src -- Do not expose any additional modules. The correct way -- to expose new functionality is via Cardano.Api or -- Cardano.Api.Shelley - exposed-modules: Cardano.Api - Cardano.Api.Byron - Cardano.Api.ChainSync.Client - Cardano.Api.ChainSync.ClientPipelined - Cardano.Api.Crypto.Ed25519Bip32 - Cardano.Api.Experimental - Cardano.Api.Shelley - -- TODO: Eliminate Cardano.Api.Ledger when - -- cardano-api only depends on modules - -- exposed by cardano-api-ledger - Cardano.Api.Ledger - Cardano.Api.Network - - reexported-modules: Cardano.Api.Ledger.Lens - - build-depends: bytestring - , cardano-api:internal - , cardano-binary - , cardano-crypto - , cardano-crypto-class ^>= 2.1.2 - , cryptonite - , deepseq - , memory - , nothunks - , ouroboros-network-protocols - , typed-protocols ^>= 0.1.1 + exposed-modules: + Cardano.Api + Cardano.Api.Byron + Cardano.Api.ChainSync.Client + Cardano.Api.ChainSync.ClientPipelined + Cardano.Api.Crypto.Ed25519Bip32 + Cardano.Api.Experimental + Cardano.Api.Shelley -- TODO: Eliminate Cardano.Api.Ledger when cardano-api only depends on modules exposed by cardano-api-ledger + Cardano.Api.Ledger + Cardano.Api.Network + + reexported-modules: Cardano.Api.Ledger.Lens + build-depends: + bytestring, + cardano-api:internal, + cardano-binary, + cardano-crypto, + cardano-crypto-class ^>=2.1.2, + cryptonite, + deepseq, + memory, + nothunks, + ouroboros-network-protocols, + typed-protocols ^>=0.1.1, library gen - import: project-config - - visibility: public - - hs-source-dirs: gen - - exposed-modules: Test.Gen.Cardano.Api - Test.Gen.Cardano.Api.Byron - Test.Gen.Cardano.Api.Era - Test.Gen.Cardano.Api.Metadata - Test.Gen.Cardano.Api.Typed - Test.Gen.Cardano.Api.ProtocolParameters - Test.Gen.Cardano.Crypto.Seed - Test.Hedgehog.Golden.ErrorMessage - Test.Hedgehog.Roundtrip.Bech32 - Test.Hedgehog.Roundtrip.CBOR - - build-depends: aeson >= 1.5.6.0 - , base16-bytestring - , bytestring - , cardano-api - , cardano-api:internal - , cardano-binary >= 1.6 && < 1.8 - , cardano-crypto-class ^>= 2.1.2 - , cardano-crypto-test ^>= 1.5 - , cardano-data - , cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib} >= 1.8.1 - , cardano-ledger-byron-test >= 1.5 - , cardano-ledger-core:{cardano-ledger-core, testlib} >= 1.8 - , cardano-ledger-shelley >= 1.7.0 - , cardano-ledger-conway:testlib >= 1.10.0 - , containers - , filepath - , hedgehog >= 1.1 - , hedgehog-extras - , hedgehog-quickcheck - , QuickCheck - , tasty - , tasty-hedgehog - , text + import: project-config + visibility: public + hs-source-dirs: gen + exposed-modules: + Test.Gen.Cardano.Api + Test.Gen.Cardano.Api.Byron + Test.Gen.Cardano.Api.Era + Test.Gen.Cardano.Api.Metadata + Test.Gen.Cardano.Api.ProtocolParameters + Test.Gen.Cardano.Api.Typed + Test.Gen.Cardano.Crypto.Seed + Test.Hedgehog.Golden.ErrorMessage + Test.Hedgehog.Roundtrip.Bech32 + Test.Hedgehog.Roundtrip.CBOR + + build-depends: + QuickCheck, + aeson >=1.5.6.0, + base16-bytestring, + bytestring, + cardano-api, + cardano-api:internal, + cardano-binary >=1.6 && <1.8, + cardano-crypto-class ^>=2.1.2, + cardano-crypto-test ^>=1.5, + cardano-data, + cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib} >=1.8.1, + cardano-ledger-byron-test >=1.5, + cardano-ledger-conway:testlib >=1.10.0, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.8, + cardano-ledger-shelley >=1.7.0, + containers, + filepath, + hedgehog >=1.1, + hedgehog-extras, + hedgehog-quickcheck, + tasty, + tasty-hedgehog, + text, test-suite cardano-api-test - import: project-config - hs-source-dirs: test/cardano-api-test - main-is: cardano-api-test.hs - type: exitcode-stdio-1.0 - - build-depends: aeson >= 1.5.6.0 - , bytestring - , cardano-api - , cardano-api:gen - , cardano-api:internal - , cardano-binary - , cardano-crypto - , cardano-crypto-class ^>= 2.1.2 - , cardano-crypto-test ^>= 1.5 - , cardano-crypto-tests ^>= 2.1 - , cardano-ledger-api ^>= 1.9 - , cardano-ledger-binary - , cardano-ledger-core:{cardano-ledger-core, testlib} >= 1.8 - , cardano-protocol-tpraos - , cardano-slotting - , containers - , directory - , hedgehog >= 1.1 - , hedgehog-extras - , hedgehog-quickcheck - , interpolatedstring-perl6 - , mtl - , ouroboros-consensus - , ouroboros-consensus-cardano - , ouroboros-consensus-protocol - , ouroboros-network-api - , QuickCheck - , tasty - , tasty-hedgehog - , tasty-quickcheck - , time - - other-modules: Test.Cardano.Api.Crypto - Test.Cardano.Api.EpochLeadership - Test.Cardano.Api.Eras - Test.Cardano.Api.IO - Test.Cardano.Api.Json - Test.Cardano.Api.KeysByron - Test.Cardano.Api.Ledger - Test.Cardano.Api.Metadata - Test.Cardano.Api.ProtocolParameters - Test.Cardano.Api.Typed.Address - Test.Cardano.Api.Typed.Bech32 - Test.Cardano.Api.Typed.CBOR - Test.Cardano.Api.Typed.Envelope - Test.Cardano.Api.Typed.JSON - Test.Cardano.Api.Typed.Ord - Test.Cardano.Api.Typed.Orphans - Test.Cardano.Api.Typed.RawBytes - Test.Cardano.Api.Typed.TxBody - Test.Cardano.Api.Typed.Value - - ghc-options: -threaded -rtsopts "-with-rtsopts=-N -T" + import: project-config + hs-source-dirs: test/cardano-api-test + main-is: cardano-api-test.hs + type: exitcode-stdio-1.0 + build-depends: + QuickCheck, + aeson >=1.5.6.0, + bytestring, + cardano-api, + cardano-api:gen, + cardano-api:internal, + cardano-binary, + cardano-crypto, + cardano-crypto-class ^>=2.1.2, + cardano-crypto-test ^>=1.5, + cardano-crypto-tests ^>=2.1, + cardano-ledger-api ^>=1.9, + cardano-ledger-binary, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.8, + cardano-protocol-tpraos, + cardano-slotting, + containers, + directory, + hedgehog >=1.1, + hedgehog-extras, + hedgehog-quickcheck, + interpolatedstring-perl6, + mtl, + ouroboros-consensus, + ouroboros-consensus-cardano, + ouroboros-consensus-protocol, + ouroboros-network-api, + tasty, + tasty-hedgehog, + tasty-quickcheck, + time, + + other-modules: + Test.Cardano.Api.Crypto + Test.Cardano.Api.EpochLeadership + Test.Cardano.Api.Eras + Test.Cardano.Api.IO + Test.Cardano.Api.Json + Test.Cardano.Api.KeysByron + Test.Cardano.Api.Ledger + Test.Cardano.Api.Metadata + Test.Cardano.Api.ProtocolParameters + Test.Cardano.Api.Typed.Address + Test.Cardano.Api.Typed.Bech32 + Test.Cardano.Api.Typed.CBOR + Test.Cardano.Api.Typed.Envelope + Test.Cardano.Api.Typed.JSON + Test.Cardano.Api.Typed.Ord + Test.Cardano.Api.Typed.Orphans + Test.Cardano.Api.Typed.RawBytes + Test.Cardano.Api.Typed.TxBody + Test.Cardano.Api.Typed.Value + + ghc-options: + -threaded + -rtsopts + "-with-rtsopts=-N -T" test-suite cardano-api-golden - import: project-config - - hs-source-dirs: test/cardano-api-golden - main-is: cardano-api-golden.hs - type: exitcode-stdio-1.0 - - build-depends: aeson - , bech32 >= 1.1.0 - , bytestring - , cardano-api - , cardano-api:gen - , cardano-api:internal - , cardano-binary - , cardano-crypto-class ^>= 2.1.2 - , cardano-data >= 1.0 - , cardano-ledger-alonzo - , cardano-ledger-api ^>= 1.9 - , cardano-ledger-babbage >= 1.6.0 - , cardano-ledger-core:{cardano-ledger-core, testlib} >= 1.8 - , cardano-ledger-shelley - , cardano-ledger-shelley-test >= 1.2.0.1 - , cardano-slotting ^>= 0.2.0.0 - , containers - , errors - , filepath - , hedgehog >= 1.1 - , hedgehog-extras ^>= 0.6.1.0 - , microlens - , parsec - , plutus-core ^>= 1.30 - , plutus-ledger-api ^>= 1.30 - , tasty - , tasty-hedgehog - , time - , text - - ghc-options: -threaded -rtsopts "-with-rtsopts=-N -T" - - build-tool-depends: tasty-discover:tasty-discover - - other-modules: Test.Golden.Cardano.Api.Genesis - , Test.Golden.Cardano.Api.Ledger - , Test.Golden.Cardano.Api.Typed.Script - , Test.Golden.Cardano.Api.Value - , Test.Golden.Cardano.Api.ProtocolParameters - , Test.Golden.ErrorsSpec + import: project-config + hs-source-dirs: test/cardano-api-golden + main-is: cardano-api-golden.hs + type: exitcode-stdio-1.0 + build-depends: + aeson, + bech32 >=1.1.0, + bytestring, + cardano-api, + cardano-api:gen, + cardano-api:internal, + cardano-binary, + cardano-crypto-class ^>=2.1.2, + cardano-data >=1.0, + cardano-ledger-alonzo, + cardano-ledger-api ^>=1.9, + cardano-ledger-babbage >=1.6.0, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.8, + cardano-ledger-shelley, + cardano-ledger-shelley-test >=1.2.0.1, + cardano-slotting ^>=0.2.0.0, + containers, + errors, + filepath, + hedgehog >=1.1, + hedgehog-extras ^>=0.6.1.0, + microlens, + parsec, + plutus-core ^>=1.30, + plutus-ledger-api ^>=1.30, + tasty, + tasty-hedgehog, + text, + time, + + ghc-options: + -threaded + -rtsopts + "-with-rtsopts=-N -T" + + build-tool-depends: tasty-discover:tasty-discover + other-modules: + Test.Golden.Cardano.Api.Genesis + Test.Golden.Cardano.Api.Ledger + Test.Golden.Cardano.Api.ProtocolParameters + Test.Golden.Cardano.Api.Typed.Script + Test.Golden.Cardano.Api.Value + Test.Golden.ErrorsSpec diff --git a/flake.nix b/flake.nix index 9ceb599bc0..fd48618510 100644 --- a/flake.nix +++ b/flake.nix @@ -112,6 +112,7 @@ haskell-language-server.src = nixpkgs.haskell-nix.sources."hls-2.6"; hlint = "3.6.1"; stylish-haskell = "0.14.5.0"; + cabal-gild = "1.3.1.2"; }; # and from nixpkgs or other inputs shell.nativeBuildInputs = with nixpkgs; [gh jq yq-go actionlint shellcheck cabal-head]; diff --git a/scripts/githooks/haskell-style-lint b/scripts/githooks/haskell-style-lint index fd52ede1fd..87c34818b6 100755 --- a/scripts/githooks/haskell-style-lint +++ b/scripts/githooks/haskell-style-lint @@ -1,6 +1,7 @@ -#!/bin/sh -# This script validates the staged changes in Haskell files using stylish-haskell and hlint and returns non-zero -# code when there are linting or style issues. +#!/usr/bin/env bash +# This script validates the staged changes in Haskell files using stylish-haskell and hlint, and +# in cabal files using cabal-gild. It returns non-zero code when there are linting +# or style issues. # # To set this script as your pre-commit hook, use the following command: # @@ -18,6 +19,10 @@ for x in $(git diff --staged --name-only --diff-filter=ACM "*.hs" | tr '\n' ' ') hlint "$x" || hlint_rc="1" done +for x in $(git diff --staged --name-only --diff-filter=ACM "*.cabal" | tr '\n' ' '); do + cabal-gild -i "$x" -o "$x" +done + # fail if there are style issues git --no-pager diff --exit-code || exit 1 # if there are no style issue, there could be hlint issues: