name: Pull Request CI run-name: ${{ github.actor }} is running Pull Request CI on: pull_request_target: types: [opened, labeled, reopened] workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: rid: ${{ github.run_id }}-${{ github.run_number }} SKIP_FLAKY_TESTS: ${{ secrets.SKIP_FLAKY_TESTS }} WEBEX_APPID_ORGID: ${{ secrets.WEBEX_APPID_ORGID }} WEBEX_APPID_SECRET: ${{ secrets.WEBEX_APPID_SECRET }} WEBEX_CLIENT_ID: ${{ secrets.WEBEX_CLIENT_ID }} WEBEX_CLIENT_SECRET: ${{ secrets.WEBEX_CLIENT_SECRET }} jobs: validate: name: Validate Pull Request runs-on: ubuntu-latest steps: - name: Validate Labels run: | HEAD_REPO=${{ github.event.pull_request.head.repo.full_name }} BASE_REPO=${{ github.event.pull_request.base.repo.full_name }} FROM_BASE=0; [ "$HEAD_REPO" == "$BASE_REPO" ] && FROM_BASE=1 HAS_VALIDATED_LABEL=${{ contains(github.event.pull_request.labels.*.name, 'validated') }} VALIDATED=0; [ "$HAS_VALIDATED_LABEL" == "true" ] && VALIDATED=1 echo from base $FROM_BASE echo validated $VALIDATED if [[ $FROM_BASE == 1 || $VALIDATED == 1 ]] then echo 'pull request is validated, running tests' exit 0 else echo 'pull request is not validated, exiting' exit 1 fi generate-package-matrix: name: Determine Changed Packages needs: validate runs-on: ubuntu-latest outputs: changed: ${{ steps.generate-package-matrix-changed.outputs.changed }} recursive: ${{ steps.generate-package-matrix-recursive.outputs.recursive }} steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Update Main Branch run: git fetch origin ${{ github.event.pull_request.base.ref }} --unshallow - id: generate-package-matrix-recursive name: Generate Package Matrix run: echo "recursive=$(yarn package-tools list --private --recursive --since ${{ github.event.pull_request.base.sha }})" >> $GITHUB_OUTPUT - id: generate-package-matrix-changed name: Generate Package Matrix run: echo "changed=$(yarn package-tools list --private --since ${{ github.event.pull_request.base.sha }})" >> $GITHUB_OUTPUT - name: Display Package Matrix run: | echo "changed packages - ${{ steps.generate-package-matrix-changed.outputs.changed}}" echo "changed packages and dependents - ${{ steps.generate-package-matrix-recursive.outputs.recursive }}" test-browser: name: Test - Browser needs: generate-package-matrix runs-on: ubuntu-latest timeout-minutes: 60 steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Build Webex Core run: yarn workspace @webex/webex-core run build:src - name: Build Other Packages run: yarn workspaces foreach --parallel --topological --verbose run build:src # Webex services only accept CORS requests from allow-listed origins, so Karma is served from # https://localhost.webex.com (resolves to 127.0.0.1) on port 443 with a mkcert certificate. - name: Set up HTTPS for Karma run: ./scripts/setup-karma-https.sh --ci - name: Test - Browser run: yarn workspaces foreach --verbose --exclude webex-js-sdk --include '${{ needs.generate-package-matrix.outputs.changed }}' run test:browser test-coverage: name: Test - Coverage needs: generate-package-matrix runs-on: ubuntu-latest steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Build Webex Core run: yarn workspace @webex/webex-core run build:src - name: Build Other Packages run: yarn workspaces foreach --parallel --topological --verbose run build:src - name: Test - Coverage run: yarn workspaces foreach --verbose --exclude webex-js-sdk --include '${{ needs.generate-package-matrix.outputs.recursive }}' run test:coverage test-integration: name: Test - Integration needs: generate-package-matrix runs-on: ubuntu-latest timeout-minutes: 60 steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Build Webex Core run: yarn workspace @webex/webex-core run build:src - name: Build Other Packages run: yarn workspaces foreach --parallel --topological --verbose run build:src - name: Test - Integration run: yarn workspaces foreach --verbose --exclude webex-js-sdk --include '${{ needs.generate-package-matrix.outputs.changed }}' run test:integration test-style: name: Test - Style needs: generate-package-matrix runs-on: ubuntu-latest steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Build Webex Core run: yarn workspace @webex/webex-core run build:src - name: Build Other Packages run: yarn workspaces foreach --parallel --topological --verbose run build:src - name: Test - Style run: yarn workspaces foreach --verbose --exclude webex-js-sdk --include '${{ needs.generate-package-matrix.outputs.recursive }}' run test:style test-syntax: name: Test - Syntax needs: generate-package-matrix runs-on: ubuntu-latest steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Build Webex Core run: yarn workspace @webex/webex-core run build:src - name: Build Other Packages run: yarn workspaces foreach --parallel --topological --verbose run build:src - name: Test - Syntax run: yarn workspaces foreach --verbose --exclude webex-js-sdk --include '${{ needs.generate-package-matrix.outputs.recursive }}' run test:syntax test-unit: name: Test - Unit needs: generate-package-matrix runs-on: ubuntu-latest timeout-minutes: 60 steps: - name: Checkout Project uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} allow-unsafe-pr-checkout: true persist-credentials: false - name: Setup Node uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: 'yarn' - name: Write Environment Variables run: | touch ./.env echo "SKIP_FLAKY_TESTS=\"${{ secrets.SKIP_FLAKY_TESTS }}\"" >> ./.env echo "WEBEX_APPID_ORGID=\"${{ secrets.WEBEX_APPID_ORGID }}\"" >> ./.env echo "WEBEX_APPID_SECRET=\"${{ secrets.WEBEX_APPID_SECRET }}\"" >> ./.env echo "WEBEX_CLIENT_ID=\"${{ secrets.WEBEX_CLIENT_ID }}\"" >> ./.env echo "WEBEX_CLIENT_SECRET=\"${{ secrets.WEBEX_CLIENT_SECRET }}\"" >> ./.env - name: Install Dependencies run: yarn - name: Build Tools run: yarn workspaces foreach --from '@webex/*-tools' --topological-dev --parallel --verbose run build:src - name: Build Webex Core run: yarn workspace @webex/webex-core run build:src - name: Build Other Packages run: yarn workspaces foreach --parallel --topological --verbose run build:src - name: Test - Unit run: yarn workspaces foreach --verbose --exclude webex-js-sdk --include '${{ needs.generate-package-matrix.outputs.recursive }}' run test:unit test-e2e: name: Test - E2E needs: validate if: contains(github.event.pull_request.labels.*.name, 'test_e2e') uses: ./.github/workflows/e2e.yml with: ref: ${{ github.event.pull_request.head.sha }} secrets: CC_E2E_ENV: ${{ secrets.CC_E2E_ENV }} CALLING_E2E_ENV: ${{ secrets.CALLING_E2E_ENV }}