mirror of
https://github.com/jimeh/go-golden.git
synced 2026-02-18 19:06:39 +00:00
ci(deps): update actions and lint config to get them all running again (#5)
This commit is contained in:
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
@@ -6,29 +6,28 @@ jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
checks: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
version: v1.42
|
||||
env:
|
||||
VERBOSE: "true"
|
||||
go-version-file: go.mod
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.64
|
||||
|
||||
tidy:
|
||||
name: Tidy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.15
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
go-version-file: go.mod
|
||||
- name: Check if mods are tidy
|
||||
run: make check-tidy
|
||||
|
||||
@@ -36,18 +35,12 @@ jobs:
|
||||
name: Coverage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.15
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
go-version-file: go.mod
|
||||
- name: Publish coverage
|
||||
uses: paambaati/codeclimate-action@v2.7.4
|
||||
uses: paambaati/codeclimate-action@v9.0.0
|
||||
env:
|
||||
VERBOSE: "true"
|
||||
GOMAXPROCS: 4
|
||||
@@ -73,15 +66,9 @@ jobs:
|
||||
- "1.17"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Run tests
|
||||
run: go test -v -count=1 -race ./...
|
||||
|
||||
@@ -4,18 +4,13 @@ linters-settings:
|
||||
statements: 150
|
||||
gocyclo:
|
||||
min-complexity: 20
|
||||
golint:
|
||||
min-confidence: 0
|
||||
govet:
|
||||
check-shadowing: true
|
||||
enable-all: true
|
||||
disable:
|
||||
- fieldalignment
|
||||
lll:
|
||||
line-length: 80
|
||||
tab-width: 4
|
||||
maligned:
|
||||
suggest-new: true
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
@@ -24,13 +19,11 @@ linters:
|
||||
enable:
|
||||
- asciicheck
|
||||
- bodyclose
|
||||
- deadcode
|
||||
- depguard
|
||||
- copyloopvar
|
||||
- durationcheck
|
||||
- errcheck
|
||||
- errorlint
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- funlen
|
||||
- gochecknoinits
|
||||
- goconst
|
||||
@@ -58,13 +51,10 @@ linters:
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- tparallel
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- varcheck
|
||||
- wastedassign
|
||||
- whitespace
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ type MyStruct struct {
|
||||
// TestExampleMyStruct reads/writes the following golden file:
|
||||
//
|
||||
// testdata/TestExampleMyStruct.golden
|
||||
//
|
||||
func TestExampleMyStruct(t *testing.T) {
|
||||
got, err := json.Marshal(&MyStruct{Foo: "Bar"})
|
||||
require.NoError(t, err)
|
||||
@@ -34,7 +33,6 @@ func TestExampleMyStruct(t *testing.T) {
|
||||
//
|
||||
// testdata/TestExampleMyStructTabular/empty_struct.golden
|
||||
// testdata/TestExampleMyStructTabular/full_struct.golden
|
||||
//
|
||||
func TestExampleMyStructTabular(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -62,7 +60,6 @@ func TestExampleMyStructTabular(t *testing.T) {
|
||||
//
|
||||
// testdata/TestExampleMyStructP/json.golden
|
||||
// testdata/TestExampleMyStructP/xml.golden
|
||||
//
|
||||
func TestExampleMyStructP(t *testing.T) {
|
||||
gotJSON, _ := json.Marshal(&MyStruct{Foo: "Bar"})
|
||||
gotXML, _ := xml.Marshal(&MyStruct{Foo: "Bar"})
|
||||
@@ -82,7 +79,6 @@ func TestExampleMyStructP(t *testing.T) {
|
||||
// testdata/TestExampleMyStructTabularP/empty_struct/xml.golden
|
||||
// testdata/TestExampleMyStructTabularP/full_struct/json.golden
|
||||
// testdata/TestExampleMyStructTabularP/full_struct/xml.golden
|
||||
//
|
||||
func TestExampleMyStructTabularP(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// compatible with Linux, macOS and Windows systems regardless of what crazy
|
||||
// characters might be in a subtest's name.
|
||||
//
|
||||
// Usage
|
||||
// # Usage
|
||||
//
|
||||
// Typical usage should look something like this:
|
||||
//
|
||||
@@ -30,7 +30,7 @@
|
||||
// GOLDEN_UPDATE environment variable to one of "1", "y", "t", "yes", "on", or
|
||||
// "true" when running tests.
|
||||
//
|
||||
// Sub-Tests
|
||||
// # Sub-Tests
|
||||
//
|
||||
// As the golden filename is based on t.Name(), it works with sub-tests too,
|
||||
// ensuring each sub-test gets it's own golden file. For example:
|
||||
@@ -63,7 +63,7 @@
|
||||
// testdata/TestExampleMyStructTabular/empty_struct.golden
|
||||
// testdata/TestExampleMyStructTabular/full_struct.golden
|
||||
//
|
||||
// Multiple Golden Files in a Single Test
|
||||
// # Multiple Golden Files in a Single Test
|
||||
//
|
||||
// The "P" suffixed methods, GetP(), SetP(), and FileP(), all take a name
|
||||
// argument which allows using specific golden files within a given *testing.T
|
||||
@@ -119,7 +119,6 @@
|
||||
// testdata/TestExampleMyStructTabularP/empty_struct/xml.golden
|
||||
// testdata/TestExampleMyStructTabularP/full_struct/json.golden
|
||||
// testdata/TestExampleMyStructTabularP/full_struct/xml.golden
|
||||
//
|
||||
package golden
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user