Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ampproject/amphtml into add/importa…
Browse files Browse the repository at this point in the history
…nce-attr-to-hero-img

* 'main' of github.com:ampproject/amphtml: (525 commits)
  mathml storybook: supply missing component definition. (#37326)
  storybook: Iframe --> BentoIframe (#37327)
  🖍  [Story system layer] New ad badge (#37311)
  🐛 [amp story] Replay/next page button bug fix (#37316)
  🚀  [Story performance] Remove affiliate links (#37280)
  Compiler: Add amp-carousel-0.1 to the builder map (#37308)
  ⏪  [Story system layer] Audio icon disappears when story has background audio (#37314)
  🚀  [Story performance] Remove story access (#37281)
  Fix remapping esbuild output on Windows (#37312)
  🐛 adds in correct weight for amp-story-product-tag text (#37188)
  typechecking carousel: remove shame files (#37213)
  Use remapping to remap minified sourcemap into source code (#37238)
  SwG Release 0.1.22.199 (#37310)
  🐛 Adds microsoft-edge protocol (#34168)
  Sync for validator cpp engine and cpp htmlparser (#37292)
  ✨ amp-story-shopping Updated currency with product price and correct Localized currency (#37249)
  ✨[Smartadserver ad extension] Implement support for Fast Fetch (#36991)
  Remove client-side-experiments-config.json from this repo (#37304)
  🚮  Remove closure compiler logic from build-system. (#37296)
  🌐 Added RTL ordering i18n for amp story shopping tag (#37252)
  ...
  • Loading branch information
westonruter committed Jan 10, 2022
2 parents 9548dbe + f0b7ffe commit df9a488
Show file tree
Hide file tree
Showing 1,952 changed files with 93,855 additions and 43,762 deletions.
53 changes: 36 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
browser-tools: circleci/browser-tools@1.2.2
browser-tools: circleci/browser-tools@1.2.3
node: circleci/node@4.7.0

push_and_pr_builds: &push_and_pr_builds
Expand Down Expand Up @@ -96,6 +96,10 @@ commands:
install-npm: false
- node/install-packages
setup_vm:
parameters:
save-git-cache:
type: boolean
default: false
steps:
- attach_workspace:
at: /tmp
Expand All @@ -107,7 +111,8 @@ commands:
- run:
name: 'Maybe Gracefully Halt'
command: /tmp/restored-workspace/maybe_gracefully_halt.sh
- checkout_repo
- checkout_repo:
save-git-cache: << parameters.save-git-cache >>
- run:
name: 'Configure Development Environment'
command: |
Expand All @@ -123,7 +128,11 @@ commands:
- workspace
install_chrome:
steps:
- run:
name: 'Get Pinned Chrome Version'
command: ./.circleci/get_pinned_chrome_version.sh
- browser-tools/install-chrome:
chrome-version: ${CHROME_VERSION}
replace-existing: true
- browser-tools/install-chromedriver
install_firefox:
Expand All @@ -148,6 +157,10 @@ commands:
path: result-reports
- store_test_results:
path: result-reports
store_filelist:
steps:
- store_artifacts:
path: /tmp/filelist.txt
skip_on_push_builds:
steps:
- when:
Expand Down Expand Up @@ -214,7 +227,7 @@ jobs:
name: '⭐ Module Build ⭐'
command: node build-system/pr-check/module-build.js
- teardown_vm
nomodule_build_prod:
nomodule_build_bundle_size:
executor:
name: node-docker-xlarge
steps:
Expand All @@ -223,7 +236,7 @@ jobs:
name: '⭐ Nomodule Build ⭐'
command: node build-system/pr-check/bundle-size-nomodule-build.js
- teardown_vm
module_build_prod:
module_build_bundle_size:
executor:
name: node-docker-xlarge
steps:
Expand Down Expand Up @@ -270,7 +283,6 @@ jobs:
name: node-docker-large
steps:
- setup_vm
- install_chrome
- run:
name: '⭐ Visual Diff Tests ⭐'
command: node build-system/pr-check/visual-diff-tests.js
Expand Down Expand Up @@ -299,6 +311,7 @@ jobs:
name: '⭐ All Unit Tests ⭐'
command: node build-system/pr-check/unit-tests.js
- store_test_output
- store_filelist
- teardown_vm
unminified_tests:
executor:
Expand Down Expand Up @@ -354,12 +367,14 @@ jobs:
name: '⭐ End-to-End Tests ⭐'
command: node build-system/pr-check/e2e-tests.js
- store_test_output
- store_filelist
- teardown_vm
browser_tests_safari:
executor:
name: macos-medium
steps:
- setup_vm
- setup_vm:
save-git-cache: true
- enable_safari_automation
- run:
name: '⭐ Browser Tests (Safari) ⭐'
Expand Down Expand Up @@ -433,6 +448,7 @@ jobs:
name: '⭐ Experiment << parameters.exp >> End-to-End Tests ⭐'
command: node build-system/pr-check/experiment-e2e-tests.js --experiment=experiment<< parameters.exp >>
- store_test_output
- store_filelist
- teardown_vm
amp_release:
executor:
Expand All @@ -456,14 +472,14 @@ jobs:
name: '⭐ amp release ⭐'
command: node --unhandled-rejections=strict build-system/release-workflows/build-release.js
- teardown_vm
archive_release:
upload_release:
executor:
name: node-docker-medium
steps:
- setup_vm
- run:
name: 'Archive Release Artifacts ⭐'
command: node --unhandled-rejections=strict build-system/release-workflows/archive-release.js
name: 'Upload Release Artifacts ⭐'
command: node --unhandled-rejections=strict build-system/release-workflows/upload-release.js
- store_artifacts:
path: /tmp/release.tar.gz
- teardown_vm
Expand Down Expand Up @@ -496,13 +512,13 @@ workflows:
<<: *push_and_pr_builds
requires:
- 'Initialize Repository'
- nomodule_build_prod:
name: 'Nomodule Build (Prod)'
- nomodule_build_bundle_size:
name: 'Nomodule Build (Bundle Size)'
<<: *push_and_pr_builds
requires:
- 'Initialize Repository'
- module_build_prod:
name: 'Module Build (Prod)'
- module_build_bundle_size:
name: 'Module Build (Bundle Size)'
<<: *push_and_pr_builds
requires:
- 'Initialize Repository'
Expand All @@ -515,8 +531,8 @@ workflows:
name: 'Bundle Size'
<<: *push_and_pr_builds
requires:
- 'Nomodule Build (Prod)'
- 'Module Build (Prod)'
- 'Nomodule Build (Bundle Size)'
- 'Module Build (Bundle Size)'
- validator_tests:
name: 'Validator Tests'
<<: *push_and_pr_builds
Expand All @@ -526,6 +542,7 @@ workflows:
name: 'Visual Diff Tests'
<<: *push_and_pr_builds
requires:
- 'Module Build (Test)'
- 'Nomodule Build (Test)'
- local_unit_tests:
name: 'Local Unit Tests'
Expand Down Expand Up @@ -623,8 +640,10 @@ workflows:
<<: *release_builds_only
requires:
- 'Initialize Repository'
- archive_release:
name: 'Archive Release'
- upload_release:
name: 'Upload Release'
<<: *release_builds_only
requires:
- amp_release
context:
- release-build-uploader
57 changes: 57 additions & 0 deletions .circleci/get_pinned_chrome_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
#
# Script used to determine the pinned version of Google Chrome on CircleCI.

set -e

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

# Extract the chromedriver version used by AMP's E2E tests
# See https://www.npmjs.com/package/chromedriver
echo "$(GREEN "Extracting Chromedriver version from") $(CYAN "build-system/tasks/e2e/package.json")$(GREEN "...")"
CHROMEDRIVER_VERSION="$(cat build-system/tasks/e2e/package.json | jq -r .devDependencies.chromedriver)"
if [[ -z "$CHROMEDRIVER_VERSION" ]]; then
echo "$(RED "Could not extract Chromedriver version from") $(CYAN "build-system/tasks/e2e/package.json"))"
exit 1
fi
echo "$(GREEN "Chromedriver version is") $(CYAN "${CHROMEDRIVER_VERSION}")"

# Determine the Chrome major version to be installed
echo "$(GREEN "Determining Chrome major version...")"
CHROME_MAJOR_VERSION="$(echo $CHROMEDRIVER_VERSION | cut -d'.' -f1)"
if [[ -z "$CHROME_MAJOR_VERSION" ]]; then
echo "$(RED "Could not determine Chrome major version")"
exit 1
fi
echo "$(GREEN "Chrome major version is") $(CYAN "${CHROME_MAJOR_VERSION}")"

# Determine the Chrome version history URL based on the platform identifier
# See https://developer.chrome.com/docs/versionhistory/reference/#platform-identifiers
echo "$(GREEN "Determining Chrome version history URL...")"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
PLATFORM_IDENTIFIER="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
PLATFORM_IDENTIFIER="mac"
elif [[ "$OSTYPE" == "win32" ]]; then
PLATFORM_IDENTIFIER="win"
else
echo "$(RED "Incompatible OS") $(CYAN "${OSTYPE}")"
exit 1
fi
CHROME_VERSION_HISTORY_URL="https://versionhistory.googleapis.com/v1/chrome/platforms/${PLATFORM_IDENTIFIER}/channels/stable/versions"
echo "$(GREEN "Chrome version history URL is") $(CYAN "${CHROME_VERSION_HISTORY_URL}")"

# Determine the Chrome version
# See https://developer.chrome.com/docs/versionhistory/guide
echo "$(GREEN "Determining Chrome version...")"
CHROME_VERSION="$(curl -sS ${CHROME_VERSION_HISTORY_URL} | jq -r ".versions[]|.version" | grep -m 1 "${CHROME_MAJOR_VERSION}\.")"
if [[ -z "$CHROME_VERSION" ]]; then
echo "$(RED "Could not determine Chrome version")"
exit 1
fi
echo "$(GREEN "Chrome version is") $(CYAN "${CHROME_VERSION}")"

echo "export CHROME_VERSION=$CHROME_VERSION" >> $BASH_ENV
echo $(GREEN "Successfully determined pinned version of Chrome")
46 changes: 18 additions & 28 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
# Local cache directories
# Keep this list in sync with .gitignore, .prettierignore, and build-system/tasks/clean.js
.babel-cache
.css-cache
.jss-cache
.pre-closure-cache
# Files and directories explicitly ignored by eslint
**/node_modules/**
build-system/babel-plugins/**/fixtures/**/*.js
build-system/babel-plugins/**/fixtures/**/*.mjs
build-system/tasks/make-extension/template/**/*
examples/amp-script/todomvc.ssr.js
examples/amp-script/vue-todomvc.js
extensions/amp-a4a/0.1/test/testdata/**
src/purifier/noop.js
testing/local-amp-chrome-extension/**
third_party/**
validator/**

# [GLOBALLY IGNORED]
# (Don't edit or remove the above comment!)
# The rules below are synced between .gitignore and .prettierignore, and are
# removed by `amp clean`.

# Output directories
# Keep this list in sync with .gitignore, .prettierignore, and build-system/tasks/clean.js
.*cache
.amp-dep-check
build
build-system/dist
build-system/server/new-server/transforms/dist
build-system/tasks/performance/cache
build-system/tasks/performance/results.json
build-system/global-configs/custom-config.json
dist
dist.3p
dist.tools
export
examples/storybook
extensions/**/dist
/release
result-reports
src/purifier/dist
test/coverage
test/coverage-e2e
validator/**/dist
validator/export

# Files and directories explicitly ignored by eslint
**/node_modules/**
build-system/babel-plugins/**/fixtures/**/*.js
build-system/babel-plugins/**/fixtures/**/*.mjs
build-system/tasks/make-extension/template/**/*
examples/amp-script/todomvc.ssr.js
examples/amp-script/vue-todomvc.js
extensions/amp-a4a/0.1/test/testdata/**
src/purifier/noop.js
testing/local-amp-chrome-extension/**
third_party/**
validator/**
19 changes: 15 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = {
'parser': '@babel/eslint-parser',
'plugins': [
'chai-expect',
'google-camelcase',
'import',
'jsdoc',
'local',
Expand Down Expand Up @@ -97,7 +96,6 @@ module.exports = {
'chai-expect/no-inner-compare': 2,
'chai-expect/terminating-properties': 2,
'curly': 2,
'google-camelcase/google-camelcase': 2,

// Rules restricting/standardizing import statements
'import/no-unresolved': [
Expand Down Expand Up @@ -165,8 +163,11 @@ module.exports = {

// Custom repo rules defined in build-system/eslint-rules
'local/await-expect': 2,
'local/camelcase': 2,
'local/closure-type-primitives': 2,
'local/core-dom-jsx': 2,
'local/dict-string-keys': 2,
'local/enums': 2,
'local/get-mode-usage': 2,
'local/html-template': 2,
'local/is-experiment-on': 2,
Expand All @@ -176,7 +177,6 @@ module.exports = {
'local/no-bigint': 2,
'local/no-deep-destructuring': 2,
'local/no-duplicate-import': 2,
'local/no-duplicate-name-typedef': 2,
'local/no-dynamic-import': 2,
'local/no-es2015-number-props': 2,
'local/no-export-side-effect': 2,
Expand Down Expand Up @@ -356,6 +356,7 @@ module.exports = {
'rules': {
'require-jsdoc': 0,
'local/always-call-chai-methods': 2,
'local/enums': 0,
'local/no-bigint': 0,
'local/no-dynamic-import': 0,
'local/no-function-async': 0,
Expand Down Expand Up @@ -437,7 +438,7 @@ module.exports = {
'jsdoc/check-tag-names': 0,
'local/closure-type-primitives': 0,
'local/no-duplicate-name-typedef': 0,
'google-camelcase/google-camelcase': 0,
'local/camelcase': 0,
},
},
{
Expand All @@ -458,5 +459,15 @@ module.exports = {
'files': ['src/preact/**', 'extensions/**/1.0/**', '**/storybook/**'],
'rules': {'local/preact-preferred-props': 2},
},
{
// Files that use JSX for plain DOM nodes instead of Preact
'files': [
'extensions/amp-story/**',
'extensions/amp-story-*/**',
// Extensions whose version is lower than 1.0 do not use Preact
'extensions/*/0.*/**',
],
'rules': {'local/preact': [2, '#core/dom/jsx']},
},
],
};
4 changes: 4 additions & 0 deletions .github/workflows/cross-platform-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Set Up Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Dependencies
run: bash ./.github/workflows/install_dependencies.sh
- name: ${{ matrix.flavor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cut-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set Up Node
uses: actions/setup-node@v2
with:
node-version: lts/*
node-version: 16

- name: Set Up Environment
run: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Expand Down
Loading

0 comments on commit df9a488

Please sign in to comment.