-
Notifications
You must be signed in to change notification settings - Fork 36
313 lines (289 loc) · 11.7 KB
/
pull-request-test.yml
File metadata and controls
313 lines (289 loc) · 11.7 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
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
name: Test PR
permissions:
contents: read
pull-requests: read
on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
- edited
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
docs: ${{ steps.filter.outputs.docs }}
steps:
# For pull requests it's not necessary to check out the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- 'docs/**'
test-docs:
needs: changes
name: Documentation
runs-on: ubuntu-24.04
if: ${{github.event.action != 'closed' && needs.changes.outputs.docs == 'true'}}
defaults:
run:
working-directory: docs/
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
run: npm clean-install
- name: Check docs formatting
run: npm run format:check
- name: Test docs spelling
run: npm run spell-check
- name: Test the docs build
run: npm run build
check-deploy:
name: Analyze deploy strings
runs-on: ubuntu-24.04
outputs:
deploy: ${{ steps.deploy-comment.outputs.pr-contains-string }}
renku-core: ${{ steps.deploy-comment.outputs.renku-core }}
renku-gateway: ${{ steps.deploy-comment.outputs.renku-gateway }}
renku-graph: ${{ steps.deploy-comment.outputs.renku-graph }}
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks }}
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui }}
renku-data-services: ${{ steps.deploy-comment.outputs.renku-data-services }}
amalthea: ${{ steps.deploy-comment.outputs.amalthea }}
amalthea-sessions: ${{ steps.deploy-comment.outputs.amalthea-sessions }}
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled == 'true' }}
test-slow-enabled: ${{ steps.deploy-comment.outputs.test-slow-enabled == 'true' }}
extra-values: ${{ steps.deploy-comment.outputs.extra-values }}
steps:
- id: deploy-comment
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.23.0
with:
pr_ref: ${{ github.event.number }}
deploy-pr:
name: Deploy on Azure
runs-on: ubuntu-24.04
needs: [check-deploy]
permissions:
pull-requests: write
id-token: write
if: github.event.action != 'closed'
steps:
- uses: actions/checkout@v5
- name: Find deployment url
if: needs.check-deploy.outputs.deploy == 'true'
uses: peter-evans/find-comment@v3
id: deploymentUrlMessage
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "RenkuBot"
body-includes: "You can access the deployment of this PR at"
- name: Create comment deployment url
if: steps.deploymentUrlMessage.outputs.comment-id == 0 &&
needs.check-deploy.outputs.deploy == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
You can access the deployment of this PR at ${{ format('https://ci-renku-{0}.dev.renku.ch', github.event.number) }}
- name: Azure login
if: needs.check-deploy.outputs.deploy == 'true'
uses: azure/login@v2
with:
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
- uses: azure/aks-set-context@v4
if: needs.check-deploy.outputs.deploy == 'true'
with:
resource-group: "renku-dev"
cluster-name: "aks-switzerlandnorth-renku-dev"
- name: Get AKS credentials
if: needs.check-deploy.outputs.deploy == 'true'
run: |
az aks get-credentials --resource-group renku-dev --name aks-switzerlandnorth-renku-dev --file "${{ github.workspace }}/renkubot-kube.config"
chmod 400 "${{ github.workspace }}/renkubot-kube.config"
- name: renku build and deploy
if: needs.check-deploy.outputs.deploy == 'true'
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.23.0
env:
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
KUBECONFIG: "${{ github.workspace }}/renkubot-kube.config"
RENKU_RELEASE: ci-renku-${{ github.event.number }}
RENKU_VALUES_FILE: "${{ github.workspace }}/values.yaml"
RENKU_VALUES: minimal-deployment/minimal-deployment-values.yaml
TEST_ARTIFACTS_PATH: "tests-artifacts-${{ github.sha }}"
KUBERNETES_CLUSTER_FQDN: "dev.renku.ch"
RENKU_ANONYMOUS_SESSIONS: "true"
renku: "@${{ github.head_ref }}"
renku_core: "${{ needs.check-deploy.outputs.renku-core }}"
renku_gateway: "${{ needs.check-deploy.outputs.renku-gateway }}"
renku_graph: "${{ needs.check-deploy.outputs.renku-graph }}"
renku_notebooks: "${{ needs.check-deploy.outputs.renku-notebooks }}"
renku_ui: "${{ needs.check-deploy.outputs.renku-ui }}"
renku_data_services: "${{ needs.check-deploy.outputs.renku-data-services }}"
amalthea: "${{ needs.check-deploy.outputs.amalthea }}"
amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}"
extra_values: "${{ needs.check-deploy.outputs.extra-values }}"
cypress-acceptance-tests:
name: Cypress acceptance tests
runs-on: ubuntu-24.04
needs: [check-deploy, deploy-pr]
strategy:
fail-fast: false
matrix:
tests:
[
anonymousNavigation,
codeRepositories,
dashboard,
dataConnectors,
groups,
projects,
search,
sessionLaunchers,
sessions,
]
steps:
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.23.0
if: github.event.action != 'closed' && needs.check-deploy.outputs.deploy == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
with:
e2e-folder: cypress/e2e/v2/
e2e-target: ${{ matrix.tests }}
kubernetes-cluster-fqdn: ${{ needs.check-deploy.outputs.deploy == 'true' && 'dev.renku.ch' }}
renku-reference: ${{ github.ref }}
renku-release: ci-renku-${{ github.event.number }}
test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }}
cypress-acceptance-tests-slow:
name: Cypress slow acceptance tests
if: github.event.action != 'closed' && needs.check-deploy.outputs.deploy == 'true' && needs.check-deploy.outputs.test-enabled == 'true' && needs.check-deploy.outputs.test-slow-enabled == 'true'
runs-on: ubuntu-24.04
needs: [check-deploy, deploy-pr]
permissions:
pull-requests: write
id-token: write
env:
KUBECONFIG: "${{ github.workspace }}/renkubot-kube.config"
strategy:
fail-fast: false
matrix:
tests: [sessions, sessionSecrets]
steps:
- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
- name: Set AKS context
uses: azure/aks-set-context@v4
with:
resource-group: "renku-dev"
cluster-name: "aks-switzerlandnorth-renku-dev"
- name: Get AKS credentials
run: |
az aks get-credentials --resource-group renku-dev --name aks-switzerlandnorth-renku-dev --file "${{ github.workspace }}/renkubot-kube.config"
chmod 400 "${{ github.workspace }}/renkubot-kube.config"
- name: Install kubectl
uses: azure/setup-kubectl@v4
with:
version: "latest"
- name: Check kubectl config and access to cluster
run: kubectl get pods -A
- name: Run Cypress slow tests
uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.23.0
with:
e2e-folder: cypress/e2e/slow/
e2e-target: ${{ matrix.tests }}
kubernetes-cluster-fqdn: ${{ needs.check-deploy.outputs.deploy == 'true' && 'dev.renku.ch' }}
renku-reference: ${{ github.ref }}
renku-release: ci-renku-${{ github.event.number }}
test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }}
deploy-string-no-custom-version:
name: Ensure no custom components
runs-on: ubuntu-24.04
needs: [check-deploy]
steps:
- name: Check deploy string
if: ${{
needs.check-deploy.outputs.deploy == 'true'
&& startsWith(github.base_ref, 'release-')
&& (
needs.check-deploy.outputs.renku-core != null
|| needs.check-deploy.outputs.renku-gateway != null
|| needs.check-deploy.outputs.renku-graph != null
|| needs.check-deploy.outputs.renku-notebooks != null
|| needs.check-deploy.outputs.renku-ui != null
|| needs.check-deploy.outputs.renku-data-services != null
)
}}
uses: actions/github-script@v7
with:
script: core.setFailed('Cannot merge release PR if it still has custom versions in deploy string.')
cleanup:
name: Cleanup
runs-on: ubuntu-24.04
needs: [check-deploy]
if: github.event.action == 'closed' && needs.check-deploy.outputs.deploy == 'true'
permissions:
pull-requests: write
id-token: write
steps:
- name: Find deployment url
uses: peter-evans/find-comment@v3
id: deploymentUrlMessage
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "RenkuBot"
body-includes: "Tearing down the temporary RenkuLab deployment"
- name: Create comment deployment url
if: steps.deploymentUrlMessage.outputs.comment-id == 0
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Tearing down the temporary RenkuLab deployment for this PR.
# Azure-specific setup
- name: Azure login
if: needs.check-deploy.outputs.deploy == 'true'
uses: azure/login@v2
with:
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
- uses: azure/aks-set-context@v4
if: needs.check-deploy.outputs.deploy == 'true'
with:
resource-group: "renku-dev"
cluster-name: "aks-switzerlandnorth-renku-dev"
- name: Get AKS credentials
if: needs.check-deploy.outputs.deploy == 'true'
run: |
az aks get-credentials --resource-group renku-dev --name aks-switzerlandnorth-renku-dev --file "${{ github.workspace }}/renkubot-kube.config"
chmod 400 "${{ github.workspace }}/renkubot-kube.config"
# Cleanup Azure deployments
- name: renku teardown
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.23.0
env:
HELM_RELEASE_REGEX: "^ci-renku-${{ github.event.number }}$"
KUBECONFIG: "${{ github.workspace }}/renkubot-kube.config"
MAX_AGE_SECONDS: 0
DELETE_NAMESPACE: "true"