@@ -4,6 +4,7 @@ on: [push, pull_request]
4
4
5
5
env :
6
6
CACHE_SEED : 1
7
+ PYTHON_VERSION : 3.8.2
7
8
NODE_VERSION : 14.4.0
8
9
9
10
jobs :
@@ -26,14 +27,14 @@ jobs:
26
27
27
28
- uses : actions/setup-python@v2
28
29
with :
29
- python-version : 3.8
30
+ python-version : ${{ env.PYTHON_VERSION }}
30
31
31
32
- name : Cache pip dependencies
32
33
uses : actions/cache@v2
33
34
env :
34
- cache-name : cache-pip-tests-warehouse-p
35
+ cache-name : cache-pip-warehouse- tests-native-1 # TODO: remove native
35
36
with :
36
- path : . /.cache/pip
37
+ path : ~ /.cache/pip
37
38
key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
38
39
restore-keys : |
39
40
${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
@@ -71,25 +72,22 @@ jobs:
71
72
${{ runner.os }}-build-
72
73
${{ runner.os }}-
73
74
75
+ - uses : actions/setup-node@v1
76
+ with :
77
+ node-version : ${{ env.NODE_VERSION }}
78
+
74
79
- name : Install dependencies
75
80
run : sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
76
81
77
82
- name : Install pip requirements
78
83
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
84
+ pip install -U pip setuptools wheel
85
+ pip install -r requirements/main.txt
86
+ pip install -r requirements/tests.txt
87
+ pip install -r requirements/deploy.txt
85
88
86
89
- name : Setup node
87
90
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
91
npm i -g npm
94
92
npm install -g gulp-cli
95
93
npm ci
99
97
python -m coverage run -m pytest --strict --postgresql-host localhost
100
98
python -m coverage html
101
99
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
107
100
108
101
lint :
109
102
runs-on : ubuntu-latest
@@ -113,12 +106,42 @@ jobs:
113
106
114
107
- uses : actions/setup-python@v2
115
108
with :
116
- python-version : 3.8
109
+ python-version : ${{ env.PYTHON_VERSION }}
117
110
118
- - name : Lint
111
+ - name : Cache pip dependencies
112
+ uses : actions/cache@v2
113
+ env :
114
+ cache-name : cache-pip-warehouse-lint
115
+ with :
116
+ path : ~/.cache/pip
117
+ key : ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
118
+ restore-keys : |
119
+ ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
120
+ ${{ runner.os }}-${{ github.job }}-
121
+ ${{ runner.os }}-
122
+
123
+ - name : Cache node modules
124
+ uses : actions/cache@v2
125
+ env :
126
+ cache-name : cache-node-modules-lint
127
+ with :
128
+ path : |
129
+ ~/.npm
130
+ **/node_modules
131
+ key : ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
132
+ restore-keys : |
133
+ ${{ runner.os }}-build-${{ github.job }}-${{ env.cache-name }}-
134
+ ${{ runner.os }}-build-${{ github.job }}-
135
+ ${{ runner.os }}-build-
136
+ ${{ runner.os }}-
137
+
138
+ - name : Dependency setup
119
139
run : |
140
+ npm install eslint --save-dev
120
141
sudo apt-get update && sudo apt-get install make
121
- make lint ACTIONS=true
142
+
143
+ - name : Lint
144
+ run : make lint ACTIONS=true
122
145
123
146
docs :
124
147
runs-on : ubuntu-latest
@@ -128,7 +151,7 @@ jobs:
128
151
129
152
- uses : actions/setup-python@v2
130
153
with :
131
- python-version : 3.8
154
+ python-version : ${{ env.PYTHON_VERSION }}
132
155
133
156
- name : Documentation
134
157
run : |
@@ -143,12 +166,12 @@ jobs:
143
166
144
167
- uses : actions/setup-python@v2
145
168
with :
146
- python-version : 3.8
169
+ python-version : ${{ env.PYTHON_VERSION }}
147
170
148
171
- name : Cache pip dependencies
149
172
uses : actions/cache@v2
150
173
env :
151
- cache-name : cache-pip-deps-warehouse-p
174
+ cache-name : cache-pip-deps-warehouse-native-2 # TODO: remove native 2
152
175
with :
153
176
path : ~/.cache/pip
154
177
key : ${{ runner.os }}-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
@@ -158,11 +181,6 @@ jobs:
158
181
${{ runner.os }}-${{ env.CACHE_SEED }}-
159
182
${{ runner.os }}-
160
183
161
- - name : Set cache permissions
162
- run : |
163
- mkdir ~/.cache && mkdir ~/.cache/pip
164
- chown -R $(whoami) ~/.cache/pip
165
-
166
184
- name : Check dependencies
167
185
run : |
168
186
sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config
@@ -185,33 +203,35 @@ jobs:
185
203
186
204
- uses : actions/setup-python@v2
187
205
with :
188
- python-version : 3.8
206
+ python-version : ${{ env.PYTHON_VERSION }}
189
207
190
208
- name : Check translations
191
209
run : make translations
192
210
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
211
static-tests :
206
212
runs-on : ubuntu-latest
207
213
steps :
208
214
- name : Check out repository
209
215
uses : actions/checkout@v2
210
216
217
+ - name : Cache node version manager
218
+ uses : actions/cache@v2
219
+ env :
220
+ cache-name : cache-nvm-static-dh
221
+ with :
222
+ path : ~/.nvm/versions/
223
+ key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
224
+ restore-keys : |
225
+ ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-
226
+ ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-
227
+ ${{ runner.os }}-build-${{ env.CACHE_SEED }}-
228
+ ${{ runner.os }}-build-
229
+ ${{ runner.os }}-
230
+
211
231
- name : Cache node modules
212
232
uses : actions/cache@v2
213
233
env :
214
- cache-name : cache-node -modules-static-dh
234
+ cache-name : cache-npm -modules-static-dh
215
235
with :
216
236
path : |
217
237
~/.npm
@@ -224,8 +244,12 @@ jobs:
224
244
${{ runner.os }}-build-
225
245
${{ runner.os }}-
226
246
227
- - name : Dependency Setup
228
- run : npm install -D babel
247
+ - uses : actions/setup-node@v1
248
+ with :
249
+ node-version : ${{ env.NODE_VERSION }}
250
+
251
+ - name : Node dependency setup
252
+ run : npm ci
229
253
230
254
- name : Static Tests
231
255
run : bin/static_tests
@@ -239,7 +263,7 @@ jobs:
239
263
- name : Cache node version manager
240
264
uses : actions/cache@v2
241
265
env :
242
- cache-name : cache-nvm-pipeline -dh
266
+ cache-name : cache-nvm-static -dh
243
267
with :
244
268
path : ~/.nvm/versions/
245
269
key : ${{ runner.os }}-build-${{ env.CACHE_SEED }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
@@ -253,7 +277,7 @@ jobs:
253
277
- name : Cache node modules
254
278
uses : actions/cache@v2
255
279
env :
256
- cache-name : cache-node -modules-static-dh
280
+ cache-name : cache-npm -modules-static-dh
257
281
with :
258
282
path : |
259
283
~/.npm
@@ -266,8 +290,12 @@ jobs:
266
290
${{ runner.os }}-build-
267
291
${{ runner.os }}-
268
292
269
- - name : Dependency Setup
270
- run : npm install -D babel
293
+ - uses : actions/setup-node@v1
294
+ with :
295
+ node-version : ${{ env.NODE_VERSION }}
296
+
297
+ - name : Node dependency setup
298
+ run : npm ci
271
299
272
300
- name : Static Pipeline Check
273
- run : bin/static_pipeline # this periodically fails for no reason, just rerun the job if needed
301
+ run : bin/static_pipeline
0 commit comments