Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏗 Use Docker containers in CircleCI builds, and other optimizations #35176

Merged
merged 8 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 30 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: 2.1

orbs:
browser-tools: circleci/browser-tools@1.1.3
node: circleci/node@4.5.1

push_and_pr_builds: &push_and_pr_builds
filters:
Expand All @@ -17,60 +18,51 @@ push_builds_only: &push_builds_only
- /^amp-release-.*$/

executors:
amphtml-docker-small-executor:
amphtml-small-executor:
docker:
- image: cimg/base:2021.05
- image: cimg/base:stable
resource_class: small
amphtml-medium-executor:
machine:
image: ubuntu-2004:202010-01
docker:
- image: cimg/node:lts-browsers
resource_class: medium
amphtml-large-executor:
machine:
image: ubuntu-2004:202010-01
docker:
- image: cimg/node:lts-browsers
resource_class: large
danielrozenberg marked this conversation as resolved.
Show resolved Hide resolved
amphtml-xlarge-executor:
machine:
image: ubuntu-2004:202010-01
docker:
- image: cimg/node:lts-browsers
resource_class: xlarge
validator-xlarge-executor:
danielrozenberg marked this conversation as resolved.
Show resolved Hide resolved
docker:
- image: cimg/openjdk:16.0-node
resource_class: xlarge

commands:
restore_workspace:
setup_vm:
steps:
- attach_workspace:
at: /tmp
- run:
name: 'Rename Restored Workspace'
name: 'Configure Temporary Workspace'
command: |
if [[ -d /tmp/workspace ]]; then
mv /tmp/workspace /tmp/restored-workspace
fi
maybe_gracefully_halt:
steps:
mv /tmp/workspace /tmp/restored-workspace
mkdir -p /tmp/workspace
- run:
name: 'Maybe Gracefully Halt'
command: curl -sS https://raw.githubusercontent.com/ampproject/amphtml/main/.circleci/maybe_gracefully_halt.sh | bash
setup_vm:
steps:
- run:
name: 'Create Workspace'
command: mkdir -p /tmp/workspace
- checkout
- run:
name: 'Fetch Merge Commit'
command: ./.circleci/fetch_merge_commit.sh
- run:
name: 'Check Config'
command: ./.circleci/check_config.sh
- run:
name: 'Configure Hosts'
command: cat ./build-system/test-configs/hosts | sudo tee -a /etc/hosts
- run:
name: 'Install Dependencies'
command: ./.circleci/install_dependencies.sh
- run:
name: 'Restore Build Output'
command: ./.circleci/restore_build_output.sh
name: 'Configure Development Environment'
command: |
./.circleci/fetch_merge_commit.sh
./.circleci/check_config.sh
./.circleci/restore_build_output.sh
cat ./build-system/test-configs/hosts | sudo tee -a /etc/hosts
# TODO(danielrozenberg): consolidate the extra steps.
- node/install-packages:
override-ci-command: npm config set prefix $HOME && npm ci
teardown_vm:
steps:
- persist_to_workspace:
Expand All @@ -81,6 +73,7 @@ commands:
steps:
- browser-tools/install-chrome:
replace-existing: true
- browser-tools/install-chromedriver
fail_fast:
steps:
- run:
Expand All @@ -97,7 +90,7 @@ commands:
jobs:
'Compute Merge Commit':
executor:
name: amphtml-docker-small-executor
name: amphtml-small-executor
steps:
- run:
name: 'Compute Merge Commit'
Expand All @@ -107,9 +100,8 @@ jobs:
executor:
name: amphtml-medium-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
name: 'Checks'
command: node build-system/pr-check/checks.js
Expand All @@ -119,8 +111,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Unminified Build'
Expand All @@ -131,8 +121,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Create Artifacts Directory'
Expand All @@ -148,8 +136,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Module Build'
Expand All @@ -160,8 +146,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Bundle Size'
Expand All @@ -170,10 +154,8 @@ jobs:
- teardown_vm
'Validator Tests':
executor:
name: amphtml-xlarge-executor
name: validator-xlarge-executor
rsimha marked this conversation as resolved.
Show resolved Hide resolved
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Install Validator Dependencies'
Expand All @@ -188,8 +170,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -202,8 +182,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -216,8 +194,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -235,8 +211,6 @@ jobs:
type: enum
enum: ['prod', 'canary']
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -254,8 +228,6 @@ jobs:
type: enum
enum: ['prod', 'canary']
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -268,8 +240,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -282,8 +252,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -301,8 +269,6 @@ jobs:
type: enum
enum: ['A', 'B', 'C']
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Experiment << parameters.exp >> Build'
Expand All @@ -318,8 +284,6 @@ jobs:
type: enum
enum: ['A', 'B', 'C']
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand Down
41 changes: 0 additions & 41 deletions .circleci/install_dependencies.sh

This file was deleted.

12 changes: 4 additions & 8 deletions .circleci/install_validator_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list

echo $(GREEN "Installing Bazel...")
sudo apt update
sudo apt install bazel
echo $(GREEN "Updating and installing apt packages...")
sudo apt update && sudo apt install bazel clang python3 python3-pip protobuf-compiler

echo $(GREEN "Installing Clang...")
sudo apt install clang

echo $(GREEN "Installing Protobuf...")
pip3 install --user protobuf
echo $(GREEN "Installing protobuf python module...")
pip3 install protobuf
7 changes: 4 additions & 3 deletions .circleci/restore_build_output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ YELLOW() { echo -e "\033[0;33m$1\033[0m"; }
CYAN() { echo -e "\033[0;36m$1\033[0m"; }

MERGABLE_OUTPUT_DIRS="build dist dist.3p dist.tools"

# TODO(danielrozenberg): remove conditional after #33708 is merged.
WORKSPACE_DIR=$(if [[ -d /tmp/restored-workspace ]]; then echo "/tmp/restored-workspace"; else echo "/tmp/workspace"; fi)
WORKSPACE_DIR="/tmp/restored-workspace"

if [[ -d "${WORKSPACE_DIR}/builds" ]]; then
echo $(GREEN "Installing rsync...")
sudo apt update && sudo apt install rsync

echo $(GREEN "Restoring build output from workspace")
for CONTAINER_DIR in ${WORKSPACE_DIR}/builds/*; do
for OUTPUT_DIR in ${MERGABLE_OUTPUT_DIRS}; do
Expand Down
8 changes: 8 additions & 0 deletions build-system/common/check-package-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ async function main() {
yellow('\nWARNING: Detected problems with'),
cyan(Array.from(updatesNeeded).join(', '))
);
if (process.env.CI) {
console.log(
yellow('Skipping delay prompt for'),
cyan('CI'),
yellow('environment.')
);
return;
}
danielrozenberg marked this conversation as resolved.
Show resolved Hide resolved
console.log(
yellow('⤷ Continuing install in'),
cyan(warningDelaySecs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ describes.endtoend(
//TODO(sparhami): fails on shadow demo
it.configure()
.skipShadowDemo()
.run('should snap on the center point', async () => {
// TODO(#35241): flaky test disabled in #35176
.skip('should snap on the center point', async () => {
const el = await getScrollingElement(controller);
const slides = await getSlides(controller);
const scrollAmount = 1 + slideOneWidth / 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ describes.endtoend(
controller = env.controller;
});

it('should set snap property on spacers', async () => {
// TODO(#35241): flaky test disabled in #35176
it.skip('should set snap property on spacers', async () => {
const spacers = await getSpacers(controller);
for (let i = 0; i < spacers.length; i++) {
const spacer = spacers[i];
Expand Down
Loading