12
12
GO_VERSION : 1.21.0
13
13
GORELEASER_VERSION : 1.20.0
14
14
GOLANGCI_LINT_VERSION : v1.54.1
15
+ TPARSE_VERSION : v0.11.1
15
16
BUILD_TAGS : ' sqlite_vtable sqlite_stat4 sqlite_fts5 sqlite_introspect sqlite_json sqlite_math_functions'
16
17
17
18
jobs :
@@ -24,41 +25,36 @@ jobs:
24
25
25
26
steps :
26
27
- name : Checkout
27
- uses : actions/checkout@v3
28
+ uses : actions/checkout@v4
28
29
with :
29
30
fetch-depth : 0
30
31
31
32
- name : Set up Go
32
33
uses : actions/setup-go@v4
33
34
with :
34
- go-version : ${{ env.GO_VERSION }}
35
-
36
- # Install gotestfmt on the VM running the action.
37
- - name : Set up gotestfmt
38
- uses : gotesttools/gotestfmt-action@v2
39
- with :
40
- # Optional: pass GITHUB_TOKEN to avoid rate limiting.
41
- token : ${{ secrets.GITHUB_TOKEN }}
35
+ go-version-file : go.mod
42
36
43
37
44
38
- name : Build
45
39
run : go build -tags '${{ env.BUILD_TAGS }}' -v ./...
46
40
47
- # Run tests with nice formatting. Save the original log in /tmp/gotest.log
48
- # https://github.com/GoTestTools/gotestfmt#github-actions
49
- - name : Run tests
41
+ - name : ' Go tests'
42
+ shell : bash
50
43
run : |
51
- set -euo pipefail
52
- go test -tags '${{ env.BUILD_TAGS }}' -json -v ./... 2>&1 | tee gotest.log | gotestfmt
44
+ set -e
53
45
54
- # Upload the original go test log as an artifact for later review.
55
- - name : Upload test log
56
- uses : actions/upload-artifact@v3
46
+ # We tee the go test output to a file, so that "tparse" can
47
+ # render pretty output below.
48
+ go test -tags '${{ env.BUILD_TAGS }}' -timeout 20m -v -json -cover ./... | tee gotest.out.json
49
+
50
+ - name : ' Test output'
57
51
if : always()
58
- with :
59
- name : test-log
60
- path : gotest.log
61
- if-no-files-found : warn
52
+ shell : bash
53
+ run : |
54
+ set -e
55
+ go install github.com/mfridman/tparse@${{ env.TPARSE_VERSION }}
56
+ tparse -all -sort=elapsed -file gotest.out.json
57
+
62
58
63
59
test-windows :
64
60
runs-on : windows-2022
@@ -72,84 +68,84 @@ jobs:
72
68
# path-type: inherit
73
69
74
70
- name : Checkout
75
- uses : actions/checkout@v3
71
+ uses : actions/checkout@v4
76
72
with :
77
73
fetch-depth : 0
78
74
79
75
- name : Set up Go
80
- uses : actions/setup-go@v3
76
+ uses : actions/setup-go@v4
81
77
with :
82
- go-version : ${{ env.GO_VERSION }}
78
+ go-version-file : go.mod
83
79
84
80
- name : Build
85
81
run : go build -tags '${{ env.BUILD_TAGS }}' -v ./...
86
82
# shell: msys2 {0}
87
83
88
- - name : Run tests
84
+ # - name: Run tests
85
+ # run: |
86
+ # go test -tags '${{ env.BUILD_TAGS }}' -v ./...
87
+ # # shell: msys2 {0}
88
+
89
+ - name : ' Go tests'
90
+ shell : bash
89
91
run : |
90
- go test -tags '${{ env.BUILD_TAGS }}' -v ./...
91
- # shell: msys2 {0}
92
+ # set -e
93
+
94
+ # We send the Go test output to a file, so that "tparse" can
95
+ # render pretty output below.
96
+ go test -tags '${{ env.BUILD_TAGS }}' -timeout 20m -v -json -cover ./... > gotest.out.json
92
97
93
- go-lint :
98
+ - name : ' Test output'
99
+ if : always()
100
+ shell : bash
101
+ run : |
102
+ set -e
103
+ go install github.com/mfridman/tparse@${{ env.TPARSE_VERSION }}
104
+ tparse -all -sort=elapsed -file gotest.out.json
105
+
106
+ lint :
94
107
runs-on : ubuntu-22.04
95
108
steps :
96
109
- name : Checkout
97
- uses : actions/checkout@v3
110
+ uses : actions/checkout@v4
98
111
with :
99
112
fetch-depth : 0
100
113
114
+ - name : Lint GH workflow files
115
+ run : |
116
+ # From https://github.com/rhysd/actionlint
117
+ bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
118
+ ./actionlint -color
119
+
120
+ - name : shellcheck
121
+ run : |
122
+ shellcheck ./install.sh
123
+
101
124
- name : Set up Go
102
- uses : actions/setup-go@v3
125
+ uses : actions/setup-go@v4
103
126
with :
104
- go-version : ${{ env.GO_VERSION }}
127
+ go-version-file : go.mod
105
128
106
129
- name : golangci-lint
107
130
uses : golangci/golangci-lint-action@v3
108
131
with :
109
132
version : ${{ env.GOLANGCI_LINT_VERSION }}
110
133
111
- # coverage:
112
- # runs-on: ubuntu-22.04
113
- # steps:
114
- # - name: Checkout
115
- # uses: actions/checkout@v3
116
- # with:
117
- # fetch-depth: 0
118
- #
119
- # - name: Set up Go
120
- # uses: actions/setup-go@v3
121
- # with:
122
- # go-version: ${{ env.GO_VERSION }}
123
- #
124
- # - name: Test
125
- # run: go test -v ./...
126
- #
127
- # # https://github.com/ncruces/go-coverage-report
128
- # - name: Update coverage report
129
- # uses: ncruces/go-coverage-report@v0
130
- # with:
131
- # report: 'true'
132
- # chart: 'true'
133
- # amend: 'false'
134
- # if: |
135
- # github.event_name == 'push'
136
- # continue-on-error: true
137
-
138
134
139
135
binaries-darwin :
140
136
if : startsWith(github.ref, 'refs/tags/v')
141
137
runs-on : macos-12
142
138
143
139
steps :
144
140
- name : Checkout
145
- uses : actions/checkout@v3
141
+ uses : actions/checkout@v4
146
142
with :
147
143
fetch-depth : 0
148
144
149
145
- name : Set up Go
150
- uses : actions/setup-go@v3
146
+ uses : actions/setup-go@v4
151
147
with :
152
- go-version : ${{ env.GO_VERSION }}
148
+ go-version-file : go.mod
153
149
154
150
- name : GoReleaser (build darwin binaries)
155
151
uses : goreleaser/goreleaser-action@v3
@@ -173,14 +169,14 @@ jobs:
173
169
174
170
steps :
175
171
- name : Checkout
176
- uses : actions/checkout@v3
172
+ uses : actions/checkout@v4
177
173
with :
178
174
fetch-depth : 0
179
175
180
176
- name : Set up Go
181
- uses : actions/setup-go@v3
177
+ uses : actions/setup-go@v4
182
178
with :
183
- go-version : ${{ env.GO_VERSION }}
179
+ go-version-file : go.mod
184
180
185
181
- name : GoReleaser (build linux-amd64 binaries)
186
182
uses : goreleaser/goreleaser-action@v3
@@ -204,14 +200,14 @@ jobs:
204
200
205
201
steps :
206
202
- name : Checkout
207
- uses : actions/checkout@v3
203
+ uses : actions/checkout@v4
208
204
with :
209
205
fetch-depth : 0
210
206
211
207
- name : Set up Go
212
- uses : actions/setup-go@v3
208
+ uses : actions/setup-go@v4
213
209
with :
214
- go-version : ${{ env.GO_VERSION }}
210
+ go-version-file : go.mod
215
211
216
212
- name : Install toolchain dependencies
217
213
run : |
@@ -241,14 +237,14 @@ jobs:
241
237
242
238
steps :
243
239
- name : Checkout
244
- uses : actions/checkout@v3
240
+ uses : actions/checkout@v4
245
241
with :
246
242
fetch-depth : 0
247
243
248
244
- name : Set up Go
249
- uses : actions/setup-go@v3
245
+ uses : actions/setup-go@v4
250
246
with :
251
- go-version : ${{ env.GO_VERSION }}
247
+ go-version-file : go.mod
252
248
253
249
- name : GoReleaser (build windows binaries)
254
250
uses : goreleaser/goreleaser-action@v3
@@ -271,7 +267,7 @@ jobs:
271
267
runs-on : ubuntu-22.04
272
268
if : startsWith(github.ref, 'refs/tags/v')
273
269
needs :
274
- - go- lint
270
+ - lint
275
271
- test-linux-darwin
276
272
- test-windows
277
273
- binaries-darwin
@@ -280,14 +276,14 @@ jobs:
280
276
- binaries-windows
281
277
steps :
282
278
- name : Checkout
283
- uses : actions/checkout@v3
279
+ uses : actions/checkout@v4
284
280
with :
285
281
fetch-depth : 0
286
282
287
283
- name : Set up Go
288
- uses : actions/setup-go@v3
284
+ uses : actions/setup-go@v4
289
285
with :
290
- go-version : ${{ env.GO_VERSION }}
286
+ go-version-file : go.mod
291
287
292
288
- name : Download darwin artifacts
293
289
uses : actions/download-artifact@v3
0 commit comments