Skip to content

Commit af367a5

Browse files
authored
Merge pull request #11348 from erik-krogh/cache-full-extractor
Ruby: cache the entire extractor
2 parents e28f1ff + 76ceb49 commit af367a5

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.github/workflows/ruby-build.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,23 @@ jobs:
8686
ruby/target/release/ruby-extractor.exe
8787
retention-days: 1
8888
compile-queries:
89-
runs-on: ubuntu-latest
90-
env:
91-
CODEQL_THREADS: 4 # TODO: remove this once it's set by the CLI
89+
runs-on: ubuntu-latest-xl
9290
steps:
9391
- uses: actions/checkout@v3
9492
- name: Fetch CodeQL
9593
uses: ./.github/actions/fetch-codeql
94+
- name: Cache compilation cache
95+
id: query-cache
96+
uses: ./.github/actions/cache-query-compilation
97+
with:
98+
key: ruby-build
9699
- name: Build Query Pack
97100
run: |
98101
codeql pack create ../shared/ssa --output target/packs
99102
codeql pack create ../misc/suite-helpers --output target/packs
100103
codeql pack create ../shared/regex --output target/packs
101104
codeql pack create ql/lib --output target/packs
102-
codeql pack create ql/src --output target/packs
105+
codeql pack create -j0 ql/src --output target/packs --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
103106
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
104107
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
105108
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)

.github/workflows/ruby-qltest.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: "Ruby: Run QL Tests"
22

33
on:
44
push:
5-
# no path requirement on branch pushes, so the cache is more effective.
5+
paths:
6+
- "ruby/**"
7+
- .github/workflows/ruby-build.yml
8+
- .github/actions/fetch-codeql/action.yml
9+
- codeql-workspace.yml
610
branches:
711
- main
812
- "rc/*"

ruby/actions/create-extractor-pack/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ description: Builds the Ruby CodeQL pack
33
runs:
44
using: composite
55
steps:
6-
- uses: actions/cache@v3
6+
- name: Cache entire extractor
7+
id: cache-extractor
8+
uses: actions/cache@v3
9+
with:
10+
path: ruby/extractor-pack
11+
key: ${{ runner.os }}-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}-${{ hashFiles('ruby/**/*.rs') }}-${{ hashFiles('ruby/codeql-extractor.yml', 'ruby/downgrades', 'ruby/tools', 'ruby/ql/lib/ruby.dbscheme', 'ruby/ql/lib/ruby.dbscheme.stats') }}
12+
- name: Cache cargo
13+
uses: actions/cache@v3
14+
if: steps.cache-extractor.outputs.cache-hit != 'true'
715
with:
816
path: |
917
~/.cargo/registry
1018
~/.cargo/git
1119
ruby/target
1220
key: ${{ runner.os }}-ruby-qltest-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
1321
- name: Build Extractor
22+
if: steps.cache-extractor.outputs.cache-hit != 'true'
1423
shell: bash
1524
run: scripts/create-extractor-pack.sh
1625
working-directory: ruby

0 commit comments

Comments
 (0)