Skip to content

Commit c5f6eb5

Browse files
committed
WIP: create action to deploy and test on Azure
1 parent fed07a3 commit c5f6eb5

1 file changed

Lines changed: 204 additions & 0 deletions

File tree

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: Test PR
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- closed
9+
- edited
10+
merge_group:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
check-deploy:
18+
name: Analyze deploy string
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
pr-contains-string: ${{ steps.deploy-comment.outputs.pr-contains-string }}
22+
renku-core: ${{ steps.deploy-comment.outputs.renku-core}}
23+
renku-gateway: ${{ steps.deploy-comment.outputs.renku-gateway}}
24+
renku-graph: ${{ steps.deploy-comment.outputs.renku-graph}}
25+
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks}}
26+
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui}}
27+
renku-data-services: ${{ steps.deploy-comment.outputs.renku-data-services}}
28+
amalthea: ${{ steps.deploy-comment.outputs.amalthea}}
29+
amalthea-sessions: ${{ steps.deploy-comment.outputs.amalthea-sessions}}
30+
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled}}
31+
extra-values: ${{ steps.deploy-comment.outputs.extra-values}}
32+
steps:
33+
- uses: actions/checkout@v4.1.7
34+
- id: deploy-comment
35+
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.15.1
36+
with:
37+
string: /deployAzure
38+
pr_ref: ${{ github.event.number }}
39+
40+
deploy-pr:
41+
name: Deploy
42+
if: github.event.action != 'closed'
43+
needs: [check-deploy]
44+
runs-on: ubuntu-24.04
45+
environment:
46+
name: ci-renku-${{ github.event.number }}
47+
url: https://ci-renku-${{ github.event.number }}.dev.renku.ch
48+
steps:
49+
- name: Azure login
50+
uses: azure/login@v2
51+
with:
52+
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
53+
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
54+
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
55+
- uses: azure/aks-set-context@v4
56+
with:
57+
resource-group: "renku-dev"
58+
cluster-name: "aks-switzerlandnorth-renku-dev"
59+
- uses: actions/checkout@v4.1.7
60+
- run: ls $KUBECONFIG
61+
- name: renku build and deploy
62+
if: needs.check-deploy.outputs.pr-contains-string == 'true'
63+
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.15.1
64+
env:
65+
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
66+
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
67+
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
68+
KUBECONFIG: $KUBECONFIG
69+
RENKU_ANONYMOUS_SESSIONS: true
70+
RENKU_RELEASE: ci-renku-${{ github.event.number }}
71+
RENKU_VALUES_FILE: "${{ github.workspace }}/values.yaml"
72+
RENKU_VALUES: minimal-deployment/minimal-deployment-values.yaml
73+
RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
74+
TEST_ARTIFACTS_PATH: "tests-artifacts-${{ github.sha }}"
75+
renku: "@${{ github.head_ref }}"
76+
renku_core: "${{ needs.check-deploy.outputs.renku-core }}"
77+
renku_gateway: "${{ needs.check-deploy.outputs.renku-gateway }}"
78+
renku_graph: "${{ needs.check-deploy.outputs.renku-graph }}"
79+
renku_notebooks: "${{ needs.check-deploy.outputs.renku-notebooks }}"
80+
renku_ui: "${{ needs.check-deploy.outputs.renku-ui }}"
81+
renku_data_services: "${{ needs.check-deploy.outputs.renku-data-services }}"
82+
amalthea: "${{ needs.check-deploy.outputs.amalthea }}"
83+
amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}"
84+
extra_values: "${{ needs.check-deploy.outputs.extra-values }}"
85+
- name: Check existing renkubot comment
86+
if: needs.check-deploy.outputs.pr-contains-string == 'true'
87+
uses: peter-evans/find-comment@v3
88+
id: findcomment
89+
with:
90+
issue-number: ${{ github.event.pull_request.number }}
91+
comment-author: "RenkuBot"
92+
- name: Create comment pre deploy
93+
if: ${{ steps.findcomment.outputs.comment-id == 0 &&
94+
needs.check-deploy.outputs.pr-contains-string == 'true' }}
95+
uses: peter-evans/create-or-update-comment@v4
96+
with:
97+
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
98+
issue-number: ${{ github.event.pull_request.number }}
99+
body: |
100+
You can access the deployment of this PR at https://ci-renku-${{ github.event.number }}.dev.renku.ch
101+
102+
test-pr:
103+
name: Legacy Scala tests
104+
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
105+
needs: [check-deploy, deploy-pr]
106+
runs-on: ubuntu-24.04
107+
steps:
108+
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.15.1
109+
with:
110+
kubeconfig: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
111+
renku-release: ci-renku-${{ github.event.number }}
112+
gitlab-token: ${{ secrets.DEV_GITLAB_TOKEN }}
113+
s3-results-access-key: ${{ secrets.ACCEPTANCE_TESTS_BUCKET_ACCESS_KEY }}
114+
s3-results-secret-key: ${{ secrets.ACCEPTANCE_TESTS_BUCKET_SECRET_KEY }}
115+
test-timeout-mins: "120"
116+
117+
legacy-cypress-acceptance-tests:
118+
name: Legacy Cypress tests
119+
needs: [check-deploy, deploy-pr]
120+
runs-on: ubuntu-24.04
121+
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
tests:
126+
[
127+
publicProject,
128+
privateProject,
129+
updateProjects,
130+
testDatasets,
131+
useSession,
132+
checkWorkflows,
133+
rstudioSession,
134+
]
135+
steps:
136+
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.15.1
137+
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
138+
with:
139+
e2e-target: ${{ matrix.tests }}
140+
renku-reference: ${{ github.ref }}
141+
renku-release: ci-renku-${{ github.event.number }}
142+
test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }}
143+
144+
cypress-acceptance-tests:
145+
name: Cypress tests
146+
needs: [check-deploy, deploy-pr]
147+
runs-on: ubuntu-24.04
148+
strategy:
149+
fail-fast: false
150+
matrix:
151+
tests:
152+
[
153+
anonymousNavigation,
154+
dashboardV2,
155+
groupBasics,
156+
projectBasics,
157+
projectResources,
158+
searchEntities,
159+
sessionBasics,
160+
]
161+
steps:
162+
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.14.0
163+
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
164+
with:
165+
e2e-folder: cypress/e2e/v2/
166+
e2e-target: ${{ matrix.tests }}
167+
renku-reference: ${{ github.ref }}
168+
renku-release: ci-renku-${{ github.event.number }}
169+
test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }}
170+
171+
deploy-string-no-custom-version:
172+
name: Ensure no custom components
173+
needs: [check-deploy]
174+
runs-on: ubuntu-24.04
175+
steps:
176+
- name: Check deploy string
177+
if: ${{
178+
needs.check-deploy.outputs.pr-contains-string == 'true'
179+
&& startsWith(github.base_ref, 'release-')
180+
&& (
181+
needs.check-deploy.outputs.renku-core != null
182+
|| needs.check-deploy.outputs.renku-gateway != null
183+
|| needs.check-deploy.outputs.renku-graph != null
184+
|| needs.check-deploy.outputs.renku-notebooks != null
185+
|| needs.check-deploy.outputs.renku-ui != null
186+
|| needs.check-deploy.outputs.renku-data-services != null
187+
)
188+
}}
189+
uses: actions/github-script@v7
190+
with:
191+
script: core.setFailed('Cannot merge release PR if it still has custom versions in deploy string.')
192+
cleanup:
193+
name: Cleanup
194+
if: github.event.action == 'closed'
195+
runs-on: ubuntu-24.04
196+
steps:
197+
- name: renku teardown
198+
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.15.1
199+
env:
200+
HELM_RELEASE_REGEX: "^ci-renku-${{ github.event.number }}$"
201+
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
202+
RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
203+
MAX_AGE_SECONDS: 0
204+
DELETE_NAMESPACE: "true"

0 commit comments

Comments
 (0)