Skip to content
Draft
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ generation workload -- using the `workbench` environment:
Nix or downloaded from Hydra CI cache directly.
- `-prof` and `-profnix` suffixes -- same as both before, but all
binaries will be built such that GHC profiling is enabled.
- ...there are other modes as per
[lib.mk](https://github.com/intersectmbo/cardano-node/tree/master/lib.mk#L34-L44)
- ...there are other modes (`-auto`, `-autostay`, `-autonix`, `-nomadexec`, ...); see
[nix/workbench/lib.mk](https://github.com/intersectmbo/cardano-node/blob/master/nix/workbench/lib.mk)

3. Enter the workbench shell for the chosen profile & mode:
`make <PROFILE-NAME>` or `make <PROFILE-NAME>-<SUFFIX>` (when there
Expand Down
82 changes: 25 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
help: ## Print documentation
@{ grep -hE '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST); echo -e '$(EXTRA_HELP)'; } | sed 's/^ //' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-33s\033[0m %s\n", $$1, $$2}'
@grep -hE '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sed 's/^ //' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-33s\033[0m %s\n", $$1, $$2}'

include lib.mk
include nix.mk

PROJECT_NAME = cardano-node
NUM_PROC = $(nproc --all)

PROFILE ?= default
## One of: shelley allegra mary alonzo babbage conway dijkstra
ERA ?= conway
BACKEND ?= supervisor
REV ?= master
ITER ?=
BATCH ?=
ARGS ?=
CMD ?=
RUN ?=

lint hlint: ## Run the CI version of hlint
nix build --no-link '.#checks/hlint' --cores 0
haddock-hoogle haddocks hoogle:
Expand Down Expand Up @@ -50,66 +38,46 @@ trace-schemas-validate: ## Validate trace message schemas against meta.schema.js
nix run .#validate-trace-schemas

###
### Workbench
### Workbench: cluster shells
###
## `make shell` (and -nix/-prof/-dev) opens a workbench dev shell for $(PROFILE) -- the usual
## entry point (below). `make <profile>[-VARIANT]` are per-profile aliases; `make ps` lists
## profile names. Targets, flags and the (generated) profile lists all live in
## nix/workbench/lib.mk (which pulls in profiles.mk itself).
include nix/workbench/lib.mk

## Dev shells -- the usual entry point; each runs $(WB_ENTER) (defined in nix/workbench/lib.mk).
shell: ## workbench dev shell for PROFILE (cabal build-on-demand); vars: PROFILE ERA BACKEND CMD RUN
$(WB_ENTER)
shell-nix: ## like shell, but run the Nix-store binary
$(WB_ENTER) --arg useCabalRun false
shell-prof: ## like shell, profiled build, run with -hT
$(WB_ENTER) --arg profiledBuild true --arg profilingType '"space-heap"'
shell-dev:
$(WB_ENTER)
.PHONY: shell shell-nix shell-prof shell-dev

## CI entrypoints (drive the generated variant targets + Nix ci-test):
workbench-ci: workbench-ci-test ci-test-auto ci-test-autonix
CI_TARGETS := hlint workbench-ci haddock-hoogle
ci: ci-report ci-targets
ci-report:
@echo -e "\033[34mGoals under test\033[0m: \033[33m$(CI_TARGETS)\033[0m"
ci-targets: $(CI_TARGETS)

workbench-internals-walkthrough:
emn nix/workbench/doc.org

##
## Base targets:
##
shell: ## Nix shell, (workbench from /nix/store), vars: PROFILE, ERA, CMD, RUN
nix-shell -A 'workbench-shell' --max-jobs 8 --cores 0 --show-trace --argstr profileName ${PROFILE} --argstr eraName ${ERA} --argstr backendName ${BACKEND} ${ARGS} ${if ${CMD},--command "${CMD}"} ${if ${RUN},--run "${RUN}"}
shell-dev shell-prof shell-nix: shell
shell-nix: ARGS += --arg 'useCabalRun' false ## Nix shell, (workbench from Nix store), vars: PROFILE, CMD, RUN
shell-prof: ARGS += --arg 'profiledBuild' true --arg 'profilingType' '"space-heap"' ## Nix shell, everything Haskell built profiled and run with `-hT`.

analyse: RUN := wb analyse std ${TAG}
analyse: shell

list-profiles: ## List workbench profiles
nix build .#all-profiles-json && cat result
show-profile: ## NAME=profile-name
@test -n "${NAME}" || { echo 'HELP: to specify profile to show, add NAME=profle-name' && exit 1; }
nix build .#all-profiles-json --json --option substitute false | jq '.[0].outputs.out' -r | xargs jq ".\"${NAME}\" | if . == null then error(\"\n###\n### Error: unknown profile: ${NAME} Please consult: make list-profiles\n###\") else . end"
ps: ## Plain-text list of profiles
@nix build .#workbench.profile-names-json --json | jq '.[0].outputs.out' -r | xargs jq '.[]' --raw-output

##
## Profile-based cluster shells (autogenerated targets)
##
## wb_profiles.mk is autogenerated by `cardano-profile lib-make`. It contains all known profile families and flavours (minus the era, backend and shell type suffixes).
## After adding or removing profile definitions in `cardano-profile`, you'll probably want to also commit a regenerated version of that file.
##
include wb_profiles.mk

$(eval $(call define_profile_targets, $(LOCAL_PROFILES)))
$(eval $(call define_profile_targets_nomadcloud,$(CLOUD_PROFILES)))

# Dynamic local/supervisor profile targets.
playground-%:
nix-shell -A 'workbench-shell' --max-jobs 8 --cores 0 --show-trace --argstr profileName $* --argstr eraName ${ERA} --argstr backendName supervisor

###
### Misc
###
clean-profile proclean:
rm -f *.html *.prof *.hp *.stats *.eventlog

clean: clean-profile
rm -rf logs/ socket/ cluster.*

full-clean: clean
rm -rf db dist-newstyle $(shell find . -name '*~' -or -name '*.swp')

cls:
echo -en "\ec"

.PHONY: cabal-hashes clean cli cls cluster-profiles help node run-test shell shell-dev stylish-haskell $(LOCAL_PROFILES) workbench-ci-test
.PHONY: help lint hlint host-hlint haddock-hoogle stylish-haskell cabal-hashes cli node \
trace-documentation trace-schemas-regenerate trace-schemas-overrides-check \
trace-schemas-overrides-coverage trace-schemas-validate \
workbench-ci ci ci-report ci-targets \
clean full-clean cls
Loading
Loading