|
1 | 1 | name: Deploy & run E2E |
2 | | -run-name: 'E2E by ${{ github.event.client_payload.actor || github.actor }} to ${{ github.event.client_payload.stack || github.event.inputs.stack }} (core: ${{ github.event.client_payload.core-image-tag || inputs.core-image-tag }}, farajaland: ${{ github.event.client_payload.countryconfig-image-tag || inputs.countryconfig-image-tag }}) ${{ github.event.client_payload.runtime || inputs.runtime }}' |
| 2 | +run-name: 'E2E by ${{ github.event.client_payload.actor || github.actor }} to ${{ github.event.client_payload.stack || github.event.inputs.stack }} (core: ${{ github.event.client_payload.core-image-tag || inputs.core-image-tag }}, farajaland: ${{ github.event.client_payload.countryconfig-image-tag || inputs.countryconfig-image-tag }})' |
3 | 3 | on: |
4 | 4 | repository_dispatch: |
5 | 5 | types: [run_e2e] |
@@ -48,9 +48,34 @@ concurrency: |
48 | 48 | cancel-in-progress: true |
49 | 49 |
|
50 | 50 | jobs: |
| 51 | + # cancel-in-progress-runs: |
| 52 | + # name: Cancel in-progress runs |
| 53 | + # runs-on: ubuntu-24.04 |
| 54 | + # steps: |
| 55 | + # - name: Cancel in-progress runs |
| 56 | + # env: |
| 57 | + # GH_TOKEN: ${{ github.token }} |
| 58 | + # STACK_NAME: ${{ github.event.client_payload.stack || inputs.stack }} |
| 59 | + # CURRENT_RUN_ID: ${{ github.run_id }} |
| 60 | + # run: | |
| 61 | + # # FIXME: Replace with ${{ github.workflow_id }} |
| 62 | + # gh api "/repos/${{ github.repository }}/actions/workflows/116693890/runs?status=in_progress&status=queued" \ |
| 63 | + # --jq '.workflow_runs[] | select(.id != '$CURRENT_RUN_ID') | .id' > /tmp/run_ids.txt |
| 64 | + # cat /tmp/run_ids.txt |
| 65 | + # while read -r run_id; do |
| 66 | + # RUN_NAME=$(gh api "/repos/${{ github.repository }}/actions/runs/$run_id" --jq '.name') |
| 67 | + # [[ "$RUN_NAME" != *"to $STACK_NAME"* ]] && echo "Skip $RUN_NAME" && continue |
| 68 | + # echo "Cancelling run: $run_id" |
| 69 | + # gh api --method POST "/repos/${{ github.repository }}/actions/runs/$run_id/cancel" |
| 70 | + # gh api \ |
| 71 | + # --method POST \ |
| 72 | + # /repos/opencrvs/e2e/actions/runs/${run_id}/force-cancel |
| 73 | + # echo |
| 74 | + # echo "Workflow $RUN_NAME cancelled: https://github.com/opencrvs/e2e/actions/runs/${run_id}" |
| 75 | + # done < /tmp/run_ids.txt |
51 | 76 | debug: |
52 | 77 | name: Debug output |
53 | | - runs-on: ubuntu-22.04 |
| 78 | + runs-on: ubuntu-24.04 |
54 | 79 | outputs: |
55 | 80 | runtime: ${{ steps.runtime.outputs.runtime }} |
56 | 81 | domain: ${{ steps.runtime.outputs.domain }} |
@@ -124,7 +149,7 @@ jobs: |
124 | 149 | command: npx playwright install --with-deps |
125 | 150 |
|
126 | 151 | deploy-docker: |
127 | | - needs: debug |
| 152 | + needs: [debug, cancel-in-progress-runs] |
128 | 153 | if: needs.debug.outputs.runtime == 'docker' |
129 | 154 | uses: ./.github/workflows/deploy.yml |
130 | 155 | with: |
@@ -225,6 +250,12 @@ jobs: |
225 | 250 | export NODE_EXTRA_CA_CERTS=/tmp/letsencrypt-stg-root-x1.pem |
226 | 251 | curl -s -o $NODE_EXTRA_CA_CERTS https://letsencrypt.org/certs/staging/letsencrypt-stg-root-x1.pem |
227 | 252 | npx playwright test --shard=${{ matrix.shard }}/20 |
| 253 | + PW_PID=$! |
| 254 | + while kill -0 $PW_PID 2>/dev/null; do |
| 255 | + sleep 10 |
| 256 | + done |
| 257 | + |
| 258 | + wait $PW_PID |
228 | 259 | env: |
229 | 260 | DOMAIN: '${{ needs.debug.outputs.domain }}' |
230 | 261 | - id: ctrf_check |
|
0 commit comments