ci: update github Worflow, and Go 1.19

This commit is contained in:
Roy Lee 2022-08-04 21:17:00 -07:00
parent 13a42b37ce
commit 2e95c1427f
5 changed files with 14 additions and 71 deletions

View file

@ -1,57 +0,0 @@
name: golangci-lint
env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
GO_VERSION: '^1.18.2'
on:
push:
tags:
- v*
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: checkout source
uses: actions/checkout@v2
- name: compile code
run: go install -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true then the action will use pre-installed Go.
skip-go-installation: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true

View file

@ -26,32 +26,32 @@ env:
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
GO_VERSION: '^1.18.2'
GO_VERSION: '^1.19'
jobs:
########################
# Format, compileation and lint check
########################
golangci:
name: lint
lint-check:
name: Format, compilation and lint check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: checkout source
uses: actions/checkout@v2
- name: run format
run: make fmt
- name: compile code
run: go install -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
skip-go-installation: true
- name: run lint
run: make lint
########################
# run unit tests

View file

@ -28,7 +28,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.2
go-version: 1.19
# Login against a Docker registry except on PR
# https://github.com/docker/login-action

View file

@ -103,7 +103,7 @@ linters:
# - noctx
# - nolintlint
# - prealloc
- rowserrcheck
# - rowserrcheck # Disabled due to generic, see https://github.com/golangci/golangci-lint/issues/2649
# - revive
# - scopelint
# - staticcheck

View file

@ -9,8 +9,8 @@ GO_BIN := ${GOPATH}/bin
LINT_BIN := ${GO_BIN}/golangci-lint
GOACC_BIN := $(GO_BIN)/go-acc
LINT_COMMIT := v1.42.1
GOACC_COMMIT := v0.2.6
LINT_COMMIT := v1.48
GOACC_COMMIT := v0.2.8
DEPGET := go install
GOBUILD := go build -v