forked from getkin/kin-openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.59 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: go
on:
pull_request:
push:
jobs:
build-and-test:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: 'on'
CGO_ENABLED: '0'
strategy:
fail-fast: true
matrix:
go: ['1.14', '1.x']
# Locked at https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
os:
- ubuntu-20.04
- windows-2019
- macos-10.15
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
name: ${{ matrix.go }} on ${{ matrix.os }}
steps:
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- run: echo ${{ steps.go-cache-paths.outputs.go-build }}
- run: echo ${{ steps.go-cache-paths.outputs.go-mod }}
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-${{ matrix.go }}-build-${{ hashFiles('**/go.sum') }}
- name: Go Mod Cache (go>=1.15)
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-${{ matrix.go }}-mod-${{ hashFiles('**/go.sum') }}
if: matrix.go != '1.14'
- uses: actions/checkout@v2
- run: go mod download && go mod tidy && go mod verify
- if: runner.os == 'Linux'
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
- run: go vet ./...
- if: runner.os == 'Linux'
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
- run: go fmt ./...
- if: runner.os == 'Linux'
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
- run: go test ./...
- run: go test -v -run TestRaceyPatternSchema -race ./...
env:
CGO_ENABLED: '1'
- if: runner.os == 'Linux'
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
- run: |
cp openapi3/testdata/load_with_go_embed_test.go openapi3/
cat go.mod | sed 's%go 1.14%go 1.16%' >gomod && mv gomod go.mod
go test ./...
if: matrix.go != '1.14'
- if: runner.os == 'Linux'
name: Errors must not be capitalized https://github.com/golang/go/wiki/CodeReviewComments#error-strings
run: |
! git grep -E '(fmt|errors)[^(]+\(.[A-Z]'
- if: runner.os == 'Linux'
name: Did you mean %q
run: |
! git grep -E "'[%].'"