Skip to content

Commit

Permalink
Allow to run individual region or all regions (#1113)
Browse files Browse the repository at this point in the history
* test include

* test

* test

* test

* test

* test

* test

* test

* test

* Update .github/workflows/v2-webrtc-calling.yml

Co-authored-by: Ammar Ansari <[email protected]>

* validate

* validate

* validate

* validate

* remove test

* remove me

* Update .github/workflows/v2-webrtc-calling.yml

---------

Co-authored-by: Ammar Ansari <[email protected]>
  • Loading branch information
ryanwi and iAmmar7 authored Sep 11, 2024
1 parent 43b9708 commit 6b73071
Showing 1 changed file with 42 additions and 10 deletions.
52 changes: 42 additions & 10 deletions .github/workflows/v2-webrtc-calling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,61 @@ name: v2 WebRTC Calling Tests
on:
workflow_call:
workflow_dispatch:
inputs:
region:
description: 'Region to test (leave empty to run all)'
type: choice
required: false
options:
- ''
- 'us'
- 'ch'
- 'eu'
- 'spr-preprod'
- 'staging'
schedule:
- cron: '0/20 * * * *'
- cron: '0/30 * * * *'

concurrency:
group: ${{ github.workflow }}-e2e-webrtc-calling-${{ github.ref }}
cancel-in-progress: true

jobs:
determine_regions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-regions.outputs.matrix }}
steps:
- name: Set regions
id: set-regions
run: |
REGIONS='[
{"name": "us", "environment": "production", "config": "PRODUCTION_E2E_JS_SW_TEST_CONFIG", "cxml_conference_region": ""},
{"name": "ch", "environment": "production-ch", "config": "PRODUCTION_E2E_JS_CHREGION_SW_TEST_CONFIG", "cxml_conference_region": "region=\"eu\""},
{"name": "eu", "environment": "production-eu", "config": "PRODUCTION_E2E_JS_EUREGION_SW_TEST_CONFIG", "cxml_conference_region": "region=\"eu\""},
{"name": "spr-preprod", "environment": "production-spr-preprod", "config": "PRODUCTION_E2E_JS_SPRPREPRODREGION_SW_TEST_CONFIG", "cxml_conference_region": "region=\"eu\""},
{"name": "staging", "environment": "staging", "config": "STAGING_E2E_JS_SW_TEST_CONFIG", "cxml_conference_region": ""}
]'
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.region }}" ]; then
SELECTED_REGION='${{ github.event.inputs.region }}'
FILTERED_REGIONS=$(echo $REGIONS | jq -c "[.[] | select(.name == \"$SELECTED_REGION\")]")
else
FILTERED_REGIONS=$REGIONS
fi
echo "$FILTERED_REGIONS"
echo "matrix=$(echo $FILTERED_REGIONS | jq -c '{region: .}')" >> $GITHUB_OUTPUT
e2e-tests:
name: Run E2E tests
needs: determine_regions
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
region:
- { name: 'us', environment: 'production', config: 'PRODUCTION_E2E_JS_SW_TEST_CONFIG', cxml_conference_region: '' }
- { name: 'ch', environment: 'production-ch', config: 'PRODUCTION_E2E_JS_CHREGION_SW_TEST_CONFIG', cxml_conference_region: '' }
- { name: 'eu', environment: 'production-eu', config: 'PRODUCTION_E2E_JS_EUREGION_SW_TEST_CONFIG', cxml_conference_region: 'region="eu"' }
# - { name: 'me', environment: 'production-me', config: 'PRODUCTION_E2E_JS_MEREGION_SW_TEST_CONFIG', cxml_conference_region: '' }
- { name: 'spr-preprod', environment: 'production-spr-preprod', config: 'PRODUCTION_E2E_JS_SPRPREPRODREGION_SW_TEST_CONFIG', cxml_conference_region: 'region="eu"' }
- { name: 'staging', environment: 'staging', config: 'STAGING_E2E_JS_SW_TEST_CONFIG', cxml_conference_region: '' }
matrix: ${{ fromJson(needs.determine_regions.outputs.matrix) }}
steps:
- run: |
echo ${{matrix.region.name}}
- uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/install
Expand All @@ -39,7 +71,7 @@ jobs:
uses: ./.github/actions/playwright
with:
PLAYWRIGHT_VERSION: '1.35.1' # TODO: Read from deps ?
- name: Test
- name: Run test for ${{ matrix.region.name }}
id: run-tests
run: npm run -w=@sw-internal/e2e-js dev -- v2WebrtcFromRest.spec.ts webrtcCalling.spec.ts
env:
Expand Down

0 comments on commit 6b73071

Please sign in to comment.