Skip to content

Commit 049516b

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

1 file changed

Lines changed: 165 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)