6
6
CACHE_IMAGE : fmrcampos/docker-ci-cache
7
7
GPR_CACHE_IMAGE : docker.pkg.github.com/${{ github.repository }}/docker-ci-cache
8
8
CACHE_SEED : 1
9
+ DOCKER_BUILDKIT : 1
9
10
NODE_VERSION : 14.4.0
10
11
11
12
jobs :
12
13
test :
13
14
runs-on : ubuntu-latest
14
- container : fmrcampos/docker-ci-cache:stage
15
15
services :
16
16
postgres :
17
17
image : postgres:10.1
@@ -20,14 +20,28 @@ jobs:
20
20
--health-interval 10s
21
21
--health-timeout 5s
22
22
--health-retries 5
23
+ ports :
24
+ # Maps tcp port 5432 on service container to the host
25
+ - 5432:5432
23
26
steps :
24
27
- name : Check out repository
25
28
uses : actions/checkout@v2
26
29
30
+ - uses : whoan/docker-build-with-cache-action@master
31
+ with :
32
+ image_name : ${{ env.CACHE_IMAGE }}
33
+ image_tag : stage
34
+ build_extra_args : " --cache-from ${{ env.CACHE_IMAGE }}:static --cache-from ${{ env.CACHE_IMAGE }}:build --cache-from ${{ env.CACHE_IMAGE }}:stage --build-arg BUILDKIT_INLINE_CACHE=1"
35
+ push_image_and_stages : false
36
+
37
+ - uses : actions/setup-python@v2
38
+ with :
39
+ python-version : 3.8
40
+
27
41
- name : Cache pip dependencies
28
42
uses : actions/cache@v2
29
43
env :
30
- cache-name : cache-pip-deps-dh
44
+ cache-name : cache-pip-tests-warehouse-p
31
45
with :
32
46
path : ./.cache/pip
33
47
key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
@@ -68,24 +82,16 @@ jobs:
68
82
${{ runner.os }}-
69
83
70
84
- name : Install dependencies
71
- run : |
72
- apt-get update && apt-get -y install make locales build-essential curl libpq-dev autoconf
73
- apt -y install libcurl4-openssl-dev libssl-dev pkg-config
74
-
75
- - name : Set locale
76
- run : |
77
- echo "LC_ALL=en_US.UTF-8" >> /etc/environment
78
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
79
- echo "LANG=en_US.UTF-8" > /etc/locale.conf
80
- locale-gen en_US.UTF-8
85
+ run : sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
81
86
82
87
- name : Install pip requirements
83
88
run : |
84
89
mkdir ./.cache && mkdir ./.cache/pip
85
90
chown -R $(whoami) ./.cache/pip
86
91
pip install -U pip setuptools wheel --cache-dir ./.cache/pip
87
- pip install -r requirements.txt --cache-dir ./.cache/pip
88
- pip install -r requirements/dev.txt --cache-dir ./.cache/pip
92
+ pip install -r requirements/main.txt --cache-dir ./.cache/pip
93
+ pip install -r requirements/tests.txt --cache-dir ./.cache/pip
94
+ pip install -r requirements/deploy.txt --cache-dir ./.cache/pip
89
95
90
96
- name : Setup node
91
97
run : |
@@ -100,105 +106,148 @@ jobs:
100
106
101
107
- name : Run tests
102
108
run : |
103
- python -m coverage run -m pytest --strict --postgresql-host postgres
109
+ python -m coverage run -m pytest --strict --postgresql-host localhost
104
110
python -m coverage html
105
111
python -m coverage report -m --fail-under 100
106
112
env :
107
113
# The hostname used to communicate with the PostgreSQL service container
108
- POSTGRES_HOST : postgres
114
+ POSTGRES_HOST : localhost
109
115
# The default PostgreSQL port
110
116
POSTGRES_PORT : 5432
111
117
112
118
lint :
113
119
runs-on : ubuntu-latest
114
- container : fmrcampos/docker-ci-cache:stage
115
120
steps :
116
121
- name : Check out repository
117
122
uses : actions/checkout@v2
118
123
124
+ - uses : whoan/docker-build-with-cache-action@master
125
+ with :
126
+ image_name : ${{ env.CACHE_IMAGE }}
127
+ image_tag : stage
128
+ build_extra_args : " --cache-from ${{ env.CACHE_IMAGE }}:static --cache-from ${{ env.CACHE_IMAGE }}:build --cache-from ${{ env.CACHE_IMAGE }}:stage --build-arg BUILDKIT_INLINE_CACHE=1"
129
+ push_image_and_stages : false
130
+
119
131
- uses : actions/setup-python@v2
120
132
with :
121
133
python-version : 3.8
122
134
123
135
- name : Lint
124
136
run : |
125
- apt-get update && apt-get install make
137
+ sudo apt-get update && sudo apt-get install make
126
138
make lint ACTIONS=true
127
139
128
140
docs :
129
141
runs-on : ubuntu-latest
130
- container : fmrcampos/docker-ci-cache:stage
131
142
steps :
132
143
- name : Check out repository
133
144
uses : actions/checkout@v2
134
145
146
+ - uses : whoan/docker-build-with-cache-action@master
147
+ with :
148
+ image_name : ${{ env.CACHE_IMAGE }}
149
+ image_tag : stage
150
+ build_extra_args : " --cache-from ${{ env.CACHE_IMAGE }}:static --cache-from ${{ env.CACHE_IMAGE }}:build --cache-from ${{ env.CACHE_IMAGE }}:stage --build-arg BUILDKIT_INLINE_CACHE=1"
151
+ push_image_and_stages : false
152
+
153
+ - uses : actions/setup-python@v2
154
+ with :
155
+ python-version : 3.8
156
+
135
157
- name : Documentation
136
158
run : |
137
- apt-get update && apt-get install make
159
+ sudo apt-get update && sudo apt-get install make
138
160
make docs
139
161
140
162
deps :
141
163
runs-on : ubuntu-latest
142
- container : fmrcampos/docker-ci-cache:stage
143
164
steps :
144
165
- name : Check out repository
145
166
uses : actions/checkout@v2
146
167
168
+ - uses : whoan/docker-build-with-cache-action@master
169
+ with :
170
+ image_name : ${{ env.CACHE_IMAGE }}
171
+ image_tag : stage
172
+ build_extra_args : " --cache-from ${{ env.CACHE_IMAGE }}:static --cache-from ${{ env.CACHE_IMAGE }}:build --cache-from ${{ env.CACHE_IMAGE }}:stage --build-arg BUILDKIT_INLINE_CACHE=1"
173
+ push_image_and_stages : false
174
+
175
+ - uses : actions/setup-python@v2
176
+ with :
177
+ python-version : 3.8
178
+
147
179
- name : Cache pip dependencies
148
180
uses : actions/cache@v2
149
181
env :
150
- cache-name : cache-pip-deps-dh
182
+ cache-name : cache-pip-deps-warehouse-p
151
183
with :
152
- path : . /.cache/pip
184
+ path : ~ /.cache/pip
153
185
key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
154
186
restore-keys : |
155
187
${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
156
188
${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-
157
189
${{ runner.os }}-${{ env.CACHE_SEED }}-
158
190
${{ runner.os }}-
159
191
160
- - name : Install dependencies
192
+ - name : Set cache permissions
161
193
run : |
162
- apt-get update && apt-get -y install build-essential make libpq-dev
163
- apt -y install libcurl4-openssl-dev libssl-dev pkg-config
164
- mkdir ./.cache && mkdir ./.cache/pip
165
- chown -R $(whoami) ./.cache/pip
166
- pip install -U pip setuptools wheel --cache-dir ./.cache/pip
167
- pip install -r requirements.txt --cache-dir ./.cache/pip
168
- pip install -r requirements/dev.txt --cache-dir ./.cache/pip
194
+ mkdir ~/.cache && mkdir ~/.cache/pip
195
+ chown -R $(whoami) ~/.cache/pip
169
196
170
197
- name : Check dependencies
171
- run : make deps
198
+ run : |
199
+ sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
200
+ make deps
172
201
173
202
licenses :
174
203
runs-on : ubuntu-latest
175
- container : fmrcampos/docker-ci-cache:stage
176
204
steps :
177
205
- name : Check out repository
178
206
uses : actions/checkout@v2
179
207
208
+ - uses : whoan/docker-build-with-cache-action@master
209
+ with :
210
+ image_name : ${{ env.CACHE_IMAGE }}
211
+ image_tag : stage
212
+ build_extra_args : " --cache-from ${{ env.CACHE_IMAGE }}:static --cache-from ${{ env.CACHE_IMAGE }}:build --cache-from ${{ env.CACHE_IMAGE }}:stage --build-arg BUILDKIT_INLINE_CACHE=1"
213
+ push_image_and_stages : false
214
+
180
215
- name : Check licenses
181
216
run : bin/licenses
182
217
183
218
translations :
184
219
runs-on : ubuntu-latest
185
- container : fmrcampos/docker-ci-cache:stage
186
220
steps :
187
221
- name : Check out repository
188
222
uses : actions/checkout@v2
189
223
224
+ - uses : whoan/docker-build-with-cache-action@master
225
+ with :
226
+ image_name : ${{ env.CACHE_IMAGE }}
227
+ image_tag : stage
228
+ build_extra_args : " --cache-from ${{ env.CACHE_IMAGE }}:static --cache-from ${{ env.CACHE_IMAGE }}:build --cache-from ${{ env.CACHE_IMAGE }}:stage --build-arg BUILDKIT_INLINE_CACHE=1"
229
+ push_image_and_stages : false
230
+
231
+ - uses : actions/setup-python@v2
232
+ with :
233
+ python-version : 3.8
234
+
190
235
- name : Check translations
191
- run : |
192
- apt-get update && apt-get -y install make
193
- make translations
236
+ run : make translations
194
237
195
238
static-lint :
196
239
runs-on : ubuntu-latest
197
- container : fmrcampos/docker-ci-cache:static
198
240
steps :
199
241
- name : Check out repository
200
242
uses : actions/checkout@v2
201
243
244
+ - uses : whoan/docker-build-with-cache-action@master
245
+ with :
246
+ image_name : ${{ env.CACHE_IMAGE }}
247
+ image_tag : static
248
+ build_extra_args : " --target static --cache-from ${{ env.CACHE_IMAGE }}:static --build-arg BUILDKIT_INLINE_CACHE=1"
249
+ push_image_and_stages : false
250
+
202
251
- name : Static Lint Check
203
252
run : |
204
253
npm install eslint --save-dev
@@ -207,11 +256,17 @@ jobs:
207
256
208
257
static-tests :
209
258
runs-on : ubuntu-latest
210
- container : fmrcampos/docker-ci-cache:static
211
259
steps :
212
260
- name : Check out repository
213
261
uses : actions/checkout@v2
214
262
263
+ - uses : whoan/docker-build-with-cache-action@master
264
+ with :
265
+ image_name : ${{ env.CACHE_IMAGE }}
266
+ image_tag : static
267
+ build_extra_args : " --target static --cache-from ${{ env.CACHE_IMAGE }}:static --build-arg BUILDKIT_INLINE_CACHE=1"
268
+ push_image_and_stages : false
269
+
215
270
- name : Cache node modules
216
271
uses : actions/cache@v2
217
272
env :
@@ -228,25 +283,25 @@ jobs:
228
283
${{ runner.os }}-build-
229
284
${{ runner.os }}-
230
285
231
- - name : Locale & Dependency Setup
232
- run : |
233
- apt-get update && apt-get -y install locales
234
- echo "LC_ALL=en_US.UTF-8" >> /etc/environment
235
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
236
- echo "LANG=en_US.UTF-8" > /etc/locale.conf
237
- locale-gen en_US.UTF-8
238
- npm install -D babel
286
+ - name : Dependency Setup
287
+ run : npm install -D babel
239
288
240
289
- name : Static Tests
241
290
run : bin/static_tests
242
291
243
292
static-pipeline :
244
293
runs-on : ubuntu-latest
245
- container : fmrcampos/docker-ci-cache:static
246
294
steps :
247
295
- name : Check out repository
248
296
uses : actions/checkout@v2
249
297
298
+ - uses : whoan/docker-build-with-cache-action@master
299
+ with :
300
+ image_name : ${{ env.CACHE_IMAGE }}
301
+ image_tag : static
302
+ build_extra_args : " --target static --cache-from ${{ env.CACHE_IMAGE }}:static --build-arg BUILDKIT_INLINE_CACHE=1"
303
+ push_image_and_stages : false
304
+
250
305
- name : Cache node version manager
251
306
uses : actions/cache@v2
252
307
env :
@@ -277,14 +332,8 @@ jobs:
277
332
${{ runner.os }}-build-
278
333
${{ runner.os }}-
279
334
280
- - name : Locale & Dependency Setup
281
- run : |
282
- apt-get update && apt-get -y install locales
283
- echo "LC_ALL=en_US.UTF-8" >> /etc/environment
284
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
285
- echo "LANG=en_US.UTF-8" > /etc/locale.conf
286
- locale-gen en_US.UTF-8
287
- npm install -D babel
335
+ - name : Dependency Setup
336
+ run : npm install -D babel
288
337
289
338
- name : Static Pipeline Check
290
339
run : bin/static_pipeline
0 commit comments