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

test: cleanup user_managed_deps e2e test #1428

Merged
merged 1 commit into from
Dec 6, 2019
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
23 changes: 6 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ var_7: &hide_node_and_yarn_local_binaries
sudo mv /usr/local/bin/npm /usr/local/bin/npm_
sudo mv /usr/local/bin/yarn /usr/local/bin/yarn_

var_8: &use_legacy_runfiles
run:
name: Use legacy runfiles
command: |
echo 'run --legacy_external_runfiles' >> .bazelrc
echo 'test --legacy_external_runfiles' >> .bazelrc

var_9: &job_defaults
working_directory: ~/rules_nodejs
docker:
Expand Down Expand Up @@ -224,21 +217,14 @@ jobs:
command: bazel test --local_resources=792,1.0,1.0 --test_arg=--local_resources=13288,7.0,1.0 //examples:examples_vendored_node //examples:examples_vendored_node_and_yarn
no_output_timeout: 20m

test_legacy_runfiles:
test_user_managed_deps:
<<: *job_defaults
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
- *use_legacy_runfiles
- *init_bazel
- *hide_node_and_yarn_local_binaries

# We should also be able to test targets in a different workspace
# TODO(gmagolan): move these tests into `build` job once
# https://github.com/bazelbuild/bazel/issues/6481 is resolved
- run: 'cd examples/user_managed_deps && bazel run @nodejs//:yarn_node_repositories'
- run: bazel test @examples_user_managed_deps//...
- run: bazel test @e2e_packages//...
- run: cd examples/user_managed_deps && yarn install && bazel test ...

