build: add repo_root Makefile for lint&dep_docker (#48)

Co-authored-by: chuhanjin <419436363@qq.com>
Co-authored-by: maskpp <maskpp266@gmail.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
ChuhanJin
2022-10-28 12:05:49 +08:00
committed by GitHub
parent 7893e02bfc
commit e084283684
6 changed files with 46 additions and 2 deletions

3
Jenkinsfile vendored
View File

@@ -31,8 +31,7 @@ pipeline {
//start to build project
sh '''#!/bin/bash
export PATH=/home/ubuntu/go/bin:$PATH
docker build -t scroll_l1geth ./common/docker/l1geth/
docker build -t scroll_l2geth ./common/docker/l2geth/
make dev_docker
make -C bridge mock_abi
make -C bridge bridge
make -C bridge docker

33
Makefile Normal file
View File

@@ -0,0 +1,33 @@
.PHONY: check update dev_docker clean
help: ## Display this help message
@grep -h \
-E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
lint: ## The code's format and security checks.
make -C bridge lint
make -C common lint
make -C coordinator lint
make -C database lint
make -C roller lint
update: ## update dependencies
go work sync
cd $(PWD)/bridge/ && go mod tidy
cd $(PWD)/common/ && go mod tidy
cd $(PWD)/coordinator/ && go mod tidy
cd $(PWD)/database/ && go mod tidy
cd $(PWD)/roller/ && go mod tidy
goimports -local $(PWD)/bridge/ -w .
goimports -local $(PWD)/common/ -w .
goimports -local $(PWD)/coordinator/ -w .
goimports -local $(PWD)/database/ -w .
goimports -local $(PWD)/roller/ -w .
dev_docker: ## build docker images for development/testing usages
docker build -t scroll_l1geth ./common/docker/l1geth/
docker build -t scroll_l2geth ./common/docker/l2geth/.
clean: ## Empty out the bin folder
@rm -rf build/bin

View File

@@ -15,6 +15,9 @@ mock_abi:
bridge: ## Builds the Bridge instance.
go build -o $(PWD)/build/bin/bridge ./cmd
test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
lint: ## Lint the files - used for CI
GOBIN=$(PWD)/build/bin go run ../build/lint.go

View File

@@ -1,4 +1,7 @@
.PHONY: lint
test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
lint: ## Lint the files - used for CI
GOBIN=$(PWD)/build/bin go run ../build/lint.go

View File

@@ -4,6 +4,9 @@ IMAGE_NAME=coordinator
IMAGE_VERSION=latest
REPO_ROOT_DIR=./..
test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
coordinator: ## Builds the Coordinator instance.
go build -o $(PWD)/build/bin/coordinator ./cmd

View File

@@ -1,4 +1,7 @@
.PHONY: lint
test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
lint: ## Lint the files - used for CI
GOBIN=$(PWD)/build/bin go run ../build/lint.go