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

ATM: add PR check running boosted queries #11065

Merged
merged 3 commits into from Nov 2, 2022

Conversation

jhelie
Copy link
Contributor

@jhelie jhelie commented Nov 1, 2022

As discussed this clones a hard-coded open-source repo and builds a JavaScript database from the latest commit.

POC run here

@jhelie jhelie requested a review from a team as a code owner Nov 1, 2022
@jhelie jhelie force-pushed the jhelie/add-check-to-run-atm-queries branch 2 times, most recently from fb12d29 to bc8ae02 Compare Nov 1, 2022
Copy link
Contributor

@henrymercer henrymercer left a comment

Thanks for doing this, this will be a really useful PR check!

.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
- uses: actions/checkout@v3
with:
path: codeql-lib
Copy link
Contributor

@henrymercer henrymercer Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the repo out at the default path generally simplifies things.

Suggested change
- uses: actions/checkout@v3
with:
path: codeql-lib
- uses: actions/checkout@v3

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will checkout the repo in the current dir. I don't see how this is desirable, are we sure about this?

Copy link
Contributor

@henrymercer henrymercer Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's desirable for standardisation and because other Actions can make the assumption that they have a checkout of the repo in the expected place.

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make sure I understand: we do ditch this approach for workflows involving several checkouts, right?

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and does it mean we need to worry about where we create our database? there's no guarantee that DB_PATH doesn't collide with a directory from the checkout

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I initially thought that the default path would be the name of the repo, similar to the gh repo clone command)

Copy link
Contributor

@henrymercer henrymercer Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same $RUNNER_TEMP logic really ought to apply to the other checked out repos - or any directory we'd like to create for that matter. I don't have enough knowledge to have a strong opinion but, on the basis of the workflows I interact with, this new approach is a net regression.

The only difficulty with that is it becomes slightly harder to reference where the repo is, so you'd have to write working-directory: ${{ env.CODEQL_LIB_PATH }} for example.

I'll have to disagree with you on the net regression. The Action is now considerably terser and easier to read in my opinion.

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to disagree - but the workflow is actually more verbose and convoluted: instead of checking out in foo and then creating a bardirectory without worrying, we have to use temporary folders. And the more repos/directories we need to checkout out/create the worse it will get (unless, as you suggest, we are happy with being inconsistent and reverting to a "hope for the best" approach when checking out additional repos). But I admit I don't understand what you meant initially with the expected benefit:

It's desirable for standardisation and because other Actions can make the assumption that they have a checkout of the repo in the expected place.

Did you mean composite Actions? In the case of this workflow the drawbacks jump out but I'm missing the improvements.

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(having said that, $RUNNER_TEMP is very convenient - but the inconsistency of the approach remains in my opinion)

Copy link
Contributor

@henrymercer henrymercer Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean composite Actions? In the case of this workflow the drawbacks jump out but I'm missing the improvements.

The improvements are most noticeable when using composite Actions, but I think there's a small benefit in standardisation having the repo checked out in the same place — it reduces cognitive load a tiny bit.

.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
.github/workflows/atm-check-queries-run.yml Outdated Show resolved Hide resolved
@jhelie jhelie force-pushed the jhelie/add-check-to-run-atm-queries branch 7 times, most recently from 33978c0 to 0d390c4 Compare Nov 1, 2022
gh extensions install github/gh-codeql
gh codeql download
Copy link
Contributor

@aeisenberg aeisenberg Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we are downloading codeql instead of using the version in the toolcache?

Copy link
Contributor

@aeisenberg aeisenberg Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it to ensure we are always running with the latest codeql version?

Copy link
Contributor Author

@jhelie jhelie Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

henrymercer
henrymercer previously approved these changes Nov 1, 2022
@jhelie jhelie force-pushed the jhelie/add-check-to-run-atm-queries branch from 0d390c4 to c20f41f Compare Nov 1, 2022
@jhelie
Copy link
Contributor Author

jhelie commented Nov 1, 2022

New POC run here

@jhelie jhelie force-pushed the jhelie/add-check-to-run-atm-queries branch from c20f41f to 3d1f752 Compare Nov 1, 2022
@jhelie
Copy link
Contributor Author

jhelie commented Nov 1, 2022

@henrymercer all requested changes are in and the new test run completed but I need a new since I had to rebase 😞

@jhelie jhelie merged commit 45320d9 into main Nov 2, 2022
4 checks passed
@jhelie jhelie deleted the jhelie/add-check-to-run-atm-queries branch Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants