Skip to content

Commit

Permalink
meep
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrozenberg committed Jul 12, 2021
1 parent 9ec218b commit d7513ea
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 106 deletions.
77 changes: 24 additions & 53 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 @@ -19,41 +20,38 @@ push_builds_only: &push_builds_only
executors:
amphtml-docker-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
amphtml-xlarge-executor:
machine:
image: ubuntu-2004:202010-01
docker:
- image: cimg/node:lts-browsers
resource_class: xlarge
validator-xlarge-executor:
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'
command: |
if [[ -d /tmp/workspace ]]; then
mv /tmp/workspace /tmp/restored-workspace
fi
maybe_gracefully_halt:
steps:
command: mv /tmp/workspace /tmp/restored-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'
name: 'Create New Workspace'
command: mkdir -p /tmp/workspace
- checkout
- run:
Expand All @@ -65,9 +63,7 @@ commands:
- 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
- node/install-packages
- run:
name: 'Restore Build Output'
command: ./.circleci/restore_build_output.sh
Expand All @@ -79,8 +75,12 @@ commands:
- workspace
install_chrome:
steps:
- browser-tools/install-chrome:
replace-existing: true
- browser-tools/install-browser-tools:
install-chrome: true
install-chromedriver: true
install-firefox: false
install-geckodriver: false
replace-existing-chrome: true
fail_fast:
steps:
- run:
Expand All @@ -107,9 +107,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 +118,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Unminified Build'
Expand All @@ -131,8 +128,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Create Artifacts Directory'
Expand All @@ -148,8 +143,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Module Build'
Expand All @@ -160,8 +153,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Bundle Size'
Expand All @@ -170,10 +161,8 @@ jobs:
- teardown_vm
'Validator Tests':
executor:
name: amphtml-xlarge-executor
name: validator-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- run:
name: 'Install Validator Dependencies'
Expand All @@ -188,8 +177,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -202,8 +189,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -216,8 +201,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -235,8 +218,6 @@ jobs:
type: enum
enum: ['prod', 'canary']
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -254,8 +235,6 @@ jobs:
type: enum
enum: ['prod', 'canary']
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -268,8 +247,6 @@ jobs:
executor:
name: amphtml-large-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -282,8 +259,6 @@ jobs:
executor:
name: amphtml-xlarge-executor
steps:
- restore_workspace
- maybe_gracefully_halt
- setup_vm
- install_chrome
- run:
Expand All @@ -301,8 +276,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 +291,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;
}
console.log(
yellow('⤷ Continuing install in'),
cyan(warningDelaySecs),
Expand Down
2 changes: 1 addition & 1 deletion build-system/task-runner/install-amp-task-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ampCliRunner = 'build-system/task-runner/amp-cli-runner.js';
* @return {Promise<void>}
*/
async function installAmpTaskRunner() {
const npmBinDir = getStdout('npm bin --global').trim();
const npmBinDir = getStdout('npm bin --user').trim();
const ampBinary = path.join(npmBinDir, 'amp');
const ampBinaryExists = await fs.pathExists(ampBinary);
if (ampBinaryExists) {
Expand Down

0 comments on commit d7513ea

Please sign in to comment.