google / closure-compiler-npm

Package for managing and documenting closure-compiler for use via npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI is failing

brad4d opened this issue · comments

So far I haven't been able to reproduce this.

  1. clone git@github.com:google/closure-compiler-npm.git
  2. cd closure-compiler-npm
  3. git submodule init
  4. git submodule update
  5. yarn install = yarn install v1.22.15
  6. sudo apt install bazel-4.2.2
  7. ./build-scripts/build_compiler.js

The build succeeded.

The error in the CI output is:

Analyzing: target //:compiler_unshaded_deploy.jar (19 packages loaded, 6 targets configured)
ERROR: While resolving toolchains for target //:compiler_unshaded: invalid registered toolchain '//toolchains:all': while parsing '//toolchains:all': no such package 'toolchains': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /home/runner/work/closure-compiler-npm/closure-compiler-npm/compiler/toolchains
ERROR: Analysis of target '//:compiler_unshaded_deploy.jar' failed; build aborted: invalid registered toolchain '//toolchains:all': while parsing '//toolchains:all': no such package 'toolchains': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /home/runner/work/closure-compiler-npm/closure-compiler-npm/compiler/toolchains
INFO: Elapsed time: [19](https://github.com/google/closure-compiler-npm/runs/6536803773?check_suite_focus=true#step:10:20).758s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (19 packages loaded, 6 targets configured)
FAILED: Build did NOT complete successfully (19 packages loaded, 6 targets configured)
/home/runner/work/closure-compiler-npm/closure-compiler-npm/build-scripts/run-command.js:67
        const err = new Error(`non-zero exit code ${exitCode}`);
                    ^

Error: non-zero exit code 1
    at ChildProcess.<anonymous> (/home/runner/work/closure-compiler-npm/closure-compiler-npm/build-scripts/run-command.js:67:[21](https://github.com/google/closure-compiler-npm/runs/6536803773?check_suite_focus=true#step:10:22))
    at ChildProcess.emit (node:events:5[27](https://github.com/google/closure-compiler-npm/runs/6536803773?check_suite_focus=true#step:10:28):[28](https://github.com/google/closure-compiler-npm/runs/6536803773?check_suite_focus=true#step:10:29))
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:[30](https://github.com/google/closure-compiler-npm/runs/6536803773?check_suite_focus=true#step:10:31)2:5) {
  stdout: '',
  stderr: '',
  exitCode: 1
}
Error: Process completed with exit code 1.

It is definitely true that closure-compiler-npm/cmpiler/toolchains does not exist for me.

$ bazel query "deps(//:compiler_unshaded_deploy.jar)" |grep toolchain
Loading: 0 packages loaded
@bazel_tools//tools/build_defs/cc/whitelists/starlark_hdrs_check:loose_header_check_allowed_in_toolchain
@bazel_tools//tools/cpp:current_cc_toolchain
@bazel_tools//tools/cpp:toolchain
@bazel_tools//tools/jdk:current_java_toolchain
@com_google_protobuf//:java_toolchain
@com_google_protobuf//java/core:toolchain
@local_config_cc//:toolchain

I don't seem to have a dependency on //toolchains:all, even though that dependency does seem to appear in the error message above.

I realized I hadn't updated the compiler submodule to master and a few other things that get done in .github/workflows/build.yml
Also I needed to set some environment variables.

  1. export COMPILER_NIGHTLY=true
  2. export FORCE_COLOR=1
  3. cd compiler
  4. git checkout master
  5. git pull https://github.com/google/closure-compiler.git master
  6. cd ..
  7. I don't know what to do to simulate the "Yarn and maven cache" step
  8. yarn install --colors=always
  9. `./build-scripts/build_compiler.js

still no failure

@ChadKillingsworth do you think you'd be able to help me figure out how to reproduce this problem?

I took a look at this today.

Diff: google/closure-compiler@be4a583...0e25e01

What jumps out to me is the Bazel upgrade to 5.1.1 while the build in this repo still uses v4:

bazel-version: '4.2.2'

I reproduced the issue in https://github.com/google/closure-compiler-npm/runs/6707025080 and updating Bazel fixes it.

Though the current submodule compiler version fails with 5.1.1. Maybe they have to be updated together.

I think using bazelisk instead of bazel might be the better option. That way it should automatically pick the correct bazel version.

Bazelisk does indeed seem to work. #243 should be ready for review.

@frigus02 Thanks a lot for the fix.

It's weird. I explicitly did my local build with bazel 4.2.2, because I thought it might be a bazel version problem, and it seemed to build just fine. I can't explain that...

That is indeed weird. Maybe there were a few things that had to come together to make it fail. 🤷