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-deps-warehouse
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,15 @@ 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/deploy .txt --cache-dir ./.cache/pip
89
94
90
95
- name : Setup node
91
96
run : |
@@ -100,105 +105,146 @@ jobs:
100
105
101
106
- name : Run tests
102
107
run : |
103
- python -m coverage run -m pytest --strict --postgresql-host postgres
108
+ python -m coverage run -m pytest --strict --postgresql-host localhost
104
109
python -m coverage html
105
110
python -m coverage report -m --fail-under 100
106
111
env :
107
112
# The hostname used to communicate with the PostgreSQL service container
108
- POSTGRES_HOST : postgres
113
+ POSTGRES_HOST : localhost
109
114
# The default PostgreSQL port
110
115
POSTGRES_PORT : 5432
111
116
112
117
lint :
113
118
runs-on : ubuntu-latest
114
- container : fmrcampos/docker-ci-cache:stage
115
119
steps :
116
120
- name : Check out repository
117
121
uses : actions/checkout@v2
118
122
123
+ - uses : whoan/docker-build-with-cache-action@master
124
+ with :
125
+ image_name : ${{ env.CACHE_IMAGE }}
126
+ image_tag : stage
127
+ 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"
128
+ push_image_and_stages : false
129
+
119
130
- uses : actions/setup-python@v2
120
131
with :
121
132
python-version : 3.8
122
133
123
134
- name : Lint
124
135
run : |
125
- apt-get update && apt-get install make
136
+ sudo apt-get update && sudo apt-get install make
126
137
make lint ACTIONS=true
127
138
128
139
docs :
129
140
runs-on : ubuntu-latest
130
- container : fmrcampos/docker-ci-cache:stage
131
141
steps :
132
142
- name : Check out repository
133
143
uses : actions/checkout@v2
134
144
145
+ - uses : whoan/docker-build-with-cache-action@master
146
+ with :
147
+ image_name : ${{ env.CACHE_IMAGE }}
148
+ image_tag : stage
149
+ 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"
150
+ push_image_and_stages : false
151
+
152
+ - uses : actions/setup-python@v2
153
+ with :
154
+ python-version : 3.8
155
+
135
156
- name : Documentation
136
157
run : |
137
- apt-get update && apt-get install make
158
+ sudo apt-get update && sudo apt-get install make
138
159
make docs
139
160
140
161
deps :
141
162
runs-on : ubuntu-latest
142
- container : fmrcampos/docker-ci-cache:stage
143
163
steps :
144
164
- name : Check out repository
145
165
uses : actions/checkout@v2
146
166
167
+ - uses : whoan/docker-build-with-cache-action@master
168
+ with :
169
+ image_name : ${{ env.CACHE_IMAGE }}
170
+ image_tag : stage
171
+ 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"
172
+ push_image_and_stages : false
173
+
174
+ - uses : actions/setup-python@v2
175
+ with :
176
+ python-version : 3.8
177
+
147
178
- name : Cache pip dependencies
148
179
uses : actions/cache@v2
149
180
env :
150
- cache-name : cache-pip-deps-dh
181
+ cache-name : cache-pip-deps-warehouse
151
182
with :
152
- path : . /.cache/pip
183
+ path : ~ /.cache/pip
153
184
key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
154
185
restore-keys : |
155
186
${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
156
187
${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-
157
188
${{ runner.os }}-${{ env.CACHE_SEED }}-
158
189
${{ runner.os }}-
159
190
160
- - name : Install dependencies
191
+ - name : Set cache permissions
161
192
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
193
+ mkdir ~/.cache && mkdir ~/.cache/pip
194
+ chown -R $(whoami) ~/.cache/pip
169
195
170
196
- name : Check dependencies
171
197
run : make deps
172
198
173
199
licenses :
174
200
runs-on : ubuntu-latest
175
- container : fmrcampos/docker-ci-cache:stage
176
201
steps :
177
202
- name : Check out repository
178
203
uses : actions/checkout@v2
179
204
205
+ - uses : whoan/docker-build-with-cache-action@master
206
+ with :
207
+ image_name : ${{ env.CACHE_IMAGE }}
208
+ image_tag : stage
209
+ 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"
210
+ push_image_and_stages : false
211
+
180
212
- name : Check licenses
181
213
run : bin/licenses
182
214
183
215
translations :
184
216
runs-on : ubuntu-latest
185
- container : fmrcampos/docker-ci-cache:stage
186
217
steps :
187
218
- name : Check out repository
188
219
uses : actions/checkout@v2
189
220
221
+ - uses : whoan/docker-build-with-cache-action@master
222
+ with :
223
+ image_name : ${{ env.CACHE_IMAGE }}
224
+ image_tag : stage
225
+ 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"
226
+ push_image_and_stages : false
227
+
228
+ - uses : actions/setup-python@v2
229
+ with :
230
+ python-version : 3.8
231
+
190
232
- name : Check translations
191
- run : |
192
- apt-get update && apt-get -y install make
193
- make translations
233
+ run : make translations
194
234
195
235
static-lint :
196
236
runs-on : ubuntu-latest
197
- container : fmrcampos/docker-ci-cache:static
198
237
steps :
199
238
- name : Check out repository
200
239
uses : actions/checkout@v2
201
240
241
+ - uses : whoan/docker-build-with-cache-action@master
242
+ with :
243
+ image_name : ${{ env.CACHE_IMAGE }}
244
+ image_tag : static
245
+ build_extra_args : " --target static --cache-from ${{ env.CACHE_IMAGE }}:static --build-arg BUILDKIT_INLINE_CACHE=1"
246
+ push_image_and_stages : false
247
+
202
248
- name : Static Lint Check
203
249
run : |
204
250
npm install eslint --save-dev
@@ -207,11 +253,17 @@ jobs:
207
253
208
254
static-tests :
209
255
runs-on : ubuntu-latest
210
- container : fmrcampos/docker-ci-cache:static
211
256
steps :
212
257
- name : Check out repository
213
258
uses : actions/checkout@v2
214
259
260
+ - uses : whoan/docker-build-with-cache-action@master
261
+ with :
262
+ image_name : ${{ env.CACHE_IMAGE }}
263
+ image_tag : static
264
+ build_extra_args : " --target static --cache-from ${{ env.CACHE_IMAGE }}:static --build-arg BUILDKIT_INLINE_CACHE=1"
265
+ push_image_and_stages : false
266
+
215
267
- name : Cache node modules
216
268
uses : actions/cache@v2
217
269
env :
@@ -228,25 +280,25 @@ jobs:
228
280
${{ runner.os }}-build-
229
281
${{ runner.os }}-
230
282
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
283
+ - name : Dependency Setup
284
+ run : npm install -D babel
239
285
240
286
- name : Static Tests
241
287
run : bin/static_tests
242
288
243
289
static-pipeline :
244
290
runs-on : ubuntu-latest
245
- container : fmrcampos/docker-ci-cache:static
246
291
steps :
247
292
- name : Check out repository
248
293
uses : actions/checkout@v2
249
294
295
+ - uses : whoan/docker-build-with-cache-action@master
296
+ with :
297
+ image_name : ${{ env.CACHE_IMAGE }}
298
+ image_tag : static
299
+ build_extra_args : " --target static --cache-from ${{ env.CACHE_IMAGE }}:static --build-arg BUILDKIT_INLINE_CACHE=1"
300
+ push_image_and_stages : false
301
+
250
302
- name : Cache node version manager
251
303
uses : actions/cache@v2
252
304
env :
@@ -277,14 +329,8 @@ jobs:
277
329
${{ runner.os }}-build-
278
330
${{ runner.os }}-
279
331
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
332
+ - name : Dependency Setup
333
+ run : npm install -D babel
288
334
289
335
- name : Static Pipeline Check
290
336
run : bin/static_pipeline
0 commit comments