From a4e3ca4893595a7db242bfca174b616851726a51 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Fri, 22 Mar 2024 15:56:05 +0000 Subject: [PATCH] ci: move saucelabs and browserstack to regular CI jobs Move the saucelabs and browserstack jobs to regular CI instead of the priviledged CI to prevent cache poisoning/overload --- .github/workflows/ci-privileged.yml | 61 ---------------------- .github/workflows/ci.yml | 45 ++++++++++++++++ scripts/circleci/run-browserstack-tests.sh | 2 +- scripts/circleci/run-saucelabs-tests.sh | 2 +- 4 files changed, 47 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/ci-privileged.yml diff --git a/.github/workflows/ci-privileged.yml b/.github/workflows/ci-privileged.yml deleted file mode 100644 index 21b12bbe09a6..000000000000 --- a/.github/workflows/ci-privileged.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: CI - -on: - pull_request_target: - types: [opened, synchronize, reopened] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref }} - cancel-in-progress: true - -permissions: {} - -defaults: - run: - shell: bash - -jobs: - saucelabs: - runs-on: ubuntu-latest - env: - SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }} - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - KARMA_PARALLEL_BROWSERS: 2 - CI_NODE_INDEX: 0 - CI_NODE_TOTAL: 1 - CI_RUNNER_NUMBER: ${{ github.run_id }} - steps: - - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@2113cd7f66a089ac0208ea84eee672b2529f4f6c - with: - cache-node-modules: true - # Checking out the pull request commit is intended here as we need to run the changed code tests. - ref: ${{ github.event.pull_request.head.sha }} - - name: Install node modules - run: yarn install --frozen-lockfile - - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@2113cd7f66a089ac0208ea84eee672b2529f4f6c - - name: Run tests on Saucelabs - run: ./scripts/circleci/run-saucelabs-tests.sh - - browserstack: - runs-on: ubuntu-latest - env: - BROWSER_STACK_USERNAME: ${{ vars.BROWSER_STACK_USERNAME }} - BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }} - CI_NODE_INDEX: 0 - CI_NODE_TOTAL: 1 - CI_RUNNER_NUMBER: ${{ github.run_id }} - steps: - - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@2113cd7f66a089ac0208ea84eee672b2529f4f6c - with: - cache-node-modules: true - # Checking out the pull request commit is intended here as we need to run the changed code tests. - ref: ${{ github.event.pull_request.head.sha }} - - name: Install node modules - run: yarn install --frozen-lockfile - - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@2113cd7f66a089ac0208ea84eee672b2529f4f6c - - name: Run tests on Browserstack - run: ./scripts/circleci/run-browserstack-tests.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30a764a4d1d5..239bcde893ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -300,3 +300,48 @@ jobs: with: JOB_NAME: 'Docs site deployment' SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }} + + saucelabs: + runs-on: ubuntu-latest + env: + KARMA_PARALLEL_BROWSERS: 2 + CI_NODE_INDEX: 0 + CI_NODE_TOTAL: 1 + CI_RUNNER_NUMBER: ${{ github.run_id }} + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@2113cd7f66a089ac0208ea84eee672b2529f4f6c + with: + cache-node-modules: true + # Checking out the pull request commit is intended here as we need to run the changed code tests. + ref: ${{ github.event.pull_request.head.sha }} + - name: Install node modules + run: yarn install --frozen-lockfile + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@2113cd7f66a089ac0208ea84eee672b2529f4f6c + - name: Setup Saucelabs Variables + uses: angular/dev-infra/github-actions/saucelabs@50bb71e51d3372ca2e359adb9069f89beeac4ae7 + - name: Run tests on Saucelabs + run: ./scripts/circleci/run-saucelabs-tests.sh + + browserstack: + runs-on: ubuntu-latest + env: + CI_NODE_INDEX: 0 + CI_NODE_TOTAL: 1 + CI_RUNNER_NUMBER: ${{ github.run_id }} + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@2113cd7f66a089ac0208ea84eee672b2529f4f6c + with: + cache-node-modules: true + # Checking out the pull request commit is intended here as we need to run the changed code tests. + ref: ${{ github.event.pull_request.head.sha }} + - name: Install node modules + run: yarn install --frozen-lockfile + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@2113cd7f66a089ac0208ea84eee672b2529f4f6c + - name: Setup Saucelabs Variables + uses: angular/dev-infra/github-actions/browserstack@a506992ba2d961ae3b07391ff14bdaf691995fa9 + - name: Run tests on Browserstack + run: ./scripts/circleci/run-browserstack-tests.sh diff --git a/scripts/circleci/run-browserstack-tests.sh b/scripts/circleci/run-browserstack-tests.sh index 497371cdc1af..7edd2c953258 100755 --- a/scripts/circleci/run-browserstack-tests.sh +++ b/scripts/circleci/run-browserstack-tests.sh @@ -11,7 +11,7 @@ projectDir="$(dirname ${0})/../.." cd ${projectDir} # Decode access token and make it accessible for child processes. -export BROWSER_STACK_ACCESS_KEY=`echo ${BROWSER_STACK_ACCESS_KEY} | rev` +export BROWSER_STACK_ACCESS_KEY=`echo ${BROWSER_STACK_ACCESS_KEY}` # Setup the test platform environment variable that will be read # by the Karma configuration script. diff --git a/scripts/circleci/run-saucelabs-tests.sh b/scripts/circleci/run-saucelabs-tests.sh index 93236b54c2c6..d02e9e5a7afe 100755 --- a/scripts/circleci/run-saucelabs-tests.sh +++ b/scripts/circleci/run-saucelabs-tests.sh @@ -8,7 +8,7 @@ set -e cd $(dirname ${0})/../.. # Decode access token and make it accessible for child processes. -export SAUCE_ACCESS_KEY=`echo ${SAUCE_ACCESS_KEY} | rev` +export SAUCE_ACCESS_KEY=`echo ${SAUCE_ACCESS_KEY}` # Start tunnel and wait for it being ready. ./scripts/saucelabs/start-tunnel.sh &