Skip to content

Commit

Permalink
🏗 Move Edge testing from GH Actions to CircleCI (#35630)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha committed Aug 12, 2021
1 parent b6476c3 commit a59d776
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 357 deletions.
25 changes: 23 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ commands:
install_firefox:
steps:
- browser-tools/install-firefox
install_edge:
steps:
- run:
name: 'Install Microsoft Edge'
command: ./.circleci/install_microsoft_edge.sh
enable_safari_automation:
steps:
- run:
Expand Down Expand Up @@ -349,7 +354,7 @@ jobs:
- enable_safari_automation
- run:
name: '⭐ Browser Tests (Safari) ⭐'
command: node build-system/pr-check/safari-tests.js
command: node build-system/pr-check/browser-tests.js --browser=safari
- store_test_output
- teardown_vm
browser_tests_firefox:
Expand All @@ -360,7 +365,18 @@ jobs:
- install_firefox
- run:
name: '⭐ Browser Tests (Firefox) ⭐'
command: node build-system/pr-check/firefox-tests.js
command: node build-system/pr-check/browser-tests.js --browser=firefox
- store_test_output
- teardown_vm
browser_tests_edge:
executor:
name: node-docker-medium
steps:
- setup_vm
- install_edge
- run:
name: '⭐ Browser Tests (Edge) ⭐'
command: node build-system/pr-check/browser-tests.js --browser=edge
- store_test_output
- teardown_vm
performance_tests:
Expand Down Expand Up @@ -514,6 +530,11 @@ workflows:
<<: *push_and_pr_builds
requires:
- 'Nomodule Build (Test)'
- browser_tests_edge:
name: 'Browser Tests (Edge)'
<<: *push_and_pr_builds
requires:
- 'Nomodule Build (Test)'
- experiment_build:
name: 'Experiment << matrix.exp >> Build'
matrix:
Expand Down
33 changes: 33 additions & 0 deletions .circleci/install_microsoft_edge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Copyright 2021 The AMP HTML Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the license.

# Script used by AMP's CI builds to install Microsoft Edge Beta on CircleCI.
# Reference: https://www.microsoftedgeinsider.com/en-us/download?platform=linux-deb
# TODO(rsimha): Switch from Beta to Stable once it's available.

set -e

GREEN() { echo -e "\033[0;32m$1\033[0m"; }

echo "$(GREEN "Installing Microsoft Edge...")"
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo rm microsoft.gpg
sudo apt update && sudo apt install microsoft-edge-beta
EDGE_BETA_BIN=`which microsoft-edge-beta`
echo "export EDGE_BETA_BIN=${EDGE_BETA_BIN}" >> $BASH_ENV
echo $(GREEN "Installation complete.")
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
name: GitHub Actions
name: Cross-Platform Builds
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
if: github.repository == 'ampproject/amphtml'
strategy:
matrix:
platform: [windows-latest]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout Repo
Expand All @@ -21,5 +18,5 @@ jobs:
fetch-depth: 0
- name: Install Dependencies
run: bash ./.github/workflows/install_dependencies.sh
- name: Build and Test
run: node build-system/pr-check/cross-browser-tests.js
- name: Build
run: node build-system/pr-check/cross-platform-builds.js
22 changes: 22 additions & 0 deletions .github/workflows/ie-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: IE 11
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build_and_test:
if: github.repository == 'ampproject/amphtml'
runs-on: windows-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Dependencies
run: bash ./.github/workflows/install_dependencies.sh
- name: Build and Test
run: node build-system/pr-check/ie-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,32 @@
'use strict';

/**
* @fileoverview Script that runs tests on Firefox during CI.
* @fileoverview Script that runs tests on Safari / Firefox / Edge during CI.
*/

const {
skipDependentJobs,
timedExecOrDie,
timedExecOrThrow,
} = require('./utils');
const {browser} = require('minimist')(process.argv.slice(2));
const {runCiJob} = require('./ci-job');
const {Targets, buildTargetsInclude} = require('./build-targets');

const jobName = 'firefox-tests.js';
const jobName = 'browser-tests.js';

/**
* Steps to run during push builds.
*/
function pushBuildWorkflow() {
try {
timedExecOrThrow('amp unit --report --firefox', 'Unit tests failed!');
timedExecOrThrow(`amp unit --report --${browser}`, 'Unit tests failed!');
timedExecOrThrow(
'amp integration --report --nobuild --compiled --firefox',
`amp integration --report --nobuild --compiled --${browser}`,
'Integration tests failed!'
);
timedExecOrThrow(
'amp e2e --report --nobuild --compiled --browsers=firefox',
`amp e2e --report --nobuild --compiled --browsers=${browser}`,
'End-to-end tests failed!'
);
} catch (e) {
Expand Down Expand Up @@ -71,13 +72,16 @@ function prBuildWorkflow() {
return;
}
if (buildTargetsInclude(Targets.RUNTIME, Targets.UNIT_TEST)) {
timedExecOrDie('amp unit --firefox');
timedExecOrDie(`amp unit --${browser}`);
}
if (buildTargetsInclude(Targets.RUNTIME, Targets.INTEGRATION_TEST)) {
timedExecOrDie('amp integration --nobuild --compiled --firefox');
timedExecOrDie(`amp integration --nobuild --compiled --${browser}`);
}
if (buildTargetsInclude(Targets.RUNTIME, Targets.E2E_TEST)) {
timedExecOrDie('amp e2e --nobuild --compiled --browsers=firefox');
if (
buildTargetsInclude(Targets.RUNTIME, Targets.E2E_TEST) &&
['safari', 'firefox'].includes(browser) // E2E tests can't be run on Edge.
) {
timedExecOrDie(`amp e2e --nobuild --compiled --browsers=${browser}`);
}
}

Expand Down
147 changes: 0 additions & 147 deletions build-system/pr-check/cross-browser-tests.js

This file was deleted.

35 changes: 35 additions & 0 deletions build-system/pr-check/cross-platform-builds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright 2021 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';

/**
* @fileoverview Script that builds every commit on Linux, macOS, and Windows.
*/

const {runCiJob} = require('./ci-job');
const {timedExecOrDie} = require('./utils');

const jobName = 'cross-platform-builds.js';

/**
* Steps to run during push builds.
*/
function pushBuildWorkflow() {
timedExecOrDie('amp build');
timedExecOrDie('amp dist');
}

runCiJob(jobName, pushBuildWorkflow, () => {});

0 comments on commit a59d776

Please sign in to comment.