3
3
on : [push, pull_request]
4
4
5
5
env :
6
- CACHE_SEED : 1
6
+ PYTHON_VERSION : 3.8.2
7
7
NODE_VERSION : 14.4.0
8
8
9
9
jobs :
@@ -26,84 +26,70 @@ jobs:
26
26
27
27
- uses : actions/setup-python@v2
28
28
with :
29
- python-version : 3.8
29
+ python-version : ${{ env.PYTHON_VERSION }}
30
30
31
31
- name : Cache pip dependencies
32
32
uses : actions/cache@v2
33
33
env :
34
- cache-name : cache-pip-tests-warehouse-p
34
+ cache-name : warehouse- cache-pip
35
35
with :
36
- path : . /.cache/pip
37
- key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
36
+ path : ~ /.cache/pip
37
+ key : ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
38
38
restore-keys : |
39
- ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
40
- ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-
41
- ${{ runner.os }}-${{ env.CACHE_SEED }}-
39
+ ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
40
+ ${{ runner.os }}-${{ github.job }}-
42
41
${{ runner.os }}-
43
42
44
43
- name : Cache node version manager
45
44
uses : actions/cache@v2
46
45
env :
47
- cache-name : cache-nvm-dh
46
+ cache-name : warehouse- cache-nvm
48
47
with :
49
48
path : ~/.nvm/versions/
50
- key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
49
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
51
50
restore-keys : |
52
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
53
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-
54
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-
51
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
52
+ ${{ runner.os }}-build-${{ github.job }}-
55
53
${{ runner.os }}-build-
56
54
${{ runner.os }}-
57
55
58
56
- name : Cache node modules
59
57
uses : actions/cache@v2
60
58
env :
61
- cache-name : cache-npm-modules-dh
59
+ cache-name : warehouse- cache-npm-modules
62
60
with :
63
61
path : |
64
62
~/.npm
65
63
**/node_modules
66
- key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
64
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
67
65
restore-keys : |
68
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
69
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-
70
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-
66
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
67
+ ${{ runner.os }}-build-${{ github.job }}-
71
68
${{ runner.os }}-build-
72
69
${{ runner.os }}-
73
70
71
+ - uses : actions/setup-node@v1
72
+ with :
73
+ node-version : ${{ env.NODE_VERSION }}
74
+
74
75
- name : Install dependencies
75
76
run : sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
76
77
77
78
- name : Install pip requirements
78
79
run : |
79
- mkdir ./.cache && mkdir ./.cache/pip
80
- chown -R $(whoami) ./.cache/pip
81
- pip install -U pip setuptools wheel --cache-dir ./.cache/pip
82
- pip install -r requirements/main.txt --cache-dir ./.cache/pip
83
- pip install -r requirements/tests.txt --cache-dir ./.cache/pip
84
- pip install -r requirements/deploy.txt --cache-dir ./.cache/pip
80
+ pip install -U pip setuptools wheel
81
+ pip install -r requirements/main.txt
82
+ pip install -r requirements/tests.txt
83
+ pip install -r requirements/deploy.txt
85
84
86
85
- name : Setup node
87
86
run : |
88
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
89
- export NVM_DIR="$HOME/.nvm"
90
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
91
- [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
92
- nvm install $NODE_VERSION
93
87
npm i -g npm
94
88
npm install -g gulp-cli
95
89
npm ci
96
90
97
91
- name : Run tests
98
- run : |
99
- python -m coverage run -m pytest --strict --postgresql-host localhost
100
- python -m coverage html
101
- python -m coverage report -m --fail-under 100
102
- env :
103
- # The hostname used to communicate with the PostgreSQL service container
104
- POSTGRES_HOST : localhost
105
- # The default PostgreSQL port
106
- POSTGRES_PORT : 5432
92
+ run : bin/tests
107
93
108
94
lint :
109
95
runs-on : ubuntu-latest
@@ -113,12 +99,42 @@ jobs:
113
99
114
100
- uses : actions/setup-python@v2
115
101
with :
116
- python-version : 3.8
102
+ python-version : ${{ env.PYTHON_VERSION }}
117
103
118
- - name : Lint
104
+ - name : Cache pip dependencies
105
+ uses : actions/cache@v2
106
+ env :
107
+ cache-name : warehouse-cache-pip
108
+ with :
109
+ path : ~/.cache/pip
110
+ key : ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
111
+ restore-keys : |
112
+ ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
113
+ ${{ runner.os }}-${{ github.job }}-
114
+ ${{ runner.os }}-
115
+
116
+ - name : Cache node modules
117
+ uses : actions/cache@v2
118
+ env :
119
+ cache-name : warehouse-cache-node-modules
120
+ with :
121
+ path : |
122
+ ~/.npm
123
+ **/node_modules
124
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
125
+ restore-keys : |
126
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
127
+ ${{ runner.os }}-build-${{ github.job }}-
128
+ ${{ runner.os }}-build-
129
+ ${{ runner.os }}-
130
+
131
+ - name : Dependency setup
119
132
run : |
133
+ npm install eslint --save-dev
120
134
sudo apt-get update && sudo apt-get install make
121
- make lint ACTIONS=true
135
+
136
+ - name : Lint
137
+ run : make lint ACTIONS=true
122
138
123
139
docs :
124
140
runs-on : ubuntu-latest
@@ -128,7 +144,7 @@ jobs:
128
144
129
145
- uses : actions/setup-python@v2
130
146
with :
131
- python-version : 3.8
147
+ python-version : ${{ env.PYTHON_VERSION }}
132
148
133
149
- name : Documentation
134
150
run : |
@@ -143,26 +159,20 @@ jobs:
143
159
144
160
- uses : actions/setup-python@v2
145
161
with :
146
- python-version : 3.8
162
+ python-version : ${{ env.PYTHON_VERSION }}
147
163
148
164
- name : Cache pip dependencies
149
165
uses : actions/cache@v2
150
166
env :
151
- cache-name : cache-pip-deps-warehouse-p
167
+ cache-name : warehouse- cache-pip
152
168
with :
153
169
path : ~/.cache/pip
154
- key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
170
+ key : ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
155
171
restore-keys : |
156
- ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
157
- ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-
158
- ${{ runner.os }}-${{ env.CACHE_SEED }}-
172
+ ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
173
+ ${{ runner.os }}-${{ github.job }}-
159
174
${{ runner.os }}-
160
175
161
- - name : Set cache permissions
162
- run : |
163
- mkdir ~/.cache && mkdir ~/.cache/pip
164
- chown -R $(whoami) ~/.cache/pip
165
-
166
176
- name : Check dependencies
167
177
run : |
168
178
sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
@@ -185,47 +195,51 @@ jobs:
185
195
186
196
- uses : actions/setup-python@v2
187
197
with :
188
- python-version : 3.8
198
+ python-version : ${{ env.PYTHON_VERSION }}
189
199
190
200
- name : Check translations
191
201
run : make translations
192
202
193
- static-lint :
194
- runs-on : ubuntu-latest
195
- steps :
196
- - name : Check out repository
197
- uses : actions/checkout@v2
198
-
199
- - name : Static Lint Check
200
- run : |
201
- npm install eslint --save-dev
202
- ./node_modules/.bin/eslint 'warehouse/static/js/**' '**.js' 'tests/frontend/**' --ignore-pattern 'warehouse/static/js/vendor/**'
203
- ./node_modules/.bin/sass-lint --verbose
204
-
205
203
static-tests :
206
204
runs-on : ubuntu-latest
207
205
steps :
208
206
- name : Check out repository
209
207
uses : actions/checkout@v2
210
208
209
+ - name : Cache node version manager
210
+ uses : actions/cache@v2
211
+ env :
212
+ cache-name : warehouse-cache-nvm
213
+ with :
214
+ path : ~/.nvm/versions/
215
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
216
+ restore-keys : |
217
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
218
+ ${{ runner.os }}-build-${{ github.job }}-
219
+ ${{ runner.os }}-build-
220
+ ${{ runner.os }}-
221
+
211
222
- name : Cache node modules
212
223
uses : actions/cache@v2
213
224
env :
214
- cache-name : cache-node -modules-static-dh
225
+ cache-name : warehouse- cache-npm -modules-static
215
226
with :
216
227
path : |
217
228
~/.npm
218
229
**/node_modules
219
- key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
230
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
220
231
restore-keys : |
221
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
222
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-
223
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-
232
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
233
+ ${{ runner.os }}-build-${{ github.job }}-
224
234
${{ runner.os }}-build-
225
235
${{ runner.os }}-
226
236
227
- - name : Dependency Setup
228
- run : npm install -D babel
237
+ - uses : actions/setup-node@v1
238
+ with :
239
+ node-version : ${{ env.NODE_VERSION }}
240
+
241
+ - name : Node dependency setup
242
+ run : npm ci
229
243
230
244
- name : Static Tests
231
245
run : bin/static_tests
@@ -239,35 +253,37 @@ jobs:
239
253
- name : Cache node version manager
240
254
uses : actions/cache@v2
241
255
env :
242
- cache-name : cache-nvm-pipeline-dh
256
+ cache-name : warehouse- cache-nvm
243
257
with :
244
258
path : ~/.nvm/versions/
245
- key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
259
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
246
260
restore-keys : |
247
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
248
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-
249
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-
261
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
262
+ ${{ runner.os }}-build-${{ github.job }}-
250
263
${{ runner.os }}-build-
251
264
${{ runner.os }}-
252
265
253
266
- name : Cache node modules
254
267
uses : actions/cache@v2
255
268
env :
256
- cache-name : cache-node -modules-static-dh
269
+ cache-name : warehouse- cache-npm -modules
257
270
with :
258
271
path : |
259
272
~/.npm
260
273
**/node_modules
261
- key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
274
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
262
275
restore-keys : |
263
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
264
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-
265
- ${{ runner.os }}-build-${{ env.CACHE_SEED }}-
276
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
277
+ ${{ runner.os }}-build-${{ github.job }}-
266
278
${{ runner.os }}-build-
267
279
${{ runner.os }}-
268
280
269
- - name : Dependency Setup
270
- run : npm install -D babel
281
+ - uses : actions/setup-node@v1
282
+ with :
283
+ node-version : ${{ env.NODE_VERSION }}
284
+
285
+ - name : Node dependency setup
286
+ run : npm ci
271
287
272
288
- name : Static Pipeline Check
273
- run : bin/static_pipeline # this periodically fails for no reason, just rerun the job if needed
289
+ run : bin/static_pipeline
0 commit comments