ci(ivy): configure CI environments for Ivy JIT and AOT (#24309)

Two new CircleCI environments are created: test_ivy_jit and test_ivy_aot.
Both run a subset of the tests that have been marked with Bazel tags as
being appropriate for that environment.

Once all the tests pass, builds are published to the *-builds repo both
for the legacy View Engine compiled code as well as for ivy-jit and ivy-aot.

PR Close #24309
This commit is contained in:
Alex Rickabaugh 2018-06-05 11:38:46 -07:00 committed by Miško Hevery
parent 8be6892777
commit 7983f0a69b
22 changed files with 192 additions and 34 deletions

View File

@ -111,6 +111,42 @@ jobs:
paths:
- "node_modules"
- "~/bazel_repository_cache"
# Temporary job to test what will happen when we flip the Ivy flag to true
test_ivy_jit:
<<: *job_defaults
resource_class: xlarge
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
# See remote cache documentation in /docs/BAZEL.md
- run: .circleci/setup_cache.sh
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- *setup-bazel-remote-cache
- restore_cache:
key: *cache_key
- run: bazel run @yarn//:yarn
- run: bazel query --output=label //... | xargs bazel test --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=-manual,ivy-jit
test_ivy_aot:
<<: *job_defaults
resource_class: xlarge
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
# See remote cache documentation in /docs/BAZEL.md
- run: .circleci/setup_cache.sh
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- *setup-bazel-remote-cache
- restore_cache:
key: *cache_key
- run: bazel run @yarn//:yarn
- run: bazel query --output=label //... | xargs bazel test --define=compile=local --build_tag_filters=ivy-local --test_tag_filters=-manual,ivy-local
# This job exists only for backwards-compatibility with old scripts and tests
# that rely on the pre-Bazel dist/packages-dist layout.
@ -140,6 +176,8 @@ jobs:
root: dist
paths:
- packages-dist
- packages-dist-ivy-jit
- packages-dist-ivy-local
# We run the integration tests outside of Bazel for now.
# They are a separate workflow job so that they can be easily re-run.
@ -200,6 +238,8 @@ workflows:
jobs:
- lint
- test
- test_ivy_jit
- test_ivy_aot
- build-packages-dist
- integration_test:
requires:
@ -212,6 +252,8 @@ workflows:
requires:
# Only publish if tests and integration tests pass
- test
- test_ivy_jit
- test_ivy_aot
- integration_test
# Get the artifacts to publish from the build-packages-dist job
# since the publishing script expects the legacy outputs layout.

View File

@ -24,7 +24,10 @@ ng_package(
"//packages/animations/browser/testing:package.json",
],
entry_point = "packages/animations/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":animations",
"//packages/animations/browser",

View File

@ -27,7 +27,10 @@ ng_package(
],
entry_point = "packages/common/index.js",
packages = ["//packages/common/locales:package"],
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
"//packages/common",
"//packages/common/http",

View File

@ -34,6 +34,9 @@ npm_package(
srcs = [
"package.json",
],
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [":compiler-cli"],
)

View File

@ -21,7 +21,10 @@ ng_package(
],
entry_point = "packages/compiler/compiler.js",
include_devmode_srcs = True,
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":compiler",
"//packages/compiler/testing",

View File

@ -29,7 +29,11 @@ ng_package(
"//packages/core/testing:package.json",
],
entry_point = "packages/core/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"ivy-local",
"release-with-framework",
],
deps = [
":core",
"//packages/core/testing",

View File

@ -11,6 +11,7 @@ ts_library(
exclude = [
"**/*_node_only_spec.ts",
"render3/**/*.ts",
"ivy_local_empty_spec.ts",
],
),
deps = [
@ -33,6 +34,15 @@ ts_library(
],
)
ts_library(
name = "ivy_local_empty_lib",
testonly = 1,
srcs = ["ivy_local_empty_spec.ts"],
deps = [
"//packages:types",
],
)
ts_library(
name = "test_node_only_lib",
testonly = 1,
@ -60,6 +70,19 @@ jasmine_node_test(
],
)
jasmine_node_test(
name = "ivy_local_empty_test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
tags = [
"ivy-local",
"ivy-only",
],
deps = [
":ivy_local_empty_lib",
"//tools/testing:node_no_angular",
],
)
ts_web_test_suite(
name = "test_web",
deps = [

View File

@ -0,0 +1,19 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/*
* This file exists to have at least one test target that can pass with --define=compile=local.
*
* TODO(alxhub): Clean up once actual Angular tests start passing with Ivy/AOT.
*/
describe('empty test', () => {
it('should pass without doing anything', () => {
// If this fails, you probably need a new computer.
});
});

View File

@ -28,7 +28,10 @@ ng_package(
packages = [
"//packages/elements/schematics:npm_package",
],
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":elements",
],

View File

@ -22,7 +22,10 @@ ng_package(
name = "npm_package",
srcs = ["package.json"],
entry_point = "packages/forms/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":forms",
],

View File

@ -25,7 +25,10 @@ ng_package(
"//packages/http/testing:package.json",
],
entry_point = "packages/http/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":http",
"//packages/http/testing",

View File

@ -23,6 +23,7 @@ npm_package(
name = "npm_package",
srcs = ["package.json"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [

View File

@ -27,7 +27,10 @@ ng_package(
"//packages/platform-browser-dynamic/testing:package.json",
],
entry_point = "packages/platform-browser-dynamic/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":platform-browser-dynamic",
"//packages/platform-browser-dynamic/testing",

View File

@ -26,7 +26,10 @@ ng_package(
"//packages/platform-browser/testing:package.json",
],
entry_point = "packages/platform-browser/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":platform-browser",
"//packages/platform-browser/animations",

View File

@ -32,7 +32,10 @@ ng_package(
"//packages/platform-server/testing:package.json",
],
entry_point = "packages/platform-server/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":platform-server",
"//packages/platform-server/testing",

View File

@ -24,6 +24,9 @@ ng_package(
name = "npm_package",
srcs = ["package.json"],
entry_point = "packages/platform-webworker-dynamic/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [":platform-webworker-dynamic"],
)

View File

@ -24,7 +24,10 @@ ng_package(
name = "npm_package",
srcs = ["package.json"],
entry_point = "packages/platform-webworker/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":platform-webworker",
],

View File

@ -28,7 +28,10 @@ ng_package(
"//packages/router/upgrade:package.json",
],
entry_point = "packages/router/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":router",
"//packages/router/testing",

View File

@ -47,6 +47,7 @@ ng_package(
],
entry_point = "packages/service-worker/index.js",
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [

View File

@ -25,7 +25,10 @@ ng_package(
"//packages/upgrade/static:package.json",
],
entry_point = "packages/upgrade/index.js",
tags = ["release-with-framework"],
tags = [
"ivy-jit",
"release-with-framework",
],
deps = [
":upgrade",
"//packages/upgrade/static",

View File

@ -12,30 +12,48 @@ cd "$(dirname "$0")"
# basedir is the workspace root
readonly basedir=$(pwd)/..
readonly bin=$(bazel info bazel-bin)
function buildTargetPackages() {
targets="$1"
destPath="$2"
compileMode="$3"
desc="$4"
echo "##################################"
echo "scripts/build-packages-dist.sh:"
echo " building @angular/* npm packages"
echo " mode: ${desc}"
echo "##################################"
echo "$targets" | xargs bazel build --define=compile=$compileMode
[ -d "${basedir}/${destPath}" ] || mkdir -p $basedir/${destPath}
dirs=`echo "$targets" | grep '//packages/[^/]*:npm_package' | sed -e 's/\/\/packages\/\(.*\):npm_package/\1/'`
for pkg in $dirs; do
# Skip any that don't have an "npm_package" target
srcDir="${bin}/packages/${pkg}/npm_package"
destDir="${basedir}/${destPath}/${pkg}"
if [ -d $srcDir ]; then
echo "# Copy artifacts to ${destDir}"
rm -rf $destDir
cp -R $srcDir $destDir
chmod -R u+w $destDir
fi
done
}
# Ideally these integration tests should run under bazel, and just list the npm
# packages in their deps[].
# Until then, we have to manually run bazel first to create the npm packages we
# want to test.
bazel query --output=label 'kind(.*_package, //packages/...)' \
| xargs bazel build
readonly bin=$(bazel info bazel-bin)
LEGACY_TARGETS=`bazel query --output=label 'kind(.*_package, //packages/...)'`
IVY_JIT_TARGETS=`bazel query --output=label 'attr("tags", "\[.*ivy-jit.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
IVY_LOCAL_TARGETS=`bazel query --output=label 'attr("tags", "\[.*ivy-local.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
buildTargetPackages "$LEGACY_TARGETS" "dist/packages-dist" "legacy" "Production"
buildTargetPackages "$IVY_JIT_TARGETS" "dist/packages-dist-ivy-jit" "jit" "Ivy JIT"
buildTargetPackages "$IVY_LOCAL_TARGETS" "dist/packages-dist-ivy-local" "local" "Ivy AOT"
# Create the legacy dist/packages-dist folder
[ -d "${basedir}/dist/packages-dist" ] || mkdir -p $basedir/dist/packages-dist
# Each package is a subdirectory of bazel-bin/packages/
for pkg in $(ls ${bin}/packages); do
# Skip any that don't have an "npm_package" target
srcDir="${bin}/packages/${pkg}/npm_package"
destDir="${basedir}/dist/packages-dist/${pkg}"
if [ -d $srcDir ]; then
echo "# Copy artifacts to ${destDir}"
rm -rf $destDir
cp -R $srcDir $destDir
chmod -R u+w $destDir
fi
done

View File

@ -117,12 +117,20 @@ function publishPackages {
echo "Finished publishing build artifacts"
}
function publishAllBuilds() {
GIT_SCHEME="$1"
publishPackages $GIT_SCHEME dist/packages-dist $CUR_BRANCH
publishPackages $GIT_SCHEME dist/packages-dist-ivy-jit "${CUR_BRANCH}-ivy-jit"
publishPackages $GIT_SCHEME dist/packages-dist-ivy-local "${CUR_BRANCH}-ivy-aot"
}
# See docs/DEVELOPER.md for help
CUR_BRANCH=${CIRCLE_BRANCH:-$(git symbolic-ref --short HEAD)}
if [ $# -gt 0 ]; then
ORG=$1
publishPackages "ssh" dist/packages-dist $CUR_BRANCH
publishAllBuilds "ssh"
else
ORG="angular"
publishPackages "http" dist/packages-dist $CUR_BRANCH
publishAllBuilds "http"
fi