Skip to content

Commit d73da60

Browse files
committed
migrate lint and unit tests
1 parent 2b2e892 commit d73da60

File tree

4 files changed

+40
-129
lines changed

4 files changed

+40
-129
lines changed
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on: [push, pull_request]
2+
name: Linting and Unit tests
3+
jobs:
4+
linting_unit_tests:
5+
strategy:
6+
matrix:
7+
go-version: [1.15.x]
8+
os: [ubuntu-latest]
9+
runs-on: ${{ matrix.os }}
10+
defaults:
11+
run:
12+
working-directory: ${{ env.HOME }}/go/src/github.com/${{ github.repository }}
13+
steps:
14+
- name: Set up Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: ${{ matrix.go-version }}
18+
- name: Setup env
19+
run: |
20+
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
21+
- name: Check out code
22+
uses: actions/checkout@v2
23+
with:
24+
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
25+
- name: Install dependencies
26+
run: |
27+
make install-deps
28+
- name: Lint check
29+
run: |
30+
make lint-check gen-swagger
31+
echo "Checking that swagger gen didn't result in a modified git tree" && git diff --exit-code ./http
32+
- name: Unit tests
33+
run: |
34+
go test -race -coverprofile=coverage.txt -covermode=atomic --tags=unit ./...
35+
- name: Upload coverage
36+
run: bash <(curl -s https://codecov.io/bash)

.travis.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,9 @@ install:
4242
jobs:
4343
include:
4444
- stage: "Tests"
45-
name: "Linting"
45+
name: "CMD tests"
4646
script:
47-
- make lint-check gen-swagger generate format-go
48-
- echo "Checking that swagger gen didn't result in a modified git tree" && git diff --exit-code ./http
49-
- stage: "Tests"
50-
name: "Unit and CMD tests"
51-
script:
52-
- ./build/scripts/test_wrapper.sh unit cmd
47+
- ./build/scripts/test_wrapper.sh cmd
5348
after_success:
5449
- bash <(curl -s https://codecov.io/bash)
5550
- stage: "Tests"

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ install-deps: ## Install Dependencies
4141
@go install github.com/ethereum/go-ethereum/cmd/abigen
4242
@go install github.com/karalabe/xgo
4343
@git submodule update --init --recursive
44+
@env
4445
@command -v golangci-lint >/dev/null 2>&1 || (curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin v1.36.0)
4546

4647
lint-check: ## runs linters on go code
4748
@golangci-lint run --skip-dirs=build/* --disable-all --enable=golint --enable=goimports --enable=vet --enable=nakedret \
48-
--enable=unused --skip-dirs=resources --skip-dirs=testingutils ./...;
49+
--enable=unused --skip-dirs=resources --skip-dirs=testingutils --timeout=2m ./...;
4950

5051
format-go: ## formats go code
5152
@golangci-lint run --disable-all --enable=goimports --fix ./...

0 commit comments

Comments
 (0)