Skip to content

Commit 2aa6153

Browse files
committed
ci: migrate saucelabs and browserstack tests to GHA (#27886)
Move Browsestack and Saucelabs testing from CircleCI to GHA (cherry picked from commit 73f7a44)
1 parent 337d688 commit 2aa6153

File tree

5 files changed

+69
-55
lines changed

5 files changed

+69
-55
lines changed

.circleci/config.yml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -205,47 +205,6 @@ jobs:
205205
- run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
206206
- *slack_notify_on_failure
207207

208-
# ----------------------------------------------------------------------------
209-
# Job that runs the unit tests on Browserstack. The browsers that will be used
210-
# to run the unit tests on Browserstack are set in: test/browser-providers.js
211-
# ----------------------------------------------------------------------------
212-
tests_browserstack:
213-
<<: *job_defaults
214-
resource_class: xlarge
215-
environment:
216-
BROWSER_STACK_USERNAME: 'angulardevops_uNDx4q'
217-
BROWSER_STACK_ACCESS_KEY: 'PXeXP2qrTvRooAFG7DPW'
218-
steps:
219-
- checkout_and_rebase
220-
- *restore_cache
221-
- *setup_bazel_ci_config
222-
- *yarn_install
223-
224-
- run: ./scripts/circleci/run-browserstack-tests.sh
225-
- *slack_notify_on_failure
226-
227-
# ----------------------------------------------------------------------------
228-
# Job that runs the unit tests on Saucelabs. The browsers that will be used
229-
# to run the unit tests on Saucelabs are set in: test/browser-providers.js
230-
# ----------------------------------------------------------------------------
231-
tests_saucelabs:
232-
<<: *job_defaults
233-
resource_class: xlarge
234-
environment:
235-
SAUCE_USERNAME: 'angular-components'
236-
SAUCE_ACCESS_KEY: '687f2bb5cacc-3bcb-5b64-8e8a-3825fc13'
237-
# Note: This number should not be too high because otherwise we might run into
238-
# a rate limit exception.
239-
KARMA_PARALLEL_BROWSERS: 2
240-
steps:
241-
- checkout_and_rebase
242-
- *restore_cache
243-
- *setup_bazel_ci_config
244-
- *yarn_install
245-
246-
- run: ./scripts/circleci/run-saucelabs-tests.sh
247-
- *slack_notify_on_failure
248-
249208
# -------------------------------------------------------------------------------------------
250209
# Job that builds all release packages. The built packages can be then used in the same
251210
# workflow to publish snapshot builds.
@@ -451,10 +410,6 @@ workflows:
451410
filters: *ignore_presubmit_branch_filter
452411
- tests_browsers:
453412
filters: *ignore_presubmit_branch_filter
454-
- tests_browserstack:
455-
filters: *ignore_presubmit_branch_filter
456-
- tests_saucelabs:
457-
filters: *ignore_presubmit_branch_filter
458413
- build_release_packages:
459414
filters: *ignore_presubmit_branch_filter
460415
- upload_release_packages:

.github/angular-robot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ merge:
5656
requiredStatuses:
5757
- 'ci/circleci: bazel_build'
5858
- 'ci/circleci: tests_browsers'
59-
- 'ci/circleci: tests_browserstack'
60-
- 'ci/circleci: tests_saucelabs'
6159
- 'ci/circleci: build_release_packages'
6260

6361
# the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable

.github/workflows/ci-privileged.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
11+
permissions: {}
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
jobs:
18+
saucelabs:
19+
runs-on: ubuntu-latest
20+
env:
21+
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
22+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
23+
KARMA_PARALLEL_BROWSERS: 2
24+
CI_NODE_INDEX: 0
25+
CI_NODE_TOTAL: 1
26+
CI_RUNNER_NUMBER: ${{ github.run_id }}
27+
steps:
28+
- name: Initialize environment
29+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ba9b4487ced515e5b4d87edd681a3bd9792444d6
30+
with:
31+
cache-node-modules: true
32+
# Checking out the pull request commit is intended here as we need to run the changed code tests.
33+
ref: ${{ github.event.pull_request.head.sha }}
34+
- name: Install node modules
35+
run: yarn install --frozen-lockfile
36+
- name: Setup Bazel
37+
uses: angular/dev-infra/github-actions/bazel/setup@ba9b4487ced515e5b4d87edd681a3bd9792444d6
38+
- name: Run tests on Saucelabs
39+
run: ./scripts/circleci/run-saucelabs-tests.sh
40+
41+
browserstack:
42+
runs-on: ubuntu-latest
43+
env:
44+
BROWSER_STACK_USERNAME: ${{ vars.BROWSER_STACK_USERNAME }}
45+
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
46+
CI_NODE_INDEX: 0
47+
CI_NODE_TOTAL: 1
48+
CI_RUNNER_NUMBER: ${{ github.run_id }}
49+
steps:
50+
- name: Initialize environment
51+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ba9b4487ced515e5b4d87edd681a3bd9792444d6
52+
with:
53+
cache-node-modules: true
54+
# Checking out the pull request commit is intended here as we need to run the changed code tests.
55+
ref: ${{ github.event.pull_request.head.sha }}
56+
- name: Install node modules
57+
run: yarn install --frozen-lockfile
58+
- name: Setup Bazel
59+
uses: angular/dev-infra/github-actions/bazel/setup@ba9b4487ced515e5b4d87edd681a3bd9792444d6
60+
- name: Run tests on Browserstack
61+
run: ./scripts/circleci/run-browserstack-tests.sh

scripts/saucelabs/start-tunnel.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ rm ${tunnelFileName}
2929
# Command arguments that will be passed to sauce-connect.
3030
sauceArgs="--readyfile ${tunnelReadyFile} --pidfile ${tunnelPidFile}"
3131

32-
if [ ! -z "${CIRCLE_BUILD_NUM}" ]; then
33-
sauceArgs="${sauceArgs} --tunnel-identifier angular-material-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
32+
if [ ! -z "${CI_RUNNER_NUMBER}" ]; then
33+
sauceArgs="${sauceArgs} --tunnel-identifier angular-material-${CI_RUNNER_NUMBER}-${CI_NODE_INDEX}"
3434
fi
3535

3636
echo "Starting Sauce Connect in the background. Passed arguments: ${sauceArgs}"

test/karma.conf.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ module.exports = config => {
107107
},
108108
});
109109

110-
if (process.env['CIRCLECI']) {
111-
const containerInstanceIndex = Number(process.env['CIRCLE_NODE_INDEX']);
112-
const maxParallelContainerInstances = Number(process.env['CIRCLE_NODE_TOTAL']);
113-
const tunnelIdentifier = `angular-material-${process.env['CIRCLE_BUILD_NUM']}-${containerInstanceIndex}`;
114-
const buildIdentifier = `circleci-${tunnelIdentifier}`;
110+
if (process.env['CI']) {
111+
const containerInstanceIndex = Number(process.env['CI_NODE_INDEX']) || 0;
112+
const maxParallelContainerInstances = Number(process.env['CI_NODE_TOTAL']) || 1;
113+
const tunnelIdentifier = `angular-material-${process.env['CI_RUNNER_NUMBER']}-${containerInstanceIndex}`;
114+
const buildIdentifier = `ci-${tunnelIdentifier}`;
115115
const testPlatform = process.env['TEST_PLATFORM'];
116116

117-
// This defines how often a given browser should be launched in the same CircleCI
117+
// This defines how often a given browser should be launched in the same CI
118118
// container. This is helpful if we want to shard tests across the same browser.
119119
const parallelBrowserInstances = Number(process.env['KARMA_PARALLEL_BROWSERS']) || 1;
120120

0 commit comments

Comments
 (0)