Skip to content

Commit d91618f

Browse files
josephperrottAndrewKushnir
authored andcommitted
ci: migrate legacy saucelabs job to Github Actions (angular#51695)
Migrate the legacy saucelabs job PR Close angular#51695
1 parent 59aa063 commit d91618f

File tree

3 files changed

+64
-57
lines changed

3 files changed

+64
-57
lines changed

.circleci/config.yml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -358,58 +358,6 @@ jobs:
358358
- notify_webhook_on_fail:
359359
webhook_url_env_var: SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
360360

361-
legacy-unit-tests-saucelabs:
362-
executor:
363-
name: default-executor
364-
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
365-
# container for this job. This is necessary because we launch a lot of browsers concurrently
366-
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
367-
resource_class: xlarge
368-
steps:
369-
- custom_attach_workspace
370-
- init_environment
371-
- init_saucelabs_environment
372-
- run:
373-
name: Starting Saucelabs tunnel service
374-
command: ./tools/saucelabs/sauce-service.sh run
375-
background: true
376-
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
377-
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
378-
# in the Saucelabs legacy job always fetches referenced files, even if the imports would be
379-
# guarded by an check to skip in the Saucelabs legacy job. We should be good running such
380-
# test in all supported browsers on Saucelabs anyway until this job can be removed.
381-
- run:
382-
name: Preparing Bazel-generated fixtures required in legacy tests
383-
command: |
384-
yarn bazel build \
385-
//packages/core/test:downleveled_es5_fixture \
386-
//packages/common/locales
387-
388-
# Needed for the ES5 downlevel reflector test in `packages/core/test/reflection`.
389-
mkdir -p dist/legacy-test-out/core/test/reflection/
390-
cp dist/bin/packages/core/test/reflection/es5_downleveled_inheritance_fixture.js \
391-
dist/legacy-test-out/core/test/reflection/es5_downleveled_inheritance_fixture.js
392-
# Locale files are needed for i18n tests running within Saucelabs. These are added
393-
# directly as sources so that the TypeScript compilation of `/packages/tsconfig.json`
394-
# can succeed. Note that the base locale and currencies files are checked-in, so
395-
# we do not need to re-generate those through Bazel.
396-
mkdir -p packages/common/locales/extra
397-
cp dist/bin/packages/common/locales/*.ts packages/common/locales
398-
cp dist/bin/packages/common/locales/extra/*.ts packages/common/locales/extra
399-
# Build the bundle for all tests to run within Saucelabs
400-
- run: node tools/legacy-saucelabs/build-saucelabs-test-bundle.mjs
401-
- run:
402-
# Waiting on ready ensures that we don't run tests too early without Saucelabs not being ready.
403-
name: Waiting for Saucelabs tunnel to connect
404-
command: ./tools/saucelabs/sauce-service.sh ready-wait
405-
- run:
406-
name: Running tests on Saucelabs.
407-
command: |
408-
KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
409-
- run:
410-
name: Stop Saucelabs tunnel service
411-
command: ./tools/saucelabs/sauce-service.sh stop
412-
413361
workflows:
414362
version: 2
415363
default_workflow:
@@ -421,16 +369,12 @@ workflows:
421369
- build-npm-packages:
422370
requires:
423371
- setup
424-
- legacy-unit-tests-saucelabs:
425-
requires:
426-
- setup
427372
- publish_snapshot:
428373
<<: *only_release_branches
429374
requires:
430375
# Get the artifacts to publish from the build-packages-dist job
431376
# since the publishing script expects the legacy outputs layout.
432377
- build-npm-packages
433-
- legacy-unit-tests-saucelabs
434378

435379
monitoring:
436380
jobs:
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.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-4core
20+
env:
21+
SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }}
22+
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
23+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
24+
steps:
25+
- name: Initialize environment
26+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1befe6d24fd5cab818e7f8bada40ab364781b8a8
27+
with:
28+
cache-node-modules: true
29+
# Checking out the pull request commit is intended here as we need to run the changed code tests.
30+
ref: ${{ github.sha }}
31+
- name: Install node modules
32+
run: yarn install --frozen-lockfile
33+
- name: Setup Bazel
34+
uses: angular/dev-infra/github-actions/bazel/setup@1befe6d24fd5cab818e7f8bada40ab364781b8a8
35+
- name: Starting Saucelabs tunnel service
36+
run: ./tools/saucelabs/sauce-service.sh run &
37+
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
38+
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
39+
# in the Saucelabs legacy job always fetches referenced files, even if the imports would be
40+
# guarded by an check to skip in the Saucelabs legacy job. We should be good running such
41+
# test in all supported browsers on Saucelabs anyway until this job can be removed.
42+
- name: Preparing Bazel-generated fixtures required in legacy tests
43+
run: |
44+
yarn bazel build //packages/core/test:downleveled_es5_fixture //packages/common/locales
45+
# Needed for the ES5 downlevel reflector test in `packages/core/test/reflection`.
46+
mkdir -p dist/legacy-test-out/core/test/reflection/
47+
cp dist/bin/packages/core/test/reflection/es5_downleveled_inheritance_fixture.js \
48+
dist/legacy-test-out/core/test/reflection/es5_downleveled_inheritance_fixture.js
49+
# Locale files are needed for i18n tests running within Saucelabs. These are added
50+
# directly as sources so that the TypeScript compilation of `/packages/tsconfig.json`
51+
# can succeed. Note that the base locale and currencies files are checked-in, so
52+
# we do not need to re-generate those through Bazel.
53+
mkdir -p packages/common/locales/extra
54+
cp dist/bin/packages/common/locales/*.ts packages/common/locales
55+
cp dist/bin/packages/common/locales/extra/*.ts packages/common/locales/extra
56+
- name: Build bundle of tests to run on Saucelabs
57+
run: node tools/legacy-saucelabs/build-saucelabs-test-bundle.mjs
58+
- name: Wait and confirm Saucelabs tunnel has connected
59+
run: ./tools/saucelabs/sauce-service.sh ready-wait
60+
timeout-minutes: 3
61+
- name: Running tests on Saucelabs.
62+
run: KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
63+
- name: Stop Saucelabs tunnel service
64+
run: ./tools/saucelabs/sauce-service.sh stop

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches:
66
- main
77
- '[0-9]+.[0-9]+.x'
8-
- 'correct-escaping'
98
pull_request:
109
types: [opened, synchronize, reopened]
1110

0 commit comments

Comments
 (0)