Skip to content

Commit a8f6d67

Browse files
authored
Merge pull request #93 from mlabs-haskell/marton/hercules-ci
switch to Hercules CI, add checks to flake
2 parents ea23586 + 0011c2c commit a8f6d67

File tree

7 files changed

+49
-111
lines changed

7 files changed

+49
-111
lines changed

.github/format.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/integrate.yaml

Lines changed: 0 additions & 79 deletions
This file was deleted.

Makefile

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ usage:
2525
@echo " ghci -- Run cabal v2-repl bot-plutus-interface"
2626
@echo " format -- Apply source code formatting with fourmolu"
2727
@echo " format_check -- Check source code formatting without making changes"
28-
@echo " nixfmt -- Apply nix formatting with nixfmt"
29-
@echo " nixfmt_check -- Check nix files for format errors"
28+
@echo " cabalfmt -- Apply cabal formatting with cabal-fmt"
29+
@echo " cabalfmt_check -- Check cabal files for formatting errors without making changes"
30+
@echo " nixpkgsfmt -- Apply nix formatting with nixfmt"
31+
@echo " nixpkgsfmt_check -- Check nix files for format errors"
3032
@echo " lint -- Check the sources with hlint"
3133
@echo " readme_contents -- Add table of contents to README"
3234
@echo " update_plutus -- Update plutus version with niv"
@@ -68,7 +70,7 @@ ghci: requires_nix_shell
6870
cabal v2-repl $(GHC_FLAGS) bot-plutus-interface
6971

