mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
better ci
This commit is contained in:
parent
f083705e00
commit
eb76df22af
2 changed files with 69 additions and 18 deletions
63
.github/workflows/ci.yml
vendored
63
.github/workflows/ci.yml
vendored
|
|
@ -1,20 +1,53 @@
|
||||||
name: CI
|
name: CI
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-20.04, macos-11 ] # list of os: https://github.com/actions/virtual-environments
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Install Go
|
- run: git submodule update --init --recursive --force
|
||||||
uses: actions/setup-go@v2
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.18.x
|
||||||
- name: "Build binaries"
|
- name: Install dependencies on Linux
|
||||||
run: make all
|
if: runner.os == 'Linux'
|
||||||
- name: "Run tests"
|
run: sudo apt update && sudo apt install build-essential
|
||||||
run: make test
|
|
||||||
- name: Upload coverage to Codecov
|
|
||||||
uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
file: ./cover.out
|
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/Library/Caches/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: ${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make all
|
||||||
|
|
||||||
|
- name: Reproducible build test
|
||||||
|
run: |
|
||||||
|
make geth
|
||||||
|
shasum -a256 ./build/bin/geth > bor1.sha256
|
||||||
|
make geth
|
||||||
|
shasum -a256 ./build/bin/geth > bor2.sha256
|
||||||
|
if ! cmp -s bor1.sha256 bor2.sha256; then
|
||||||
|
echo >&2 "Reproducible build broken"; cat bor1.sha256; cat bor2.sha256; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
with:
|
||||||
|
version: v1.46
|
||||||
|
skip-pkg-cache: true
|
||||||
|
skip-build-cache: true
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make test
|
||||||
|
|
||||||
|
- name: Data race tests
|
||||||
|
run: make test-race
|
||||||
24
Makefile
24
Makefile
|
|
@ -4,11 +4,21 @@
|
||||||
|
|
||||||
.PHONY: geth android ios evm all test clean
|
.PHONY: geth android ios evm all test clean
|
||||||
|
|
||||||
GOBIN = ./build/bin
|
|
||||||
GO ?= latest
|
GO ?= latest
|
||||||
|
GOBIN = $(CURDIR)/build/bin
|
||||||
GORUN = env GO111MODULE=on go run
|
GORUN = env GO111MODULE=on go run
|
||||||
GOPATH = $(shell go env GOPATH)
|
GOPATH = $(shell go env GOPATH)
|
||||||
|
|
||||||
|
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
|
||||||
|
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
GIT_TAG ?= $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`)
|
||||||
|
|
||||||
|
PACKAGE = github.com/ethereum/go-ethereum
|
||||||
|
GO_FLAGS += -trimpath -buildvcs=false
|
||||||
|
GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"
|
||||||
|
|
||||||
|
GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) ./... -p 1 -shuffle=on
|
||||||
|
|
||||||
bor:
|
bor:
|
||||||
$(GORUN) build/ci.go install ./cmd/geth
|
$(GORUN) build/ci.go install ./cmd/geth
|
||||||
mkdir -p $(GOPATH)/bin/
|
mkdir -p $(GOPATH)/bin/
|
||||||
|
|
@ -45,8 +55,16 @@ ios:
|
||||||
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
|
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
|
||||||
|
|
||||||
test:
|
test:
|
||||||
# Skip mobile and cmd tests since they are being deprecated
|
$(GOTEST) --timeout 5m -cover -coverprofile=cover.out
|
||||||
go test -v $$(go list ./... | grep -v go-ethereum/cmd/) -cover -coverprofile=cover.out
|
|
||||||
|
test-race:
|
||||||
|
$(GOTEST) --timeout 5m -race
|
||||||
|
|
||||||
|
test-integration:
|
||||||
|
$(GOTEST) --timeout 30m -tags integration
|
||||||
|
|
||||||
|
escape:
|
||||||
|
cd $(path) && go test -gcflags "-m -m" -run none -bench=BenchmarkJumpdest* -benchmem -memprofile mem.out
|
||||||
|
|
||||||
lint: ## Run linters.
|
lint: ## Run linters.
|
||||||
$(GORUN) build/ci.go lint
|
$(GORUN) build/ci.go lint
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue