Add "check-javascript-syntax" CircleCI build task#590
Conversation
This reverts commit e956dd4.
**Why**: To help avoid issues where JavaScript code which is not supported in legacy browsers could unknowingly be included in the built assets. See: - #587 - 18F/identity-idp#4296
|
Fails in CircleCI as expected: |
|
Revert the revert in 286bbe5. |
.circleci/config.yml
Outdated
| - install-dependencies | ||
| - run: | ||
| name: build javascript | ||
| command: npm run build-js |
There was a problem hiding this comment.
We have a lot of parallel build steps now.
Our JS build is fairly fast, so maybe not worth it here, but this is duplicated from our build-site command. Maybe would it be worth having a multi-phase job where we build the site once in build-site and then save the workspace and load that workspace in all the jobs that run the various checks?
So it would look like:
[build site, cache artifact] ->
- run JS lint
- run JS specs
- run ruby specs on built site, etc etc
There was a problem hiding this comment.
Some example of workspace saving across steps in the old handbook: https://github.com/18F/identity-handbook-private/blob/master/.circleci/config.yml#L47-L59
There was a problem hiding this comment.
Yeah, that sounds really great. I've tried incorporating this for "base" tests, as well as the external links checking which has a similar need. The timings aren't quite as promising as I'd have hoped, and in-fact the builds take slightly longer than before I'd incorporated it.
Still, it seems like a good idea in theory, and might help some future scalability, so I'd be fine to keep the changes 🤷
There was a problem hiding this comment.
Awesome! thanks for digging in to all that! I'm OK keeping these changes if you are
**Why**: Avoid per-job checkout, install, build
This reverts commit e956dd4.
**Why**: Less to persist, vendor dependencies can be expected to be cached in install-dependencies caching
Fix error: "Directory you are trying to checkout to is not empty and not a git repository"
faster hopefully
| - persist_to_workspace: | ||
| root: "." | ||
| paths: | ||
| - "_site" |
There was a problem hiding this comment.
do we want to persist the node_modules etc too? or do we assume that caching will take care of that for us
There was a problem hiding this comment.
do we want to persist the
node_modulesetc too? or do we assume that caching will take care of that for us
I did that at first, and I found that it took a very long time for the persist_to_workspace step itself to complete, probably because node_modules is a black hole. And yeah, was hopeful that the caching in install-dependencies could keep it fast enough.
See: fe78bdf
Why: To help avoid issues where JavaScript code which is not supported in legacy browsers could unknowingly be included in the built assets.
See:
Changes temporarily include a revert of #587 to verify that the build fails as expected. This should be re-reverted prior to merging.