|
| 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 }}-azure |
| 17 | + cancel-in-progress: false |
| 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.azure.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 | + |
| 64 | + - name: Get AKS credentials |
| 65 | + run: | |
| 66 | + az aks get-credentials --resource-group renku-dev --name aks-switzerlandnorth-renku-dev --file "${{ github.workspace }}/renkubot-kube.config" |
| 67 | + chmod 600 "${{ github.workspace }}/renkubot-kube.config" |
| 68 | +
|
| 69 | + # Create a multiline env var with the content for RENKUBOT_KUBECONFIG |
| 70 | + echo "RENKUBOT_KUBECONFIG<<EOF" >> $GITHUB_ENV |
| 71 | + cat "${{ github.workspace }}/renkubot-kube.config" >> $GITHUB_ENV |
| 72 | + echo "EOF" >> $GITHUB_ENV |
| 73 | +
|
| 74 | + - name: Test kubectl connection |
| 75 | + run: | |
| 76 | + export KUBECONFIG="${{ github.workspace }}/renkubot-kube.config" |
| 77 | + kubectl get nodes |
| 78 | + - name: renku build and deploy |
| 79 | + if: needs.check-deploy.outputs.pr-contains-string == 'true' |
| 80 | + uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.18.0 |
| 81 | + env: |
| 82 | + DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }} |
| 83 | + DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }} |
| 84 | + GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }} |
| 85 | + KUBECONFIG: "${{ github.workspace }}/renkubot-kube.config" |
| 86 | + KUBERNETES_CLUSTER_FQDN: dev.azure.renku.ch |
| 87 | + RENKU_ANONYMOUS_SESSIONS: true |
| 88 | + RENKU_RELEASE: ci-renku-${{ github.event.number }} |
| 89 | + RENKU_VALUES_FILE: "${{ github.workspace }}/values.yaml" |
| 90 | + RENKU_VALUES: minimal-deployment/minimal-deployment-values.yaml |
| 91 | + RENKUBOT_KUBECONFIG: ${{ env.RENKUBOT_KUBECONFIG }} |
| 92 | + TEST_ARTIFACTS_PATH: "tests-artifacts-${{ github.sha }}" |
| 93 | + ENABLE_NGINX_INGRESS: true |
| 94 | + renku: "@${{ github.head_ref }}" |
| 95 | + renku_core: "${{ needs.check-deploy.outputs.renku-core }}" |
| 96 | + renku_gateway: "${{ needs.check-deploy.outputs.renku-gateway }}" |
| 97 | + renku_graph: "${{ needs.check-deploy.outputs.renku-graph }}" |
| 98 | + renku_notebooks: "${{ needs.check-deploy.outputs.renku-notebooks }}" |
| 99 | + renku_ui: "${{ needs.check-deploy.outputs.renku-ui }}" |
| 100 | + renku_data_services: "${{ needs.check-deploy.outputs.renku-data-services }}" |
| 101 | + amalthea: "${{ needs.check-deploy.outputs.amalthea }}" |
| 102 | + amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}" |
| 103 | + extra_values: "${{ needs.check-deploy.outputs.extra-values }}" |
| 104 | + - name: Check existing renkubot comment |
| 105 | + if: needs.check-deploy.outputs.pr-contains-string == 'true' |
| 106 | + uses: peter-evans/find-comment@v3 |
| 107 | + id: findcomment |
| 108 | + with: |
| 109 | + issue-number: ${{ github.event.pull_request.number }} |
| 110 | + comment-author: "RenkuBot" |
| 111 | + - name: Create comment pre deploy |
| 112 | + if: ${{ steps.findcomment.outputs.comment-id == 0 && |
| 113 | + needs.check-deploy.outputs.pr-contains-string == 'true' }} |
| 114 | + uses: peter-evans/create-or-update-comment@v4 |
| 115 | + with: |
| 116 | + token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }} |
| 117 | + issue-number: ${{ github.event.pull_request.number }} |
| 118 | + body: | |
| 119 | + You can access the deployment of this PR at https://ci-renku-${{ github.event.number }}.dev.azure.renku.ch |
| 120 | +
|
| 121 | + cypress-acceptance-tests: |
| 122 | + name: Cypress tests on Azure |
| 123 | + needs: [check-deploy, deploy-pr] |
| 124 | + runs-on: ubuntu-24.04 |
| 125 | + strategy: |
| 126 | + fail-fast: false |
| 127 | + matrix: |
| 128 | + tests: |
| 129 | + [ |
| 130 | + anonymousNavigation, |
| 131 | + dashboardV2, |
| 132 | + groupBasics, |
| 133 | + projectBasics, |
| 134 | + projectResources, |
| 135 | + searchEntities, |
| 136 | + sessionBasics, |
| 137 | + ] |
| 138 | + steps: |
| 139 | + - uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.18.0 |
| 140 | + if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true' |
| 141 | + with: |
| 142 | + e2e-folder: cypress/e2e/v2/ |
| 143 | + e2e-target: ${{ matrix.tests }} |
| 144 | + kubernetes-cluster-fqdn: dev.azure.renku.ch |
| 145 | + renku-reference: ${{ github.ref }} |
| 146 | + renku-release: ci-renku-${{ github.event.number }} |
| 147 | + test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }} |
| 148 | + |
| 149 | + |
| 150 | + deploy-string-no-custom-version: |
| 151 | + name: Ensure no custom components |
| 152 | + needs: [check-deploy] |
| 153 | + runs-on: ubuntu-24.04 |
| 154 | + steps: |
| 155 | + - name: Check deploy string |
| 156 | + if: ${{ |
| 157 | + needs.check-deploy.outputs.pr-contains-string == 'true' |
| 158 | + && startsWith(github.base_ref, 'release-') |
| 159 | + && ( |
| 160 | + needs.check-deploy.outputs.renku-core != null |
| 161 | + || needs.check-deploy.outputs.renku-gateway != null |
| 162 | + || needs.check-deploy.outputs.renku-graph != null |
| 163 | + || needs.check-deploy.outputs.renku-notebooks != null |
| 164 | + || needs.check-deploy.outputs.renku-ui != null |
| 165 | + || needs.check-deploy.outputs.renku-data-services != null |
| 166 | + ) |
| 167 | + }} |
| 168 | + uses: actions/github-script@v7 |
| 169 | + with: |
| 170 | + script: core.setFailed('Cannot merge release PR if it still has custom versions in deploy string.') |
| 171 | + cleanup: |
| 172 | + name: Cleanup |
| 173 | + if: github.event.action == 'closed' |
| 174 | + runs-on: ubuntu-24.04 |
| 175 | + steps: |
| 176 | + - name: renku teardown |
| 177 | + uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.15.1 |
| 178 | + env: |
| 179 | + HELM_RELEASE_REGEX: "^ci-renku-${{ github.event.number }}$" |
| 180 | + GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }} |
| 181 | + RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }} |
| 182 | + MAX_AGE_SECONDS: 0 |
| 183 | + DELETE_NAMESPACE: "true" |
0 commit comments