From fccadcdfef3da5e38039f2d06ff2323fd9fc2122 Mon Sep 17 00:00:00 2001 From: qd-qd Date: Thu, 30 Nov 2023 15:36:42 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9E=96=20remove=20`make`=20as=20the=20automa?= =?UTF-8?q?tion=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This tool is not common in the Solidity ecosystem and it is not worth to maintain it. --- .github/workflows/quality-checks.yml | 4 +- .github/workflows/release-package.yml | 2 +- .gitignore | 3 - lefthook.yml | 8 +- makefile | 154 -------------------------- 5 files changed, 7 insertions(+), 164 deletions(-) delete mode 100644 makefile diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 9e52522..21f2014 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -32,7 +32,7 @@ jobs: run: npm ci - name: Run the linter and the formatter in check mode - run: make quality + run: forge fmt --check && npx solhint "{script,src,test}/**/*.sol" - name: Add lint summary run: | @@ -51,7 +51,7 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Compile the contracts and print their size - run: make compile-s + run: forge compile --sizes - name: Add compile summary run: | diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml index 3e26825..704c0bc 100644 --- a/.github/workflows/release-package.yml +++ b/.github/workflows/release-package.yml @@ -39,7 +39,7 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Build the documentation - run: make doc + run: forge doc && forge doc --build - name: Deploy the documentation uses: JamesIves/github-pages-deploy-action@v4 diff --git a/.gitignore b/.gitignore index 70f44fd..4df8988 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,6 @@ broadcast/*/31337/ # coverage generated by genhtml report -# makefile generated files -.make.* - # autogenerated documentation docs diff --git a/lefthook.yml b/lefthook.yml index b9db6f8..9e51f02 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -3,11 +3,11 @@ pre-push: commands: lint: tags: quality - run: make lint + run: forge fmt --check && npx solhint "{script,src,test}/**/*.sol" format: tags: quality - run: make format + run: npx prettier --check "**/*.{json,md,yml}" test: - run: make test + run: forge test build: - run: make compile + run: forge compile diff --git a/makefile b/makefile deleted file mode 100644 index 16f18a4..0000000 --- a/makefile +++ /dev/null @@ -1,154 +0,0 @@ -.SILENT: - -## define the shell function that is used to run commands defined in this file -define shell-functions -: BEGIN -runcmd() { - _cmd=$@; - - script_cmd="script -q /dev/null ${_cmd[@]} >&1"; - script -q /dev/null -c echo 2> /dev/null > /dev/null && script_cmd="script -q /dev/null -c \"${_cmd[@]}\" >&1"; - - printf "\e[90;1m[\e[90;1mmake: \e[0;90;1mcmd\e[0;90;1m]\e[0m \e[0;93;1m➔ \e[97;1m$_cmd\e[0m\n" \ - && ( \ - cmd_output=$(eval "$script_cmd" | tee /dev/tty; exit ${PIPESTATUS[0]}); cmd_exit_code=$?; \ - [ -z "$cmd_output" ] || ([ -z "$(tr -d '[:space:]' <<< $cmd_output)" ] && printf "\e[1A"); \ - [[ "$cmd_exit_code" -eq 0 ]] || return $cmd_exit_code \ - ) \ - && printf "\e[032;1m[✔︎] success\e[0m\n\n" \ - || (_test_exit=$? \ - && printf "\e[031;1m[✖︎] fail (exit code: $_test_exit)\e[0m\n\n" \ - && return $_test_exit) \ - && [ $? -eq 0 ] \ - || return $? -} -: END -endef - -# write the shell function in a git ignored file named .make.functions.sh -$(shell sed -n '/^: BEGIN/,/^: END/p' $(lastword $(MAKEFILE_LIST)) > .make.functions.sh) -SHELL := /bin/bash --init-file .make.functions.sh -i - -# print when running `make` without arguments -default: - printf """\e[37musage:\e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1minstall \e[0;90m➔ \e[32;3minstall the git submodules and the npm dependencies \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mcompile \e[0;90m➔ \e[32;3mcompile the contracts \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mcompile-s \e[0;90m➔ \e[32;3mcompile the contracts and print their size \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mtest \e[0;90m➔ \e[32;3mrun the tests \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mtest-v \e[0;90m➔ \e[32;3mrun the tests in verbose mode \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mgas \e[0;90m➔ \e[32;3mrun the tests and print the gas report \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mcoverage \e[0;90m➔ \e[32;3mrun the tests and print the coverage report \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mclean \e[0;90m➔ \e[32;3mremove the build artifacts and cache directories \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mupdate \e[0;90m➔ \e[32;3mupdate the git submodules and the npm dependencies \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mhooks \e[0;90m➔ \e[32;3mrun the installed git hooks \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mhooks-i \e[0;90m➔ \e[32;3minstall the git hooks defined in lefthook.yml \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mhooks-u \e[0;90m➔ \e[32;3muninstall the git hooks defined in lefthook.yml \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mlint \e[0;90m➔ \e[32;3mrun the linter in check mode \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mlint-fix \e[0;90m➔ \e[32;3mrun the linter in write mode \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mprettier \e[0;90m➔ \e[32;3mrun the formatter in read mode \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mprettier-fix \e[0;90m➔ \e[32;3mrun the formatter in write mode \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mquality \e[0;90m➔ \e[32;3mrun both the linter and the formatter in read mode \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mdoc \e[0;90m➔ \e[32;3mgenerate the documentation of the project \e[0m\n \ - \e[90m$$ \e[0;97;1mmake \e[0;92;1mtree \e[0;90m➔ \e[32;3mdisplay a tree visualization of the project's dependency graph \e[0m\n \ - """ | sed -e 's/^[ \t ]\{1,\}\(.\)/ \1/' - - -########################################## -################ COMMANDS ################ -########################################## -.PHONY: forge-compile -forge-compile: - @runcmd forge compile - -.PHONY: forge-compile-size -forge-compile-size: - @runcmd forge compile --sizes - -.PHONY: forge-test -forge-test: - @runcmd forge test - -.PHONY: forge-test-verbose -forge-test-verbose: - @runcmd forge test -vvvv - -.PHONY: forge-coverage -forge-coverage: - @runcmd forge coverage - -.PHONY: forge-test-gas -forge-test-gas: - @runcmd forge test --gas-report --no-match-test "test(Fuzz)?_RevertWhen_\\w{1,}?" - -.PHONY: forge-clean -clean: - @runcmd forge clean - -.PHONY: forge-doc -forge-doc: - @runcmd forge doc && forge doc --build - -.PHONY: forge-tree -forge-tree: - @runcmd forge tree --no-dedupe - -.PHONY: update-dependencies -update-dependencies: - @runcmd git submodule update --init --recursive && npm update - -.PHONY: install-dependencies -install-dependencies: - @runcmd forge install && npm install - -.PHONY: lefthok-run -lefthok-run: - @runcmd npx lefthook run pre-push - -.PHONY: lefthok-install -lefthok-install: - @runcmd npx lefthook install - -.PHONY: lefthok-uninstall -lefthok-uninstall: - @runcmd npx lefthook uninstall - -.PHONY: linter -linter: - @runcmd forge fmt --check && npx solhint "{script,src,test}/**/*.sol" - -.PHONY: linter-fix -linter-fix: - @runcmd forge fmt && npx solhint "{script,src,test}/**/*.sol" --fix - -.PHONY: prettier -prettier: - @runcmd npx prettier --check \"**/*.{json,md,yml}\" - -.PHONY: prettier-fix -prettier-fix: - @runcmd npx prettier --write \"**/*.{json,md,yml}\" - -########################################## -################ ALIASES ################ -########################################## -build: forge-compile -compile: forge-compile -compile-s: forge-compile-size -test: forge-test -test-v: forge-test-verbose -gas: forge-test-gas -coverage: forge-coverage -clean: forge-clean -update: update-dependencies -doc: forge-doc -tree: forge-tree -hooks: lefthok-run -hooks-i: lefthok-install -hooks-u: lefthok-uninstall -lint: linter -lint-fix: linter-fix -format: prettier -format-fix: prettier-fix -quality: lint format -install: install-dependencies lefthok-install