Skip to content

Commit

Permalink
test: cleanup user_managed_deps e2e test
Browse files Browse the repository at this point in the history
* e2e/user_managed_deps now tested with bazelci using working_directory
* remove the old dormant test_legacy_runfiles circleci job
* remove @e2e_packages workspace as it is not being used anymore
  • Loading branch information
gregmagolan committed Dec 6, 2019
1 parent eadb76b commit e6854a6
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 169 deletions.
24 changes: 24 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ tasks:
# TODO(gregmagolan): make node_repositories acccept different archives for different platforms
- "//examples:examples_vendored_node"
- "//examples:examples_vendored_node_and_yarn"
ubuntu1604_user_managed_deps:
name: ubuntu1604_user_managed_deps
platform: ubuntu1604
working_directory: examples/user_managed_deps
test_targets:
- "//..."
ubuntu1804:
name: ubuntu1804
platform: ubuntu1804
Expand Down Expand Up @@ -162,6 +168,12 @@ tasks:
# TODO(gregmagolan): make node_repositories acccept different archives for different platforms
- "//examples:examples_vendored_node"
- "//examples:examples_vendored_node_and_yarn"
ubuntu1804_user_managed_deps:
name: ubuntu1804_user_managed_deps
platform: ubuntu1804
working_directory: examples/user_managed_deps
test_targets:
- "//..."
ubuntu1804_cross_compile_darwin:
name: ubuntu1804_cross_compile_darwin
platform: ubuntu1804
Expand Down Expand Up @@ -262,6 +274,12 @@ tasks:
- "--test_arg=--test_tag_filters=-no-bazelci,-no-bazelci-mac,-manual"
test_targets:
- "//..."
macos_user_managed_deps:
name: macos_user_managed_deps
platform: macos
working_directory: examples/user_managed_deps
test_targets:
- "//..."
macos_cross_compile_linux:
name: macos_cross_compile_linux
platform: macos
Expand Down Expand Up @@ -341,6 +359,12 @@ tasks:
- "--test_arg=--local_resources=13288,1.0,1.0"
test_targets:
- "//..."
windows_user_managed_deps:
name: windows_user_managed_deps
platform: windows
working_directory: examples/user_managed_deps
test_targets:
- "//..."
windows_cross_compile_linux:
name: windows_cross_compile_linux
platform: windows
Expand Down
23 changes: 0 additions & 23 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,22 +217,6 @@ 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:
<<: *job_defaults
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//...

workflows:
version: 2
default_workflow:
Expand Down
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"],
)
34 changes: 32 additions & 2 deletions e2e/packages/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,36 @@ 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
Loading

0 comments on commit e6854a6

Please sign in to comment.