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

[Bug]: Builds not working on CircleCI #28

Closed
g-elwell opened this issue Apr 5, 2022 · 8 comments
Closed

[Bug]: Builds not working on CircleCI #28

g-elwell opened this issue Apr 5, 2022 · 8 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@g-elwell
Copy link
Member

g-elwell commented Apr 5, 2022

What happened?

I have the following commands added to my package.json:

"scripts": {
    "watch:dev": "build-tools build",
    "build:prod": "build-tools build --once --production"
  },

Both work as expected locally, but the CLI seems to be having issues locating projects in a CI environment.

  • In a project that uses the build tools within wp-content in site-wide mode, once pushed to CI, the build-tools will default to single-project mode - log
  • Adding the --site flag doesn't seem to have any impact on this behaviour - log
  • However passing a specific project positional will work - log

Note that bbv3 is the project name in the root package.json, which is what is being picked up in the first 2 instances, bigbitev3 is the project name of the theme I'm trying to build.

On another project (a plugin), I'm using the build tools in single-project mode with the same commands as above. Again, all works fine locally but once pushed to CI the build will fail - log

Which environments are you experiencing the issue on?

CI (CircleCI, Travis, etc)

Relevant log output

> [email protected] build:prod
> build-tools build --once --production

Compiling single project in production mode.
Processing the following projects:
 * bbv3 build-tools build [projects] [production] [once] [site] [quiet]

Run a new build process.

Positionals:
  projects  Comma separated list of projects to compile.  [string] [default: ""]

Options:
      --production  Build and compile production assets.
                                                      [boolean] [default: false]
      --once        Only run the process once.        [boolean] [default: false]
      --site        Run the process from the root of a site, such as from
                    wp-content.                       [boolean] [default: false]
      --quiet       Limit the amount of noise by removing webpack output.
                                                      [boolean] [default: false]
  -h, --help        Show help                                          [boolean]
  -v, --version     Show version number                                [boolean]

TypeError: Cannot read properties of null (reading '0')
    at /home/circleci/project/node_modules/@bigbite/build-tools/src/commands/build.js:102:80
    at Array.forEach (<anonymous>)
    at Object.exports.handler (/home/circleci/project/node_modules/@bigbite/build-tools/src/commands/build.js:99:12)
    at /home/circleci/project/node_modules/yargs/build/index.cjs:1:9054
    at j (/home/circleci/project/node_modules/yargs/build/index.cjs:1:4931)
    at M.applyMiddlewareAndGetResult (/home/circleci/project/node_modules/yargs/build/index.cjs:1:9023)
    at M.runCommand (/home/circleci/project/node_modules/yargs/build/index.cjs:1:7206)
    at Jt.[runYargsParserAndExecuteCommands] (/home/circleci/project/node_modules/yargs/build/index.cjs:1:56715)
    at Jt.parse (/home/circleci/project/node_modules/yargs/build/index.cjs:1:38938)
    at Object.<anonymous> (/home/circleci/project/node_modules/@bigbite/build-tools/src/cli.js:12:7)


Exited with code exit status 1
CircleCI received exit code 1
@g-elwell g-elwell added the bug Something isn't working label Apr 5, 2022
@ampersarnie
Copy link
Member

@g-elwell Thanks for the detailed bug report. I'd been concerned about this and are working on it in #18. Can you try using the hotfix/ci-check branch and see if you have any further luck with it (I've not had chance to test it myself yet).

@ampersarnie ampersarnie moved this to To do in Build Tools Apr 5, 2022
@ampersarnie ampersarnie added this to the v1.0 milestone Apr 5, 2022
@ampersarnie
Copy link
Member

@g-elwell I've checked out your repo and branch with the build-tools update. Managed to debug this on CI and have pushed an additional change to the previously mentioned branch. I'm hoping this works without any further issue but I've not have chance to test as thoroughly as I'd like.

I'll be tidying up that PR as there's logic around this that - even though it works now - I've over complicated. I'll let you know as soon as I'm done.

@ampersarnie ampersarnie moved this from To do to In Progress in Build Tools Apr 6, 2022
@g-elwell
Copy link
Member Author

g-elwell commented Apr 6, 2022

@ampersarnie thanks for looking into this and also for checking out my repo.

It looks like there are actually two related issues in play:

  1. Unable to detect full-site mode on CI
  2. Single-project builds failing on CI

Your fix seems to have solved the first problem, which means the repo you inspected is now building correctly as it's now running in full-site mode.

In another project that should run in single-project mode, the build is still failing:

> [email protected] build:prod
> build-tools build --site --once --production

Compiling single project in production mode.
Processing the following projects:
 * block-negative-margin build-tools build [projects] [production] [once] [site] [quiet]

Run a new build process.

Positionals:
  projects  Comma separated list of projects to compile.  [string] [default: ""]

Options:
      --production  Build and compile production assets.
                                                      [boolean] [default: false]
      --once        Only run the process once.        [boolean] [default: false]
      --site        Run the process from the root of a site, such as from
                    wp-content.                       [boolean] [default: false]
      --quiet       Limit the amount of noise by removing webpack output.
                                                      [boolean] [default: false]
  -h, --help        Show help                                          [boolean]
  -v, --version     Show version number                                [boolean]

TypeError: Cannot read properties of null (reading '0')
    at /home/circleci/project/node_modules/@bigbite/build-tools/src/commands/build.js:106:80
    at Array.forEach (<anonymous>)
    at Object.exports.handler (/home/circleci/project/node_modules/@bigbite/build-tools/src/commands/build.js:103:12)
    at /home/circleci/project/node_modules/yargs/build/index.cjs:1:9054
    at j (/home/circleci/project/node_modules/yargs/build/index.cjs:1:4931)
    at M.applyMiddlewareAndGetResult (/home/circleci/project/node_modules/yargs/build/index.cjs:1:9023)
    at M.runCommand (/home/circleci/project/node_modules/yargs/build/index.cjs:1:7206)
    at Jt.[runYargsParserAndExecuteCommands] (/home/circleci/project/node_modules/yargs/build/index.cjs:1:56715)
    at Jt.parse (/home/circleci/project/node_modules/yargs/build/index.cjs:1:38938)
    at Object.<anonymous> (/home/circleci/project/node_modules/@bigbite/build-tools/src/cli.js:12:7)


Exited with code exit status 1
CircleCI received exit code 1

@ampersarnie
Copy link
Member

@g-elwell I've had a dig into the second problem and created a fix for it on the same branch (see commit 250e0b1) if you want to check it out. Again, that branch still needs some tidying up but it should allow you to continue.

@g-elwell
Copy link
Member Author

@ampersarnie unfortunately that fix doesn't seem to have solved the issue for me, I'm still getting the same error in CI when attempting to build this branch. Unless there's something I'm doing wrong?

@ampersarnie
Copy link
Member

ampersarnie commented Apr 11, 2022

@g-elwell You need to rebuild your package-lock.json file as when you use a branch as a target it pins it at a specific commit rather than the branch itself, so rebuild will pull in new commits. I've rebuilt that for you (and removed the --site flag as you don't need it for a single project) and it's passing now.

@g-elwell
Copy link
Member Author

Fantastic, thanks. I thought I did that tbf but clearly missed something.

@ampersarnie
Copy link
Member

@g-elwell Closing this issue for now as we've got that fix in the works that covers this. But feel free to re-open or comment further if anything else around this issue comes up.

Repository owner moved this from In Progress to Done in Build Tools Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants