Skip to content

Commit

Permalink
Merge pull request #265 from marbar3778/marko/linting
Browse files Browse the repository at this point in the history
ci: add linting & lint fixes
  • Loading branch information
colin-axner authored Jul 14, 2020
2 parents dd05e84 + 9662cc0 commit aaa8fe8
Show file tree
Hide file tree
Showing 40 changed files with 765 additions and 628 deletions.
94 changes: 47 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
name: BUILD - lint, build and binary upload
name: BUILD - build and binary upload

on: [push]

jobs:

build:
name: build
runs-on: ubuntu-latest
steps:

# Install and setup go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

# setup gopath
- name: Set PATH
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash

# # install linter
# - name: install linter
# run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.24.0

# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2

# setup cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# # run linter
# - name: linter
# run: make ci-lint

# build binary
- name: build binary and move to upload location
run: make build

# upload resulting binaries
- name: upload binaries
uses: actions/upload-artifact@v1
with:
name: rly
path: ./build/rly
# Install and setup go
- name: Set up Go 1.14
uses: actions/setup-go@v2
with:
go-version: 1.14

# setup gopath
- name: Set PATH
run: |
echo "::add-path::$(go env GOPATH)/bin"
shell: bash

# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2

# setup cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# build binary
- name: build binary and move to upload location
run: make build

# upload resulting binaries
- name: upload binaries
uses: actions/upload-artifact@v1
with:
name: rly
path: ./build/rly

golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@master
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.27
args: --timeout 10m
github-token: ${{ secrets.github_token }}
40 changes: 19 additions & 21 deletions .github/workflows/gaia-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,29 @@ name: TESTING - gaia to gaia integration
on: [push]

jobs:

build:
name: build
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

# Install and setup go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2

# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2
# build cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# build cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# run tests
- name: run gaia tests
run: TEST_DEBUG=true make test-gaia
# run tests
- name: run gaia tests
run: make test-gaia
35 changes: 13 additions & 22 deletions .github/workflows/mtd-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,22 @@ name: TESTING - mtd to ibc integration
on: [push]

jobs:

build:
name: build
runs-on: ubuntu-latest
steps:
# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2

# Install and setup go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2
# build cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# build cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# run tests
- name: run mtd tests
run: TEST_DEBUG=true make test-mtd
# run tests
- name: run mtd tests
run: make test-mtd
9 changes: 4 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build:
Expand All @@ -27,12 +26,12 @@ jobs:
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./release.tar.gz
asset_name: release.tar.gz
asset_content_type: application/zip
asset_content_type: application/zip
4 changes: 2 additions & 2 deletions .github/workflows/rocketzone-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
go-version: 1.14
id: go

# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2
Expand All @@ -28,4 +28,4 @@ jobs:
# run tests
- name: run rocketzone tests
run: TEST_DEBUG=true make test-rocketzone
run: make test-rocketzone
61 changes: 61 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
linters:
enable:
- bodyclose
- deadcode
- depguard
- dogsled
# - errcheck
# - funlen
# - gochecknoglobals
# - gochecknoinits
- goconst
- gocritic
# - gocyclo
# - godox
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
# - maligned
- nakedret
- prealloc
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
# - unparam
- unused
- varcheck
# - whitespace
# - wsl
# - gocognit
- nolintlint

issues:
exclude-rules:
- linters:
- lll
source: "https://"
max-same-issues: 50

linters-settings:
dogsled:
max-blank-identifiers: 3
maligned:
suggest-new: true
# govet:
# check-shadowing: true
golint:
min-confidence: 0
# gocyclo:
# min-complexity: 10
# misspell:
# locale: US
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,33 @@ install: go.sum
# Tests / CI
###############################################################################
test:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/...
@TEST_DEBUG=true go test -mod=readonly -v ./test/...

test-gaia:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestGaia*
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestGaia*

test-mtd:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestMtd*
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestMtd*

test-rocketzone:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestRocket*
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestRocket*

test-agoric:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestAgoric*
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestAgoric*

test-coco:
@TEST_DEBUG=true go test -mod=mod -v -coverprofile coverage.out ./test/... -run TestCoCo*
@TEST_DEBUG=true go test -mod=readonly -v ./test/... -run TestCoCo*

coverage:
@echo "viewing test coverage..."
@go tool cover --html=coverage.out

ci-lint:
@GO111MODULE=on golangci-lint run
lint:
@golangci-lint run
@find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -d -s
@go mod verify

.PHONY: install build ci-lint coverage clean
.PHONY: install build lint coverage clean

# TODO: Port reproducable build scripts from gaia for relayer
# TODO: Full tested and working releases
Loading

0 comments on commit aaa8fe8

Please sign in to comment.