2020-05-31 06:44:34 +00:00
|
|
|
name: Go
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ '*' ]
|
|
|
|
|
|
|
|
jobs:
|
2022-03-31 22:16:14 +00:00
|
|
|
formatting:
|
|
|
|
name: Formatting
|
2020-06-04 16:16:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-31 22:16:14 +00:00
|
|
|
uses: actions/checkout@v2
|
2020-06-04 16:16:45 +00:00
|
|
|
|
2020-06-15 16:15:54 +00:00
|
|
|
- name: Go mod tidy checker
|
|
|
|
id: gomodtidy
|
|
|
|
uses: ./.github/actions/gomodtidy
|
|
|
|
|
2022-03-31 22:16:14 +00:00
|
|
|
gosec:
|
|
|
|
name: Gosec scan
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2023-05-12 15:51:20 +00:00
|
|
|
- name: Set up Go 1.20
|
2022-03-31 22:16:14 +00:00
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-05-12 15:51:20 +00:00
|
|
|
go-version: '1.20'
|
2022-03-31 22:16:14 +00:00
|
|
|
- name: Run Gosec Security Scanner
|
|
|
|
run: | # https://github.com/securego/gosec/issues/469
|
|
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
2023-05-12 15:51:20 +00:00
|
|
|
go install github.com/securego/gosec/v2/cmd/gosec@v2.15.0
|
2022-03-31 22:16:14 +00:00
|
|
|
gosec -exclude=G307 -exclude-dir=crypto/bls/herumi ./...
|
|
|
|
|
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2023-05-12 15:51:20 +00:00
|
|
|
- name: Set up Go 1.20
|
2022-03-31 22:16:14 +00:00
|
|
|
uses: actions/setup-go@v3
|
2021-08-15 15:24:13 +00:00
|
|
|
with:
|
2023-05-12 15:51:20 +00:00
|
|
|
go-version: '1.20'
|
2022-03-31 22:16:14 +00:00
|
|
|
id: go
|
2021-10-04 11:06:21 +00:00
|
|
|
|
|
|
|
- name: Golangci-lint
|
2022-08-05 13:01:47 +00:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2021-10-04 11:06:21 +00:00
|
|
|
with:
|
2023-05-12 15:51:20 +00:00
|
|
|
version: v1.52.2
|
2022-08-29 16:45:25 +00:00
|
|
|
args: --config=.golangci.yml --out-${NO_FUTURE}format colored-line-number
|
2021-10-04 11:06:21 +00:00
|
|
|
|
2020-05-31 06:44:34 +00:00
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-05-12 15:51:20 +00:00
|
|
|
go-version: '1.20'
|
2020-05-31 06:44:34 +00:00
|
|
|
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
|
2020-09-16 13:28:28 +00:00
|
|
|
# Use blst tag to allow go and bazel builds for blst.
|
2021-04-11 11:11:15 +00:00
|
|
|
run: go build -v ./...
|
2022-06-14 13:12:28 +00:00
|
|
|
env:
|
|
|
|
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"
|
2022-06-01 13:15:50 +00:00
|
|
|
# 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
|
2022-06-14 13:12:28 +00:00
|
|
|
env:
|
|
|
|
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"
|
2022-05-03 22:19:05 +00:00
|
|
|
|
2020-05-31 06:44:34 +00:00
|
|
|
# Tests run via Bazel for now...
|
|
|
|
# - name: Test
|
|
|
|
# run: go test -v ./...
|