-
Notifications
You must be signed in to change notification settings - Fork 14
Adds integrity check of formatter as a CI/CD step #416
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
Conversation
|
| "watch": "turbowatch ./turbowatch.ts", | ||
| "test": "turbo run test", | ||
| "test:e2e": "turbo run test:e2e", | ||
| "test:formattingIntegrity": "ts-node ./packages/language-support/src/tests/formatting/verification/verificationCheck.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if there's a more idiomatic way to run a file as a script? Or maybe it shouldn't be run as a script at all, maybe there's a better way? Happy to take any suggestions here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other cases, I've made the script build js and then execute it. We've also needed to use cross-env for some cases (see the gen-parser script, although being on mac I don't really know why it's needed 😅 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record I think it's fine to leave as is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cross-env is only to use environment variables (we cannot set them for builds on Windows otherwise)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we move to node22 we can run it without ts-node as well with --experimental-strip-types
| --------- QUERY BEFORE START ------------ | ||
| ${query} | ||
| --------- QUERY BEFORE END ---------- | ||
| --------- QUERY FORMATTED START ------------ | ||
| ${formatted} | ||
| --------- QUERY FORMATTED END ---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leaves some pretty nice output which should make it easy to debug, see this one for instance:
https://github.com/neo4j/cypher-language-support/actions/runs/13951159540/job/39050765538
OskarDamkjaer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good (with a few small tweaks). Let's see what @ncordon thinks 😄
| branches: | ||
| - main | ||
| paths: | ||
| - 'packages/language-support/src/formatting/**' | ||
|
|
||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'packages/language-support/src/formatting/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both PRs and pulls? I think only pull requests would be good enough. Perhaps we'd also want it as part of the release checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why you think it shouldn't run on both PRs and commits? My reasoning was it might help catch cases where a check on a PR is outdated, and I don't think it's too expensive. it's also faster than e2e tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think it's a bit wasteful, but feel free to leave it in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ncordon What's your opinion on this?
| "watch": "turbowatch ./turbowatch.ts", | ||
| "test": "turbo run test", | ||
| "test:e2e": "turbo run test:e2e", | ||
| "test:formattingIntegrity": "ts-node ./packages/language-support/src/tests/formatting/verification/verificationCheck.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other cases, I've made the script build js and then execute it. We've also needed to use cross-env for some cases (see the gen-parser script, although being on mac I don't really know why it's needed 😅 )
| "watch": "turbowatch ./turbowatch.ts", | ||
| "test": "turbo run test", | ||
| "test:e2e": "turbo run test:e2e", | ||
| "test:formattingIntegrity": "ts-node ./packages/language-support/src/tests/formatting/verification/verificationCheck.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record I think it's fine to leave as is here
ncordon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me but just so you know the file is not stored with lfs, which you could and I don't know if that was the intention given the description of the PR?
Yeah I couldn't find what the exact pricing was for regular objects in a git repo so I used the LFS numbers as a reference. The assumption I'm making is that the price is comparable when also factoring in the cost of gh actions. The magnitude of the numbers is the most important thing I think |
Description
As discussed in three different syncs (XD) and in various slack threads:
We would like to add a CI / CD step that automatically runs the "verify formatting" check that we have been manually running with local files. This check essentially just means running the following integrity checks on a large amount of sample queries (real queries from Aura that we got from the product-analytics people):
This integrity check should happen on any change to the src/formatting folder (see the new file
formatting-integrity-check.yaml)Why has this not been introduced earlier?
Why is it being introduced now; how have we solved / changed our opinions on these issues?
aaaaaand deduplicate queries by matching stringsTesting