-
Notifications
You must be signed in to change notification settings - Fork 116
259 lines (215 loc) · 7.01 KB
/
pr.yml
File metadata and controls
259 lines (215 loc) · 7.01 KB
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
name: PR checks
on: pull_request
env:
SECRET_KEY: insecure_test_key
LP_API_USERNAME: test_lp_user
jobs:
run-image:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- name: Build image
run: DOCKER_BUILDKIT=1 docker build --tag snapcraft-io .
- name: Run image
run: |
docker run -d -p 80:80 --env SECRET_KEY=insecure_secret_key snapcraft-io
sleep 1 && curl --head --fail --retry-delay 5 --retry 10 --retry-connrefused http://localhost
run-dotrun:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- name: Install Dotrun
run: |
sudo pip3 install dotrun requests==2.31.0 # requests version is pinned to avoid breaking changes, can be removed once issue is resolved: https://github.com/docker/docker-py/issues/3256
- name: Install dependencies
run: |
sudo chmod -R 777 .
dotrun install
- name: Build assets
run: dotrun build
- name: Run dotrun
run: |
dotrun &
curl --head --fail --retry-delay 3 --retry 30 --retry-connrefused http://localhost:8004
run-cypress:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# START copy of the run-dotrun job
- uses: actions/checkout@v5
- name: Install Dotrun
run: |
sudo pip3 install dotrun requests==2.31.0 # requests version is pinned to avoid breaking changes, can be removed once issue is resolved: https://github.com/docker/docker-py/issues/3256
- name: Install dependencies
run: |
sudo chmod -R 777 .
dotrun install
- name: Build assets
run: dotrun build
- name: Run dotrun
run: |
dotrun --env ENVIRONMENT="prod" serve &
curl --head --fail --retry-delay 3 --retry 30 --retry-connrefused http://localhost:8004
# END copy of the run-dotrun job
- name: Run Cypress as a Docker container
run: |
docker run --network="host" -v .:/app cypress/base:22.18.0 \
bash "-c" "cd /app && npx cypress install && yarn run test-e2e"
lint-python:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
py:
- '**/*.py'
- name: Install dotrun
if: ${{ steps.filter.outputs.py == 'true' }}
run: sudo pip3 install dotrun
- name: Install dependencies
if: ${{ steps.filter.outputs.py == 'true' }}
run: |
sudo chmod -R 777 .
dotrun install
- name: Build assets
if: ${{ steps.filter.outputs.py == 'true' }}
run: dotrun build
- name: Lint python
if: ${{ steps.filter.outputs.py == 'true' }}
run: dotrun lint-python
lint-scss:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
scss:
- '**/*.scss'
- name: Install SCSS dependencies
if: ${{ steps.filter.outputs.scss == 'true' }}
run: yarn install --immutable
- name: Lint SCSS
if: ${{ steps.filter.outputs.scss == 'true' }}
run: yarn lint-scss
lint-js:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
js:
- '**/*.js'
ts:
- '**/*.ts'
jsx:
- '**/*.jsx'
tsx:
- '**/*.tsx'
- name: Install JS dependencies
if: ${{ steps.filter.outputs.js == 'true' || steps.filter.outputs.ts == 'true' || steps.filter.outputs.jsx == 'true' || steps.filter.outputs.tsx == 'true' }}
run: yarn install --immutable
- name: Lint JS
if: ${{ steps.filter.outputs.js == 'true' || steps.filter.outputs.ts == 'true' || steps.filter.outputs.jsx == 'true' || steps.filter.outputs.tsx == 'true' }}
run: yarn lint-js
test-python:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
py:
- '**/*.py'
- name: Install dotrun
if: ${{ steps.filter.outputs.py == 'true' }}
run: sudo pip3 install dotrun
- name: Install dependencies
if: ${{ steps.filter.outputs.py == 'true' }}
run: |
sudo chmod -R 777 .
dotrun install
- name: Install dependencies
if: ${{ steps.filter.outputs.py == 'true' }}
run: sudo pip3 install coverage
- name: Build resources
if: ${{ steps.filter.outputs.py == 'true' }}
run: dotrun build
- name: Run python tests with coverage
if: ${{ steps.filter.outputs.py == 'true' }}
run: dotrun test-python-job
- name: Upload coverage to Codecov
if: ${{ steps.filter.outputs.py == 'true' }}
uses: codecov/codecov-action@v5
with:
flags: python
test-js:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
js:
- '**/*.js'
ts:
- '**/*.ts'
jsx:
- '**/*.jsx'
tsx:
- '**/*.tsx'
- uses: actions/setup-node@v6
with:
node-version: 20
- name: Install dependencies
if: ${{ steps.filter.outputs.js == 'true' || steps.filter.outputs.ts == 'true' || steps.filter.outputs.jsx == 'true' || steps.filter.outputs.tsx == 'true' }}
run: yarn install --immutable
- name: Run JS tests with coverage
if: ${{ steps.filter.outputs.js == 'true' || steps.filter.outputs.ts == 'true' || steps.filter.outputs.jsx == 'true' || steps.filter.outputs.tsx == 'true' }}
run: |
yarn test-js --coverage
- name: Upload coverage to Codecov
if: ${{ steps.filter.outputs.js == 'true' || steps.filter.outputs.ts == 'true' || steps.filter.outputs.jsx == 'true' || steps.filter.outputs.tsx == 'true' }}
uses: codecov/codecov-action@v5
with:
flags: javascript
check-inclusive-naming:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check inclusive naming
uses: canonical/inclusive-naming@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
fail-on-error: true