Compare commits

...

1 Commits

Author SHA1 Message Date
Joey Perrott 9a5abbfcbc ci: migrate saucelabs bazel job to Github Actions
Use Github Actions to run saucelabs bazel jobs
2023-09-28 18:52:52 +00:00
4 changed files with 33 additions and 41 deletions
-40
View File
@@ -263,10 +263,6 @@ jobs:
- custom_attach_workspace
- init_environment
- init_saucelabs_environment
- run:
name: Start Saucelabs daemon service
command: yarn bazel run //tools/saucelabs-daemon/background-service -- ${NUMBER_OF_PARALLEL_BROWSERS}
background: true
- run:
name: Run Bazel tests on Saucelabs
command: |
@@ -357,39 +353,3 @@ jobs:
webhook_url_env_var: SLACK_CARETAKER_WEBHOOK_URL
- notify_webhook_on_fail:
webhook_url_env_var: SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
workflows:
version: 2
default_workflow:
jobs:
- setup:
filters:
branches:
ignore: g3
- build-npm-packages:
requires:
- setup
- publish_snapshot:
<<: *only_release_branches
requires:
# Get the artifacts to publish from the build-packages-dist job
# since the publishing script expects the legacy outputs layout.
- build-npm-packages
monitoring:
jobs:
- setup
- saucelabs:
# Testing saucelabs via Bazel currently taking longer than the legacy saucelabs job as it
# each karma_web_test target is provisioning and tearing down browsers which is adding
# a lot of overhead. Running once daily in the main branch to avoid wasting resources and
# slowing down CI for PRs.
# TODO: Run this job on all branches (including PRs) once karma_web_test targets can
# share provisioned browsers and we can remove the legacy saucelabs job.
requires:
- setup
triggers:
- schedule:
<<: *only_on_main_branch
# Runs monitoring jobs at 10:00AM every day.
cron: '0 10 * * *'
+26
View File
@@ -62,3 +62,29 @@ jobs:
run: KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
- name: Stop Saucelabs tunnel service
run: ./tools/saucelabs/sauce-service.sh stop
bazel-saucelabs:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1befe6d24fd5cab818e7f8bada40ab364781b8a8
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@1befe6d24fd5cab818e7f8bada40ab364781b8a8
- name: Setup Bazel Remote Caching
uses: angular/dev-infra/github-actions/bazel/configure-remote@ba9b4487ced515e5b4d87edd681a3bd9792444d6
- name: Set up Sauce Tunnel Daemon
run: yarn bazel run //tools/saucelabs-daemon/background-service -- 2 &
env:
SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }}
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
- name: Run all saucelabs bazel tests
run: |
TESTS=$(./node_modules/.bin/bazelisk query --output label '(kind(karma_web_test, ...) intersect attr("tags", "saucelabs", ...)) except attr("tags", "fixme-saucelabs", ...)')
yarn bazel test --cache_test_results=no --config=saucelabs --jobs=2 ${TESTS}
+4
View File
@@ -338,6 +338,10 @@ def karma_web_test_suite(
tags = tags + [
"manual",
"no-remote-exec",
# Requires network to be able to access saucelabs daemon
"requires-network",
# Prevent the sandbox from being used so that it can communicate with the saucelabs daemon
"no-sandbox",
"saucelabs",
],
configuration_env_vars = ["KARMA_WEB_TEST_MODE"],
+3 -1
View File
@@ -38,7 +38,9 @@ export function SaucelabsLauncher(
this.name = browserDisplayName + ' on SauceLabs (daemon)';
this.on('start', (pageUrl: string) => {
daemonConnection = createConnection({port: IPC_PORT}, () => _startBrowserTest(pageUrl, args));
daemonConnection = createConnection({port: IPC_PORT, family: 4}, () => _startBrowserTest(pageUrl, args));
daemonConnection.on(
'data',