21
21
fail-fast : false
22
22
matrix :
23
23
os :
24
- - ubuntu-latest
24
+ - ubuntu-20.04
25
25
go-version :
26
26
- 1.13.x
27
27
- 1.14.x
@@ -40,14 +40,29 @@ jobs:
40
40
env :
41
41
# no `-mod=readonly` to test PRs made by @dependabot;
42
42
# `make ci-check-changes` step below still checks what we need
43
+ WORKDIR : " ${{ github.workspace }}/gopath/src/gopkg.in/reform.v1"
44
+ GOPATH : " ${{ github.workspace }}/gopath"
45
+ GOBIN : " ${{ github.workspace }}/gopath/bin"
43
46
GO111MODULE : " on"
44
- GOPROXY : https://proxy.golang.org
45
- GORACE : halt_on_error=1
46
- REFORM_POSTGRES_IMAGE : ${{ matrix.images.postgres }}
47
- REFORM_MYSQL_IMAGE : ${{ matrix.images.mysql }}
48
- REFORM_MSSQL_IMAGE : ${{ matrix.images.mssql }}
47
+ GOPROXY : " https://proxy.golang.org"
48
+ GORACE : " halt_on_error=1"
49
+ REFORM_POSTGRES_IMAGE : " ${{ matrix.images.postgres }}"
50
+ REFORM_MYSQL_IMAGE : " ${{ matrix.images.mysql }}"
51
+ REFORM_MSSQL_IMAGE : " ${{ matrix.images.mssql }}"
49
52
50
53
steps :
54
+ # Cache Go modules, build cache, installed packages and GOPATH sources
55
+ # to significantly decreases total CI time. See also cleanup.yaml.
56
+ - name : Enable Go cache
57
+ uses : actions/cache@v2
58
+ with :
59
+ path : |
60
+ ~/.cache/go-build
61
+ ${{ env.GOPATH }}/pkg
62
+ ${{ env.GOPATH }}/src/github.com
63
+ ${{ env.GOPATH }}/src/golang.org
64
+ key : ${{ matrix.os }}-${{ matrix.go-version }}
65
+
51
66
- name : Set up Go version ${{ matrix.go-version }}
52
67
if : matrix.go-version != 'tip'
53
68
uses : actions/setup-go@v2
@@ -60,43 +75,21 @@ jobs:
60
75
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
61
76
cd $HOME/gotip/src
62
77
./make.bash
63
- echo "::set-env name=GOROOT::$HOME/gotip"
64
- echo "::add-path::$HOME/gotip/bin"
78
+ echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
79
+ echo "$HOME/gotip/bin" >> $GITHUB_PATH
80
+ echo "$GOBIN" >> $GITHUB_PATH
65
81
66
- - name : Set environment variables
67
- run : |
68
- echo "::set-env name=GOPATH::$GITHUB_WORKSPACE/gopath"
69
- echo "::add-path::$GITHUB_WORKSPACE/gopath/bin"
70
- echo "::set-env name=WORKDIR::$GITHUB_WORKSPACE/gopath/src/gopkg.in/reform.v1"
71
- echo "::set-env name=GO_VERSION::$(go version)"
82
+ - name : Set GO_VERSION
83
+ run : echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
72
84
73
85
- name : Check out code into GOPATH
74
86
uses : actions/checkout@v2
75
87
with :
76
88
path : ${{ env.WORKDIR }}
77
89
78
- - name : Pull Docker images in the background
90
+ - name : Pull Docker images
79
91
working-directory : ${{ env.WORKDIR }}
80
- run : docker-compose pull --quiet &
81
-
82
- # slightly decreases total CI time; see also cleanup.yaml
83
- - name : Enable Go modules cache
84
- uses : actions/cache@v2
85
- with :
86
- path : ${{ env.GOPATH }}/pkg/mod
87
- key : ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
88
- restore-keys : |
89
- ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
90
-
91
- # significantly decreases total CI time; see also cleanup.yaml
92
- - name : Enable Go build cache
93
- uses : actions/cache@v2
94
- with :
95
- path : ~/.cache/go-build
96
- key : ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
97
- restore-keys : |
98
- ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
99
- ${{ matrix.os }}-go-${{ matrix.go-version }}-build-
92
+ run : docker-compose pull
100
93
101
94
- name : Stop Ubuntu services
102
95
run : sudo systemctl stop mysql
@@ -113,7 +106,7 @@ jobs:
113
106
- name : Check that it is still possible to install reform without modules
114
107
working-directory : ${{ env.WORKDIR }}
115
108
run : |
116
- env GO111MODULE=off go get -v ./...
109
+ env GO111MODULE=off go get -v -x ./...
117
110
reform -version
118
111
reform-db -version
119
112
@@ -131,6 +124,10 @@ jobs:
131
124
132
125
# TODO test again with updated deps
133
126
127
+ - name : Clean Go test cache
128
+ if : ${{ always() }}
129
+ run : go clean -testcache
130
+
134
131
# to ensure that all generators still work the same way
135
132
- name : Check that there are no source code changes
136
133
working-directory : ${{ env.WORKDIR }}
@@ -162,20 +159,38 @@ jobs:
162
159
fail-fast : false
163
160
matrix :
164
161
os :
165
- - ubuntu-latest
162
+ - ubuntu-20.04
166
163
go-version :
167
164
- 1.15.x
168
165
169
166
runs-on : ${{ matrix.os }}
170
167
171
168
env :
172
- # no `-mod=readonly` to test PRs made by @dependabot
169
+ # no `-mod=readonly` to test PRs made by @dependabot;
173
170
# `make ci-check-changes` step below still checks what we need
171
+ WORKDIR : " ${{ github.workspace }}/gopath/src/gopkg.in/reform.v1"
172
+ GOPATH : " ${{ github.workspace }}/gopath"
173
+ GOBIN : " ${{ github.workspace }}/gopath/bin"
174
174
GO111MODULE : " on"
175
- GOPROXY : https://proxy.golang.org
176
- GORACE : halt_on_error=1
175
+ GOPROXY : " https://proxy.golang.org"
176
+ GORACE : " halt_on_error=1"
177
+ REFORM_POSTGRES_IMAGE : " ${{ matrix.images.postgres }}"
178
+ REFORM_MYSQL_IMAGE : " ${{ matrix.images.mysql }}"
179
+ REFORM_MSSQL_IMAGE : " ${{ matrix.images.mssql }}"
177
180
178
181
steps :
182
+ # Cache Go modules, build cache, installed packages and GOPATH sources
183
+ # to significantly decreases total CI time. See also cleanup.yaml.
184
+ - name : Enable Go cache
185
+ uses : actions/cache@v2
186
+ with :
187
+ path : |
188
+ ~/.cache/go-build
189
+ ${{ env.GOPATH }}/pkg
190
+ ${{ env.GOPATH }}/src/github.com
191
+ ${{ env.GOPATH }}/src/golang.org
192
+ key : ${{ matrix.os }}-${{ matrix.go-version }}
193
+
179
194
- name : Set up Go version ${{ matrix.go-version }}
180
195
if : matrix.go-version != 'tip'
181
196
uses : actions/setup-go@v2
@@ -188,40 +203,18 @@ jobs:
188
203
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
189
204
cd $HOME/gotip/src
190
205
./make.bash
191
- echo "::set-env name=GOROOT::$HOME/gotip"
192
- echo "::add-path::$HOME/gotip/bin"
206
+ echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
207
+ echo "$HOME/gotip/bin" >> $GITHUB_PATH
208
+ echo "$GOBIN" >> $GITHUB_PATH
193
209
194
- - name : Set environment variables
195
- run : |
196
- echo "::set-env name=GOPATH::$GITHUB_WORKSPACE/gopath"
197
- echo "::add-path::$GITHUB_WORKSPACE/gopath/bin"
198
- echo "::set-env name=WORKDIR::$GITHUB_WORKSPACE/gopath/src/gopkg.in/reform.v1"
199
- echo "::set-env name=GO_VERSION::$(go version)"
210
+ - name : Set GO_VERSION
211
+ run : echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
200
212
201
213
- name : Check out code into GOPATH
202
214
uses : actions/checkout@v2
203
215
with :
204
216
path : ${{ env.WORKDIR }}
205
217
206
- # slightly decreases total CI time; see also cleanup.yaml
207
- - name : Enable Go modules cache
208
- uses : actions/cache@v2
209
- with :
210
- path : ${{ env.GOPATH }}/pkg/mod
211
- key : ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
212
- restore-keys : |
213
- ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
214
-
215
- # significantly decreases total CI time; see also cleanup.yaml
216
- - name : Enable Go build cache
217
- uses : actions/cache@v2
218
- with :
219
- path : ~/.cache/go-build
220
- key : ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
221
- restore-keys : |
222
- ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
223
- ${{ matrix.os }}-go-${{ matrix.go-version }}-build-
224
-
225
218
# FIXME Is there a more ergonomic way?
226
219
- name : Update Go language version in the module
227
220
working-directory : ${{ env.WORKDIR }}
0 commit comments