From a8c2f1aac78cbc6bf32a8ce256121f4500203908 Mon Sep 17 00:00:00 2001 From: Justin Kilpatrick Date: Thu, 25 Apr 2024 10:17:11 -0400 Subject: [PATCH] Remove contract compile in Makefile Now that we are checking in the compiled contract definition we no longer need to compile the contract on each make. --- .github/workflows/go.yml | 32 ++---------------------------- Makefile | 42 ++++------------------------------------ 2 files changed, 6 insertions(+), 68 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3f57bf55..61d4eef1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,20 +20,12 @@ jobs: go-version: ^1.16 - name: Check out code uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Configure node for CI - run: cd solidity && npm ci - - name: Precompile Solidity contracts - run: cd solidity && npm run typechain - name: Build the Althea-L1 binary run: make lint: name: Lint runs-on: ubuntu-latest - needs: Build + needs: build steps: - name: Set up Go 1.x uses: actions/setup-go@v2 @@ -43,38 +35,18 @@ jobs: uses: actions/checkout@v2 - name: Install golangci-lint run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: ${{ job.build.strategy.matrix.node-version }} - - name: Configure node for CI - run: cd solidity && npm ci - - name: Precompile Solidity contracts - run: cd solidity && npm run typechain - - name: Format solidity contracts for Go - run: make contracts-auto - name: Run golangci-lint run: golangci-lint run -c .golangci.yml --disable-all --timeout=30m && go mod verify test: name: Test runs-on: ubuntu-latest - needs: Build + needs: build steps: - name: Set up Go 1.x uses: actions/setup-go@v2 with: go-version: ^1.16 - uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: ${{ job.build.strategy.matrix.node-version }} - - name: Configure node for CI - run: cd solidity && npm ci - - name: Precompile Solidity contracts - run: cd solidity && npm run typechain - - name: Format solidity contracts for Go - run: make contracts-auto - name: Test run: go test ./... -mod=readonly -timeout 30m -coverprofile=profile.out -covermode=atomic -race diff --git a/Makefile b/Makefile index 51a4cca4..6bda35ae 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ all: install install: go.sum install-core # does not run go mod verify -install-core: contracts-auto +install-core: export GOFLAGS='-buildmode=pie' export CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2" export CGO_LDFLAGS="-Wl,-z,relro,-z,now -fstack-protector" @@ -67,11 +67,11 @@ go.sum: go.mod @echo "--> Ensure dependencies have not been modified" GO111MODULE=on go mod verify -test: contracts-auto +test: @go test -mod=readonly $(PACKAGES) # look into .golangci.yml for enabling / disabling linters -lint: contracts-auto +lint: @echo "--> Running linter" @golangci-lint run @go mod verify @@ -218,45 +218,11 @@ $(BUILD_TARGETS): go.sum $(BUILDDIR)/ $(BUILDDIR)/: mkdir -p $(BUILDDIR)/ -############################################################################### -### EVM Contracts ### -############################################################################### - -COMPILED_CONTRACTS_GO_OUTPUT := contracts/compiled/ - -contracts: contracts-go - -contracts-clean: - @echo "Deleting and recreating compiled-contracts directory" - @rm -fr $(COMPILED_CONTRACTS_GO_OUTPUT) - @mkdir -p ${COMPILED_CONTRACTS_GO_OUTPUT} - -contracts-go: - @echo "Formatting compiled contracts and placing in compiled-contracts" - @cd solidity; npm install - @cd solidity; npx hardhat compile - @scripts/compile-contracts-for-go.sh - -# Detects if the contracts must be compiled for Go, and potentially does so -# If you need to overwrite the compiled-for-go contracts, use contracts instead -# since that will clean then compile -# Note that this depends on the solidity contracts being compiled already via hardhat -contracts-auto: -ifeq ("$(ls ${COMPILED_CONTRACTS_GO_OUTPUT})", "") - @echo "Compiled contracts folder is empty, compiling now" - @cd solidity; npm install - @cd solidity; npm run typechain - @scripts/compile-contracts-for-go.sh -else - @echo "Detected compiled contract interfaces for Go" -endif - - ############################################################################### ### MISC DIRECTIVES ### ############################################################################### tools: proto-tools buf -clean: proto-tools-clean contracts-clean +clean: proto-tools-clean rm -rf $(BUILDDIR)/ artifacts/