-
Notifications
You must be signed in to change notification settings - Fork 129
134 lines (129 loc) · 4.6 KB
/
go-multierror.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: hashicorp/go-multierror/go-multierror
on:
- push
- pull_request
permissions:
contents: read
jobs:
go-fmt:
runs-on: ubuntu-latest
steps:
- name: Get go-version
run: go version
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
- name: check go fmt
run: |-
files="$(go fmt ./...)"
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
- name: Run golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5
linux-tests:
runs-on: ubuntu-latest
env:
TEST_RESULTS_PATH: '/tmp/test-results'
strategy:
matrix:
go-version:
- '1.13' # oldest supported; named in go.mod
- 'oldstable'
- 'stable'
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ matrix.go-version }}
- name: Install gotestsum
uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- name: Get go version and env
run: |
go version
go env
- name: Create test directory
run: mkdir -p "$TEST_RESULTS_PATH/go-multierror"
- name: Run go tests
env:
PLATFORM: linux
REPORT_FILE: ${{ env.TEST_RESULTS_PATH }}/go-multierror/gotestsum-report.xml
run: |-
gotestsum --format=short-verbose --junitfile ${{ env.REPORT_FILE }} -- -p 2 -cover -coverprofile=coverage-linux.out ./...
- name: Upload and save artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: ${{ env.TEST_RESULTS_PATH }}
name: tests-linux-${{ matrix.go-version }}
- name: Upload coverage report
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: coverage-linux.out
name: Coverage-report-linux-${{matrix.go-version}}
- name: Display coverage report
run: go tool cover -func=coverage-linux.out
windows-tests:
runs-on: windows-latest
env:
TEST_RESULTS_PATH: 'c:\Users\runneradmin\AppData\Local\Temp\test-results'
strategy:
matrix:
go-version:
- '1.13' # oldest supported; named in go.mod
- 'oldstable'
- 'stable'
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ matrix.go-version }}
- name: Get go-version and env
run: |
go version
go env
- run: git config --global core.autocrlf false
- name: Download go modules
run: go mod download
- name: Install gotestsum
uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- name: Run go tests
env:
PLATFORM: win
REPORT_FILE: ${{ env.TEST_RESULTS_PATH }}/go-multierror/gotestsum-report.xml
run: |-
gotestsum.exe --format=short-verbose --junitfile ${{ env.REPORT_FILE }} -- -p 2 -cover -coverprofile="coverage-win.out" ./...
- name: Upload and save artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: ${{ env.TEST_RESULTS_PATH }}
name: tests-windows-${{ matrix.go-version }}
- name: Upload coverage test
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: coverage-win.out
name: Coverage-report-win-${{matrix.go-version}}
- name: Display coverage report
run: go tool cover -func=coverage-win.out
shell: cmd