Skip to content

Commit 1046da2

Browse files
committed
ci: migrate saucelabs tests to GHA
Move Saucelabs testing from CircleCI to GHA
1 parent 47ac55f commit 1046da2

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed

.github/workflows/ci-privileged.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request_target:
6+
types: [opened, synchronize, reopened]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref }}
10+
cancel-in-progress: true
11+
12+
permissions: {}
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
jobs:
19+
saucelabs:
20+
runs-on: ubuntu-latest-4core
21+
env:
22+
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
23+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
24+
KARMA_PARALLEL_BROWSERS: 2
25+
CI_NODE_INDEX: 0
26+
CI_NODE_TOTAL: 1
27+
CI_RUNNER_NUMBER: ${{ github.run_id }}
28+
steps:
29+
- name: Initialize environment
30+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ba9b4487ced515e5b4d87edd681a3bd9792444d6
31+
with:
32+
cache-node-modules: true
33+
# Checking out the pull request commit is intended here as we need to run the changed code tests.
34+
ref: ${{ github.event.pull_request.head.sha }}
35+
- name: Install node modules
36+
run: yarn install --frozen-lockfile
37+
- name: Setup Bazel
38+
uses: angular/dev-infra/github-actions/bazel/setup@ba9b4487ced515e5b4d87edd681a3bd9792444d6
39+
- name: Run tests in Saucelabs
40+
run: ./scripts/circleci/run-saucelabs-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
@@ -102,12 +102,12 @@ module.exports = config => {
102102
},
103103
});
104104

105-
if (process.env['CIRCLECI']) {
106-
const containerInstanceIndex = Number(process.env['CIRCLE_NODE_INDEX']);
107-
const maxParallelContainerInstances = Number(process.env['CIRCLE_NODE_TOTAL']);
108-
const tunnelIdentifier = `angular-material-${process.env['CIRCLE_BUILD_NUM']}-${containerInstanceIndex}`;
109-
const buildIdentifier = `circleci-${tunnelIdentifier}`;
110-
const testPlatform = process.env['TEST_PLATFORM'];
105+
if (process.env['CI']) {
106+
const containerInstanceIndex = Number(process.env['CI_NODE_INDEX']) || 0;
107+
const maxParallelContainerInstances = Number(process.env['CI_NODE_TOTAL']) || 1;
108+
const tunnelIdentifier = `angular-material-${process.env['CI_RUNNER_NUMBER']}-${containerInstanceIndex}`;
109+
const buildIdentifier = `ci-${tunnelIdentifier}`;
110+
const testPlatform = 'saucelabs';
111111

112112
// This defines how often a given browser should be launched in the same CircleCI
113113
// container. This is helpful if we want to shard tests across the same browser.

0 commit comments

Comments
 (0)