Skip to content

Commit cddcea5

Browse files
committed
cache entire pack
1 parent e88d7d5 commit cddcea5

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

.github/workflows/ql-for-ql-build.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,37 @@ jobs:
2727
shell: bash
2828
env:
2929
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
30+
- name: Cache entire pack
31+
id: cache-pack
32+
uses: actions/cache@v3
33+
with:
34+
path: ${{ runner.temp }}/pack
35+
key: ${{ runner.os }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
3036
- name: Cache queries
37+
if: steps.cache-pack.outputs.cache-hit != 'true'
3138
id: cache-queries
3239
uses: actions/cache@v3
3340
with:
34-
path: ${{ runner.temp }}/pack
41+
path: ${{ runner.temp }}/queries
3542
key: queries-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
3643
- name: Build query pack
37-
if: steps.cache-queries.outputs.cache-hit != 'true'
44+
if: steps.cache-queries.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
3845
run: |
3946
cd ql/ql/src
4047
"${CODEQL}" pack create -j 16
41-
mv .codeql/pack/codeql/ql/0.0.0 ${{ runner.temp }}/pack
48+
mv .codeql/pack/codeql/ql/0.0.0 ${{ runner.temp }}/queries
49+
env:
50+
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
51+
- name: Move cache queries to pack
52+
if: steps.cache-pack.outputs.cache-hit != 'true'
53+
run: |
54+
cp -r ${{ runner.temp }}/queries ${{ runner.temp }}/pack
4255
env:
4356
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
4457

4558
### Build the extractor ###
4659
- name: Cache entire extractor
60+
if: steps.cache-pack.outputs.cache-hit != 'true'
4761
id: cache-extractor
4862
uses: actions/cache@v3
4963
with:
@@ -54,7 +68,7 @@ jobs:
5468
ql/target/release/ql-extractor.exe
5569
key: ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
5670
- name: Cache cargo
57-
if: steps.cache-extractor.outputs.cache-hit != 'true'
71+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
5872
uses: actions/cache@v3
5973
with:
6074
path: |
@@ -63,31 +77,33 @@ jobs:
6377
ql/target
6478
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
6579
- name: Check formatting
66-
if: steps.cache-extractor.outputs.cache-hit != 'true'
80+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
6781
run: cd ql; cargo fmt --all -- --check
6882
- name: Build
69-
if: steps.cache-extractor.outputs.cache-hit != 'true'
83+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7084
run: cd ql; cargo build --verbose
7185
- name: Run tests
72-
if: steps.cache-extractor.outputs.cache-hit != 'true'
86+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7387
run: cd ql; cargo test --verbose
7488
- name: Release build
75-
if: steps.cache-extractor.outputs.cache-hit != 'true'
89+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7690
run: cd ql; cargo build --release
7791
- name: Generate dbscheme
78-
if: steps.cache-extractor.outputs.cache-hit != 'true'
92+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7993
run: ql/target/release/ql-generator --dbscheme ql/ql/src/ql.dbscheme --library ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
8094

8195
### Package the queries and extractor ###
82-
- run: |
96+
- name: Package pack
97+
if: steps.cache-pack.outputs.cache-hit != 'true'
98+
run: |
8399
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats ${PACK}/
84100
mkdir -p ${PACK}/tools/linux64
85101
cp ql/target/release/ql-autobuilder ${PACK}/tools/linux64/autobuilder
86102
cp ql/target/release/ql-extractor ${PACK}/tools/linux64/extractor
87103
chmod +x ${PACK}/tools/linux64/autobuilder
88104
chmod +x ${PACK}/tools/linux64/extractor
89105
env:
90-
PACK: ${{ runner.temp }}/pack
106+
PACK: ${{ runner.temp }}/pack
91107

92108
### Run the analysis ###
93109
- name: Hack codeql-action options

0 commit comments

Comments
 (0)