-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (264 loc) · 8 KB
/
CI.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: CI
on:
# See the documentation for more intricate event dispatch here:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
push:
branches:
- "!dependabot/*"
- "*"
pull_request:
branches:
- "*"
jobs:
build:
name: Format
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==22.3.0
pip install flake8
- name: Check Formatting (Black)
run: |
black --line-length=100 --target-version=py39 --check --diff .
- name: Check Formatting (Flake8)
run: |
# The code-base needs to be cleaned up. There are too many Flake8
# related warnings now. Ignore known problems to catch new ones.
flake8 --ignore=C901,E203,E262,E265,E266,E402,E501,E712,E713,E722,E731,E741,F401,F403,F405,F811,F821,F841,W503
# Run full scan for visibility purposes.
flake8 --exit-zero
- name: Check Requirements are pinned
run: |
# Read each line of requirement.txt and flag if any line doesn't contain ==, @, newline, or #
sed '/^$/d' < requirements.txt | while read i; do if [[ ! $i =~ [==|@|^#] ]]; then echo $i is not pinned; fi; done
pre-commit-checks:
name: Pre-commit checks
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all commits and branches for pre-commit
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up Node 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install npm dependencies
run: cd ./web && npm ci
- name: Run pre-commit checks
uses: pre-commit/[email protected]
with:
extra_args: --from-ref origin/${{ github.base_ref }} --to-ref HEAD --verbose
unit:
name: Unit Test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgpgme-dev libldap2-dev libsasl2-dev swig
cat requirements-dev.txt | grep tox | xargs pip install
- name: tox
run: tox -e py39-unit -- --cov=./ --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
types:
name: Types Test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install libgpgme-dev libldap2-dev libsasl2-dev swig
- name: Check requirements.txt
run: |
pip install wheel # allow pip to use wheel instead of legacy 'setup.py install'
./hack/verify-requirements.sh
- name: Install dependencies
run: |
pip install -r ./requirements-dev.txt
- name: Check Types
run: make types-test
e2e:
name: E2E Tests
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgpgme-dev libldap2-dev libsasl2-dev swig
python -m pip install --upgrade pip
cat requirements-dev.txt | grep tox | xargs pip install
- name: tox
run: tox -e py39-e2e
registry:
name: E2E Registry Tests
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgpgme-dev libldap2-dev libsasl2-dev swig
python -m pip install --upgrade pip
cat requirements-dev.txt | grep tox | xargs pip install
- name: tox
run: tox -e py39-registry
cypress:
name: Cypress Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Build
env:
DOCKER_BUILDKIT: 1
run: docker build -t localhost/quay-local:latest .
- name: Start Quay
run: |
docker compose up -d redis quay-db
docker exec -t quay-db bash -c 'while ! pg_isready; do echo "waiting for postgres"; sleep 2; done'
DOCKER_USER="1001:0" docker compose up -d --no-build quay
- name: Checkout
uses: actions/checkout@v3
- name: Seed Database
run: cd web && npm run quay:seed
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest requests
- name: Integration Test
run: |
docker restart quay-quay
sleep 30
make integration-test
- name: Apply extra config options
run: |
cat web/cypress/test/extra-config.yaml >> local-dev/stack/config.yaml
docker restart quay-quay
sleep 30
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: chrome
build: npm run build
start: npm run start:integration
wait-on: 'http://localhost:9000'
wait-on-timeout: 120
working-directory: web
env:
REACT_QUAY_APP_API_URL: http://localhost:8080
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: web/cypress/screenshots
- uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: web/cypress/videos
- name: Create report
run: |
mkdir -p .logs/
docker logs quay-quay >.logs/quay.log 2>&1 || true
if: always()
- name: Upload Quay logs
uses: actions/upload-artifact@v3
with:
name: logs
path: .logs/
if: always()
mysql:
name: E2E MySQL Test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgpgme-dev libldap2-dev libsasl2-dev swig
sudo systemctl unmask docker
sudo systemctl start docker
docker version
python -m pip install --upgrade pip
cat requirements-dev.txt | grep tox | xargs pip install
- name: tox
run: tox -e py39-mysql
psql:
name: E2E Postgres Test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgpgme-dev libldap2-dev libsasl2-dev swig
sudo systemctl unmask docker
sudo systemctl start docker
docker version
python -m pip install --upgrade pip
cat requirements-dev.txt | grep tox | xargs pip install
- name: tox
run: tox -e py39-psql