-
Notifications
You must be signed in to change notification settings - Fork 208
235 lines (175 loc) · 5.61 KB
/
pr.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
name: PR checks
on: [push, pull_request]
env:
SECRET_KEY: insecure_test_key
jobs:
run-image:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Build image
run: DOCKER_BUILDKIT=1 docker build --tag ubuntu-com .
- name: Run image
run: |
docker run --env SECRET_KEY=insecure_secret_key --network host ubuntu-com &
sleep 1
curl --head --fail --retry-delay 1 --retry 30 --retry-connrefused http://localhost
run-dotrun:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 1 --retry 30 --retry-connrefused http://localhost:8001
lint-scss:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: yarn install --immutable
- name: Lint scss
run: yarn lint-scss
check-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: yarn install --immutable
- name: Check Prettier
run: yarn check-prettier
lint-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dotrun
run: sudo pip3 install dotrun
- name: Install dependencies
run: |
sudo chmod -R 777 .
dotrun install
- name: Build assets
run: dotrun build
- name: Lint python
run: dotrun lint-python
lint-jinja:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install node dependencies
run: yarn install --immutable
- name: Install python dependencies
run: |
python3 -m pip install --upgrade pip
sudo pip3 install djlint
- name: Get changed HTML files in the templates folder
id: changed-files
uses: tj-actions/changed-files@v43
with:
files: templates/**/*.html
- name: Lint jinja
if: steps.changed-files.outputs.any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "The following files have changed: $CHANGED_FILES"
djlint $CHANGED_FILES --lint --profile="jinja"
validate-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install konf
run: |
sudo snap install konf
sudo chown root:root /
- name: Install Kubeval
run: |
wget https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz
tar xf kubeval-linux-amd64.tar.gz
sudo cp kubeval /usr/local/bin
- name: Validate all sites
run: |
konf staging deploy/site.yaml | kubeval -f -
konf production deploy/site.yaml | kubeval -f -
test-python:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for codecov
- name: Install requirements
run: |
sudo apt-get update && sudo apt-get install --yes python3-setuptools
sudo pip3 install -r requirements.txt
- 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 node dependencies
run: |
sudo chmod -R 777 .
dotrun install
- name: Install dependencies
run: dotrun exec pip3 install coverage
- name: Build resources
run: dotrun build
- name: Run tests with coverage
run: dotrun --env SEARCH_API_KEY=fake-key exec coverage run --source=. --module unittest discover tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: python
test-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for codecov
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: yarn install --immutable
- name: Test JS
run: |
yarn test-js --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: javascript
lint-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: yarn install --immutable
- name: Lint JS
run: |
yarn lint-js
lint-ts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: yarn install --immutable
- name: Lint TS
run: |
yarn lint-ts
Inclusive-naming-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: woke
uses: canonical-web-and-design/inclusive-naming@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
fail-on-error: false