workflows:
version: 2
Expand All @@ -257,3 +243,6 @@ workflows:
- test_examples:
requires:
- setup
- test_user_managed_deps:
requires:
- setup
13 changes: 0 additions & 13 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,3 @@ load("@build_bazel_integration_testing//tools:repositories.bzl", "bazel_binaries

# Depend on the Bazel binaries
bazel_binaries(versions = [BAZEL_VERSION])

#
# Setup bazel_integration_test repositories
#

local_repository(
name = "e2e_packages",
path = "e2e/packages",
)

load("@e2e_packages//:setup_workspace.bzl", "e2e_packages_setup_workspace")

e2e_packages_setup_workspace()
1 change: 0 additions & 1 deletion e2e/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ e2e_integration_test(

e2e_integration_test(
name = "e2e_packages",
workspace_files = "@e2e_packages//:all_files",
)

e2e_integration_test(
Expand Down
14 changes: 0 additions & 14 deletions e2e/packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,3 @@ nodejs_test(
# TODO(gregmagolan): fix this test on windows
tags = ["fix-windows"],
)

# For testing from the root workspace of this repository with bazel_integration_test.
filegroup(
name = "all_files",
srcs = glob(
include = ["**/*"],
exclude = [
"bazel-out/**/*",
"dist/**/*",
"node_modules/**/*",
],
),
visibility = ["//visibility:public"],
)
36 changes: 33 additions & 3 deletions e2e/packages/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,43 @@ http_archive(
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.2/rules_nodejs-0.42.2.tar.gz"],
)

load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories")
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "npm_install", "yarn_install")

# Test that check_rules_nodejs_version works as expected
check_rules_nodejs_version(minimum_version_string = "0.11.2")

node_repositories()

load(":setup_workspace.bzl", "e2e_packages_setup_workspace")
npm_install(
name = "e2e_packages_npm_install",
data = ["//:postinstall.js"],
package_json = "//:npm1/package.json",
package_lock_json = "//:npm1/package-lock.json",
# Just here as a smoke test for this attribute
prod_only = True,
symlink_node_modules = False,
)

npm_install(
name = "e2e_packages_npm_install_duplicate_for_determinism_testing",
data = ["//:postinstall.js"],
package_json = "//:npm2/package.json",
package_lock_json = "//:npm2/package-lock.json",
symlink_node_modules = False,
)

e2e_packages_setup_workspace()
yarn_install(
name = "e2e_packages_yarn_install",
data = ["//:postinstall.js"],
package_json = "//:yarn1/package.json",
symlink_node_modules = False,
yarn_lock = "//:yarn1/yarn.lock",
)

yarn_install(
name = "e2e_packages_yarn_install_duplicate_for_determinism_testing",
data = ["//:postinstall.js"],
package_json = "//:yarn2/package.json",
symlink_node_modules = False,
yarn_lock = "//:yarn2/yarn.lock",
)
55 changes: 0 additions & 55 deletions e2e/packages/setup_workspace.bzl

This file was deleted.

14 changes: 0 additions & 14 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,6 @@ example_integration_test(
tags = ["no-bazelci-windows"],
)

example_integration_test(
name = "examples_user_managed_deps",
# This test requires calling `bazel run @nodejs//:yarn_node_repositories` before `bazel test ...`
bazel_commands = [
"run @nodejs//:yarn_node_repositories",
"test ...",
],
# replace the following repositories with the generated archives
repositories = {
"//:release": "build_bazel_rules_nodejs",
"@npm_bazel_jasmine//:release": "npm_bazel_jasmine",
},
)

example_integration_test(
name = "examples_vendored_node",
npm_packages = {
Expand Down
3 changes: 1 addition & 2 deletions examples/user_managed_deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ filegroup(
"node_modules/**/*.d.ts",
"node_modules/**/*.json",
]),
visibility = ["//visibility:public"],
)

filegroup(
Expand All @@ -34,7 +33,7 @@ nodejs_binary(
args = ["--node_options=--expose-gc"],
data = [
"index.js",
":node_modules",
"//:node_modules",
],
entry_point = ":index.js",
)
Expand Down
58 changes: 54 additions & 4 deletions examples/user_managed_deps/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
workspace(name = "examples_user_managed_deps")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
# In your code, you'd fetch this repository with an `http_archive` call.
# We do this local repository only because this example lives in the same
# repository with the rules_nodejs code and we want to test them together.
local_repository(
name = "build_bazel_rules_nodejs",
sha256 = "16fc00ab0d1e538e88f084272316c0693a2e9007d64f45529b82f6230aedb073",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.2/rules_nodejs-0.42.2.tar.gz"],
path = "../..",
)
# http_archive(
# name = "build_bazel_rules_nodejs",
# urls = ["https://github.com/bazelbuild/rules_nodejs/archive/x.x.x.tar.gz"],
# strip_prefix = "rules_nodejs-x.x.x",
# )

load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dev_dependencies")

Expand Down Expand Up @@ -43,3 +50,46 @@ local_repository(
# urls = ["https://github.com/bazelbuild/rules_nodejs/archive/x.x.x.tar.gz"],
# strip_prefix = "rules_nodejs-x.x.x/packages/jasmine/src",
# )

# In your code, you'd fetch this repository with an `http_archive` call.
# We do this local repository only because this example lives in the same
# repository with the rules_nodejs code and we want to test them together.
local_repository(
name = "npm_bazel_typescript",
path = "../../packages/typescript/src",
)
# http_archive(
# name = "npm_bazel_jasmine",
# urls = ["https://github.com/bazelbuild/rules_nodejs/archive/x.x.x.tar.gz"],
# strip_prefix = "rules_nodejs-x.x.x/packages/typescript/src",
# )

# TODO(gregmagolan): keep this in sync with root WORKSPACE programatically
git_repository(
name = "build_bazel_rules_typescript",
commit = "951ae46a9651e9f6814b303c5902d858cc509aa4",
remote = "http://github.com/bazelbuild/rules_typescript.git",
)

# We have a source dependency on build_bazel_rules_typescript
# so we must repeat its transitive toolchain deps
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dev_dependencies")

rules_typescript_dev_dependencies()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

gazelle_dependencies()

go_rules_dependencies()

go_register_toolchains()

load("@build_bazel_rules_typescript//internal:ts_repositories.bzl", "ts_setup_dev_workspace")

ts_setup_dev_workspace()

load("@npm_bazel_typescript//internal:ts_repositories.bzl", "ts_setup_workspace")

ts_setup_workspace()
3 changes: 2 additions & 1 deletion examples/user_managed_deps/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"description": "runtime dependencies for program example",
"devDependencies": {
"jasmine": "~2.8.0",
"jasmine": "~3.4.0",
"jasmine-core": "~3.4.0",
"v8-coverage": "1.0.9"
},
"scripts": {
Expand Down
34 changes: 10 additions & 24 deletions examples/user_managed_deps/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ execa@^0.7.0:
signal-exit "^3.0.0"
strip-eof "^1.0.0"

exit@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"

find-up@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
Expand Down Expand Up @@ -123,17 +119,6 @@ get-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"

glob@^7.0.6:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.1.3:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
Expand Down Expand Up @@ -223,17 +208,18 @@ istanbul-reports@^1.3.0:
dependencies:
handlebars "^4.0.3"

jasmine-core@~2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e"
jasmine-core@~3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.4.0.tgz#2a74618e966026530c3518f03e9f845d26473ce3"
integrity sha512-HU/YxV4i6GcmiH4duATwAbJQMlE0MsDIR5XmSVxURxKHn3aGAdbY1/ZJFmVRbKtnLwIxxMJD7gYaPsypcbYimg==

jasmine@~2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.8.0.tgz#6b089c0a11576b1f16df11b80146d91d4e8b8a3e"
jasmine@~3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-3.4.0.tgz#0fa68903ff0c9697459cd044b44f4dcef5ec8bdc"
integrity sha512-sR9b4n+fnBFDEd7VS2el2DeHgKcPiMVn44rtKFumq9q7P/t8WrxsVIZPob4UDdgcDNCwyDqwxCt4k9TDRmjPoQ==
dependencies:
exit "^0.1.2"
glob "^7.0.6"
jasmine-core "~2.8.0"
glob "^7.1.3"
jasmine-core "~3.4.0"

json-parse-better-errors@^1.0.1:
version "1.0.2"
Expand Down
11 changes: 0 additions & 11 deletions packages/jasmine/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# Parts of this BUILD file only necessary when building from source.
# The generated `@bazel/jasmine` npm package contains a trimmed BUILD file using INTERNAL fences.
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("@build_bazel_rules_nodejs//internal/js_library:js_library.bzl", "js_library")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -49,14 +48,4 @@ js_library(
],
module_name = "@bazel/jasmine",
)

pkg_tar(
name = "release",
srcs = [
"index.from_src.bzl",
":package_contents",
],
extension = "tar.gz",
tags = ["manual"],
)
# END-INTERNAL
Loading