7072
# Source dirs to run fourmolu on
71-
FORMAT_SOURCES := $(shell git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.hs' )
73+
FORMAT_SOURCES := $(shell fd -e hs)
7274

7375
# Extensions we need to tell fourmolu about
7476
FORMAT_EXTENSIONS := -o -XTemplateHaskell -o -XTypeApplications -o -XImportQualifiedPost -o -XPatternSynonyms -o -fplugin=RecordDotPreprocessor
@@ -81,14 +83,23 @@ format: requires_nix_shell
8183
format_check: requires_nix_shell
8284
fourmolu --mode check --check-idempotence $(FORMAT_EXTENSIONS) $(FORMAT_SOURCES)
8385

86+
# Cabal package definitions
87+
CABAL_SOURCES := $(shell fd -e cabal)
88+
89+
cabalfmt: requires_nix_shell
90+
cabal-fmt --inplace $(CABAL_SOURCES)
91+
92+
cabalfmt_check: requires_nix_shell
93+
cabal-fmt --check $(CABAL_SOURCES)
94+
8495
# Nix files to format
85-
NIX_SOURCES := $(shell git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.nix' )
96+
NIX_SOURCES := $(shell fd -e nix)
8697

87-
nixfmt: requires_nix_shell
88-
nixfmt $(NIX_SOURCES)
98+
nixpkgsfmt: requires_nix_shell
99+
nixpkgs-fmt $(NIX_SOURCES)
89100

90-
nixfmt_check: requires_nix_shell
91-
nixfmt --check $(NIX_SOURCES)
101+
nixpkgsfmt_check: requires_nix_shell
102+
nixpkgsfmt --check $(NIX_SOURCES)
92103

93104
# Check with hlint, currently I couldn't get --refactor to work
94105
lint: requires_nix_shell
@@ -124,4 +135,3 @@ update_plutus:
124135
build_path = dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/bot-plutus-interface-0.1
125136
clear_build:
126137
@[ ! -e $(build_path) ] || rm -rf $(build_path)
127-

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ main = do
8787
, -- | Slot configuration of the network, the default value can be used for the mainnet
8888
pcSlotConfig = def
8989
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
90+
, pcOwnStakePubKeyHash = Nothing
9091
, -- Directory name of the script and data files
9192
pcScriptFileDir = "./scripts"
9293
, -- Directory for the signing key file(s)

bot-plutus-interface.cabal

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@ library
7676
import: common-lang
7777
exposed-modules:
7878
BotPlutusInterface
79+
BotPlutusInterface.Balance
7980
BotPlutusInterface.CardanoCLI
8081
BotPlutusInterface.ChainIndex
8182
BotPlutusInterface.Contract
8283
BotPlutusInterface.Effects
8384
BotPlutusInterface.Files
84-
BotPlutusInterface.Balance
85+
BotPlutusInterface.Helpers
86+
BotPlutusInterface.Server
8587
BotPlutusInterface.Types
8688
BotPlutusInterface.UtxoParser
87-
BotPlutusInterface.Server
88-
BotPlutusInterface.Helpers
89+
8990
build-depends:
9091
, aeson ^>=1.5.0.0
9192
, attoparsec >=0.13.2.2
@@ -145,10 +146,10 @@ test-suite bot-plutus-interface-test
145146
main-is: Spec.hs
146147
ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors
147148
other-modules:
148-
Spec.BotPlutusInterface.Contract
149149
Spec.BotPlutusInterface.Balance
150-
Spec.BotPlutusInterface.UtxoParser
150+
Spec.BotPlutusInterface.Contract
151151
Spec.BotPlutusInterface.Server
152+
Spec.BotPlutusInterface.UtxoParser
152153
Spec.MockContract
153154

154155
build-depends:
@@ -198,8 +199,8 @@ test-suite bot-plutus-interface-test
198199
, tasty-quickcheck
199200
, temporary
200201
, text ^>=1.2.4.0
201-
, uuid
202202
, utf8-string
203+
, uuid
203204
, warp
204205

205206
hs-source-dirs: test

examples/plutus-game/plutus-game.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ library
7676
build-depends:
7777
, aeson ^>=1.5.0.0
7878
, attoparsec >=0.13.2.2
79+
, bot-plutus-interface
7980
, bytestring ^>=0.10.12.0
8081
, cardano-api
8182
, cardano-crypto
8283
, cardano-ledger-alonzo
8384
, containers
84-
, bot-plutus-interface
8585
, data-default
8686
, data-default-class
8787
, directory

flake.nix

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,15 @@
328328
withHoogle = true;
329329
tools.haskell-language-server = {};
330330
exactDeps = true;
331-
nativeBuildInputs = [
332-
pkgs'.cabal-install
333-
pkgs'.haskellPackages.cabal-fmt
334-
pkgs'.haskellPackages.implicit-hie
335-
pkgs'.hlint
336-
pkgs'.haskellPackages.fourmolu
337-
pkgs'.jq
338-
pkgs'.websocat
331+
nativeBuildInputs = with pkgs'; [
332+
cabal-install
333+
haskellPackages.cabal-fmt
334+
haskellPackages.implicit-hie
335+
haskellPackages.fourmolu
336+
hlint
337+
jq
338+
websocat
339+
fd
339340
];
340341
};
341342
modules = haskellModules;
@@ -362,11 +363,21 @@
362363
(nixpkgsFor system).runCommand "combined-check" {
363364
nativeBuildInputs = builtins.attrValues self.checks.${system}
364365
++ builtins.attrValues self.flake.${system}.packages
365-
++ [ self.devShell.${system}.inputDerivation ];
366-
} "touch $out");
366+
++ [ self.devShell.${system}.inputDerivation self.devShell.${system}.nativeBuildInputs ];
367+
} ''
368+
cd ${self}
369+
export LC_CTYPE=C.UTF-8
370+
export LC_ALL=C.UTF-8
371+
export LANG=C.UTF-8
372+
export IN_NIX_SHELL='pure'
373+
make format_check cabalfmt_check nixpkgsfmt_check lint
374+
mkdir $out
375+
'');
367376

368377
# NOTE `nix flake check` will not work at the moment due to use of
369378
# IFD in haskell.nix
370379
checks = perSystem (system: self.flake.${system}.checks);
380+
381+
herculesCI.ciSystems = [ "x86_64-linux" ];
371382
};
372383
}

0 commit comments

Comments
 (0)