-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Use compilation cache for the qltest CI workflow #11344
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
a13557f
to
b53327e
Compare
b53327e
to
4af8d57
Compare
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.
Looks plausible to me.
.github/workflows/ruby-qltest.yml
Outdated
- name: Run QL tests | ||
run: | | ||
codeql test run --threads=0 --ram 5000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test | ||
codeql test run --threads=0 --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" |
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.
AFAIK, it is still a good idea to set --ram
. I believe these machines have 56 GB or RAM, so setting to e.g. 52 GB should work.
BASE_BRANCH: ${{ github.base_ref }} | ||
run: | | ||
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ") | ||
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV |
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.
merge-base
is not a valid environment variable in bash
. You cant write ${merge-base}
in a script. I'd recommend using merge_base
or MERGE_BASE
.
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.
Is there a reason for using GITHUB_ENV
here instead of GITHUB_OUTPUT
?
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.
Is there a reason for using GITHUB_ENV here instead of GITHUB_OUTPUT ?
Nope, it was just the first data-sharing mechanism I found.
But now that I look at it, I still like it. I don't have to do ${{ steps.step-name.outputs.output-name }}
, but can just do ${{ env.merge_base }}
.
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.
merge-base is not a valid environment variable in bash. You cant write ${merge-base} in a script. I'd recommend using merge_base or MERGE_BASE.
It works with merge-base
🤷
I changed it anyway.
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.
Thanks! It's true that merge-base
works, however, things get annoying if you want to print the value in a bash script for debugging reasons. It's just to prevent our future selves from scratching our heads why ${merge-base} == "base"
;-)
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.
Perhaps move caching the extractor to a follow-up PR.
uses: actions/cache@v3 | ||
with: | ||
path: ruby/extractor-pack | ||
key: ${{ runner.os }}-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}-${{ hashFiles('ruby/**/*.rs') }} |
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 cache the entire extractor pack then we should also add the other files in the pack to the key.
c548abc
to
57a7f89
Compare
- name: Run QL tests | ||
run: | | ||
codeql test run --threads=0 --ram 5000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test | ||
codeql test run --threads=0 --ram 52000 --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" |
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.
@erik-krogh Did you mean to raise the --ram
argument to 52G 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.
Yes.
That change was based on this comment by Tom further up.
I didn't observe any difference from changing --ram
, so it seemed fine to me.
My first solution was just to delete the --ram
argument and let CodeQL figure it out for itself.
No description provided.