@@ -27,23 +27,37 @@ jobs:
27
27
shell : bash
28
28
env :
29
29
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') }}
30
36
- name : Cache queries
37
+ if : steps.cache-pack.outputs.cache-hit != 'true'
31
38
id : cache-queries
32
39
uses : actions/cache@v3
33
40
with :
34
- path : ${{ runner.temp }}/pack
41
+ path : ${{ runner.temp }}/queries
35
42
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') }}
36
43
- 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'
38
45
run : |
39
46
cd ql/ql/src
40
47
"${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
42
55
env :
43
56
CODEQL : ${{ steps.find-codeql.outputs.codeql-path }}
44
57
45
58
# ## Build the extractor ###
46
59
- name : Cache entire extractor
60
+ if : steps.cache-pack.outputs.cache-hit != 'true'
47
61
id : cache-extractor
48
62
uses : actions/cache@v3
49
63
with :
54
68
ql/target/release/ql-extractor.exe
55
69
key : ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
56
70
- 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'
58
72
uses : actions/cache@v3
59
73
with :
60
74
path : |
@@ -63,31 +77,33 @@ jobs:
63
77
ql/target
64
78
key : ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
65
79
- 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'
67
81
run : cd ql; cargo fmt --all -- --check
68
82
- 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'
70
84
run : cd ql; cargo build --verbose
71
85
- 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'
73
87
run : cd ql; cargo test --verbose
74
88
- 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'
76
90
run : cd ql; cargo build --release
77
91
- 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'
79
93
run : ql/target/release/ql-generator --dbscheme ql/ql/src/ql.dbscheme --library ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
80
94
81
95
# ## Package the queries and extractor ###
82
- - run : |
96
+ - name : Package pack
97
+ if : steps.cache-pack.outputs.cache-hit != 'true'
98
+ run : |
83
99
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats ${PACK}/
84
100
mkdir -p ${PACK}/tools/linux64
85
101
cp ql/target/release/ql-autobuilder ${PACK}/tools/linux64/autobuilder
86
102
cp ql/target/release/ql-extractor ${PACK}/tools/linux64/extractor
87
103
chmod +x ${PACK}/tools/linux64/autobuilder
88
104
chmod +x ${PACK}/tools/linux64/extractor
89
105
env :
90
- PACK: ${{ runner.temp }}/pack
106
+ PACK : ${{ runner.temp }}/pack
91
107
92
108
# ## Run the analysis ###
93
109
- name : Hack codeql-action options
0 commit comments