Skip to content

Commit a59d776

Browse files
authored
🏗 Move Edge testing from GH Actions to CircleCI (ampproject#35630)
1 parent b6476c3 commit a59d776

12 files changed

Lines changed: 266 additions & 357 deletions

File tree

.circleci/config.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ commands:
123123
install_firefox:
124124
steps:
125125
- browser-tools/install-firefox
126+
install_edge:
127+
steps:
128+
- run:
129+
name: 'Install Microsoft Edge'
130+
command: ./.circleci/install_microsoft_edge.sh
126131
enable_safari_automation:
127132
steps:
128133
- run:
@@ -349,7 +354,7 @@ jobs:
349354
- enable_safari_automation
350355
- run:
351356
name: '⭐ Browser Tests (Safari) ⭐'
352-
command: node build-system/pr-check/safari-tests.js
357+
command: node build-system/pr-check/browser-tests.js --browser=safari
353358
- store_test_output
354359
- teardown_vm
355360
browser_tests_firefox:
@@ -360,7 +365,18 @@ jobs:
360365
- install_firefox
361366
- run:
362367
name: '⭐ Browser Tests (Firefox) ⭐'
363-
command: node build-system/pr-check/firefox-tests.js
368+
command: node build-system/pr-check/browser-tests.js --browser=firefox
369+
- store_test_output
370+
- teardown_vm
371+
browser_tests_edge:
372+
executor:
373+
name: node-docker-medium
374+
steps:
375+
- setup_vm
376+
- install_edge
377+
- run:
378+
name: '⭐ Browser Tests (Edge) ⭐'
379+
command: node build-system/pr-check/browser-tests.js --browser=edge
364380
- store_test_output
365381
- teardown_vm
366382
performance_tests:
@@ -514,6 +530,11 @@ workflows:
514530
<<: *push_and_pr_builds
515531
requires:
516532
- 'Nomodule Build (Test)'
533+
- browser_tests_edge:
534+
name: 'Browser Tests (Edge)'
535+
<<: *push_and_pr_builds
536+
requires:
537+
- 'Nomodule Build (Test)'
517538
- experiment_build:
518539
name: 'Experiment << matrix.exp >> Build'
519540
matrix:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2021 The AMP HTML Authors. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS-IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the license.
16+
17+
# Script used by AMP's CI builds to install Microsoft Edge Beta on CircleCI.
18+
# Reference: https://www.microsoftedgeinsider.com/en-us/download?platform=linux-deb
19+
# TODO(rsimha): Switch from Beta to Stable once it's available.
20+
21+
set -e
22+
23+
GREEN() { echo -e "\033[0;32m$1\033[0m"; }
24+
25+
echo "$(GREEN "Installing Microsoft Edge...")"
26+
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
27+
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
28+
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
29+
sudo rm microsoft.gpg
30+
sudo apt update && sudo apt install microsoft-edge-beta
31+
EDGE_BETA_BIN=`which microsoft-edge-beta`
32+
echo "export EDGE_BETA_BIN=${EDGE_BETA_BIN}" >> $BASH_ENV
33+
echo $(GREEN "Installation complete.")
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
name: GitHub Actions
1+
name: Cross-Platform Builds
22
on:
33
push:
44
branches:
55
- main
6-
pull_request:
7-
branches:
8-
- main
96

107
jobs:
118
build:
129
if: github.repository == 'ampproject/amphtml'
1310
strategy:
1411
matrix:
15-
platform: [windows-latest]
12+
platform: [ubuntu-latest, macos-latest, windows-latest]
1613
runs-on: ${{ matrix.platform }}
1714
steps:
1815
- name: Checkout Repo
@@ -21,5 +18,5 @@ jobs:
2118
fetch-depth: 0
2219
- name: Install Dependencies
2320
run: bash ./.github/workflows/install_dependencies.sh
24-
- name: Build and Test
25-
run: node build-system/pr-check/cross-browser-tests.js
21+
- name: Build
22+
run: node build-system/pr-check/cross-platform-builds.js

.github/workflows/ie-tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: IE 11
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build_and_test:
12+
if: github.repository == 'ampproject/amphtml'
13+
runs-on: windows-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: Install Dependencies
20+
run: bash ./.github/workflows/install_dependencies.sh
21+
- name: Build and Test
22+
run: node build-system/pr-check/ie-tests.js
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,32 @@
1616
'use strict';
1717

1818
/**
19-
* @fileoverview Script that runs tests on Firefox during CI.
19+
* @fileoverview Script that runs tests on Safari / Firefox / Edge during CI.
2020
*/
2121

2222
const {
2323
skipDependentJobs,
2424
timedExecOrDie,
2525
timedExecOrThrow,
2626
} = require('./utils');
27+
const {browser} = require('minimist')(process.argv.slice(2));
2728
const {runCiJob} = require('./ci-job');
2829
const {Targets, buildTargetsInclude} = require('./build-targets');
2930

30-
const jobName = 'firefox-tests.js';
31+
const jobName = 'browser-tests.js';
3132

3233
/**
3334
* Steps to run during push builds.
3435
*/
3536
function pushBuildWorkflow() {
3637
try {
37-
timedExecOrThrow('amp unit --report --firefox', 'Unit tests failed!');
38+
timedExecOrThrow(`amp unit --report --${browser}`, 'Unit tests failed!');
3839
timedExecOrThrow(
39-
'amp integration --report --nobuild --compiled --firefox',
40+
`amp integration --report --nobuild --compiled --${browser}`,
4041
'Integration tests failed!'
4142
);
4243
timedExecOrThrow(
43-
'amp e2e --report --nobuild --compiled --browsers=firefox',
44+
`amp e2e --report --nobuild --compiled --browsers=${browser}`,
4445
'End-to-end tests failed!'
4546
);
4647
} catch (e) {
@@ -71,13 +72,16 @@ function prBuildWorkflow() {
7172
return;
7273
}
7374
if (buildTargetsInclude(Targets.RUNTIME, Targets.UNIT_TEST)) {
74-
timedExecOrDie('amp unit --firefox');
75+
timedExecOrDie(`amp unit --${browser}`);
7576
}
7677
if (buildTargetsInclude(Targets.RUNTIME, Targets.INTEGRATION_TEST)) {
77-
timedExecOrDie('amp integration --nobuild --compiled --firefox');
78+
timedExecOrDie(`amp integration --nobuild --compiled --${browser}`);
7879
}
79-
if (buildTargetsInclude(Targets.RUNTIME, Targets.E2E_TEST)) {
80-
timedExecOrDie('amp e2e --nobuild --compiled --browsers=firefox');
80+
if (
81+
buildTargetsInclude(Targets.RUNTIME, Targets.E2E_TEST) &&
82+
['safari', 'firefox'].includes(browser) // E2E tests can't be run on Edge.
83+
) {
84+
timedExecOrDie(`amp e2e --nobuild --compiled --browsers=${browser}`);
8185
}
8286
}
8387

build-system/pr-check/cross-browser-tests.js

Lines changed: 0 additions & 147 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright 2021 The AMP HTML Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS-IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
'use strict';
17+
18+
/**
19+
* @fileoverview Script that builds every commit on Linux, macOS, and Windows.
20+
*/
21+
22+
const {runCiJob} = require('./ci-job');
23+
const {timedExecOrDie} = require('./utils');
24+
25+
const jobName = 'cross-platform-builds.js';
26+
27+
/**
28+
* Steps to run during push builds.
29+
*/
30+
function pushBuildWorkflow() {
31+
timedExecOrDie('amp build');
32+
timedExecOrDie('amp dist');
33+
}
34+
35+
runCiJob(jobName, pushBuildWorkflow, () => {});

0 commit comments

Comments
 (0)