mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
b04dd9fe5c
* Enable gocognit linter Currently the gocognit complexity threshold is set to 95 to make sure no existing files will fail the linter. In future we will reduce this threshold to a much lower one. The recommended threshold is usually 30. Our code base has maximum of 97 right now...But it's better late than never to pay attention to our code compexity. * Test to see github complains * Resume to 97 Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
99 lines
2.3 KiB
YAML
99 lines
2.3 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ '*' ]
|
|
|
|
jobs:
|
|
formatting:
|
|
name: Formatting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Go mod tidy checker
|
|
id: gomodtidy
|
|
uses: ./.github/actions/gomodtidy
|
|
|
|
- name: Gofmt checker
|
|
id: gofmt
|
|
uses: ./.github/actions/gofmt
|
|
with:
|
|
path: ./
|
|
|
|
- name: GoImports checker
|
|
id: goimports
|
|
uses: Jerome1337/goimports-action@v1.0.2
|
|
with:
|
|
goimports-path: ./
|
|
|
|
gosec:
|
|
name: Gosec scan
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GO111MODULE: on
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Set up Go 1.18
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
- name: Run Gosec Security Scanner
|
|
run: | # https://github.com/securego/gosec/issues/469
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
|
go install github.com/securego/gosec/v2/cmd/gosec@latest
|
|
gosec -exclude=G307 -exclude-dir=crypto/bls/herumi ./...
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Go 1.18
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
id: go
|
|
|
|
- name: Golangci-lint
|
|
uses: golangci/golangci-lint-action@v2
|
|
with:
|
|
version: v1.45.2
|
|
skip-go-installation: true
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Go 1.x
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.18
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get dependencies
|
|
run: |
|
|
go get -v -t -d ./...
|
|
|
|
- name: Build
|
|
# Use blst tag to allow go and bazel builds for blst.
|
|
run: go build -v ./...
|
|
|
|
# fuzz leverage go tag based stubs at compile time.
|
|
# Building and testing with these tags should be checked and enforced at pre-submit.
|
|
- name: Test for fuzzing
|
|
run: go test -tags=fuzz,develop ./... -test.run=^Fuzz
|
|
|
|
# Tests run via Bazel for now...
|
|
# - name: Test
|
|
# run: go test -v ./...
|