better ci

This commit is contained in:
Evgeny Danienko 2022-05-11 10:00:31 +03:00
parent f083705e00
commit eb76df22af
2 changed files with 69 additions and 18 deletions

View file

@ -1,20 +1,53 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
tests:
strategy:
matrix:
os: [ ubuntu-20.04, macos-11 ] # list of os: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: "Build binaries"
run: make all
- name: "Run tests"
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./cover.out
- uses: actions/checkout@v3
- run: git submodule update --init --recursive --force
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- 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

View file

@ -4,11 +4,21 @@
.PHONY: geth android ios evm all test clean
GOBIN = ./build/bin
GO ?= latest
GOBIN = $(CURDIR)/build/bin
GORUN = env GO111MODULE=on go run
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:
$(GORUN) build/ci.go install ./cmd/geth
mkdir -p $(GOPATH)/bin/
@ -45,8 +55,16 @@ ios:
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
test:
# Skip mobile and cmd tests since they are being deprecated
go test -v $$(go list ./... | grep -v go-ethereum/cmd/) -cover -coverprofile=cover.out
$(GOTEST) --timeout 5m -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.
$(GORUN) build/ci.go lint