Skip to content

Commit e88d7d5

Browse files
committed
simplify QL-for-QL action
1 parent 0ac8b7c commit e88d7d5

File tree

2 files changed

+12
-59
lines changed

2 files changed

+12
-59
lines changed

.github/labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ documentation:
4242

4343
"QL-for-QL":
4444
- ql/**/*
45+
- .github/workflows/ql-for-ql*

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

Lines changed: 11 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,17 @@ jobs:
3131
id: cache-queries
3232
uses: actions/cache@v3
3333
with:
34-
path: ${{ runner.temp }}/query-pack.zip
34+
path: ${{ runner.temp }}/pack
3535
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') }}
3636
- name: Build query pack
3737
if: steps.cache-queries.outputs.cache-hit != 'true'
3838
run: |
3939
cd ql/ql/src
4040
"${CODEQL}" pack create -j 16
41-
cd .codeql/pack/codeql/ql/0.0.0
42-
zip "${PACKZIP}" -r .
43-
rm -rf *
41+
mv .codeql/pack/codeql/ql/0.0.0 ${{ runner.temp }}/pack
4442
env:
4543
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
46-
PACKZIP: ${{ runner.temp }}/query-pack.zip
47-
- name: Upload query pack
48-
uses: actions/upload-artifact@v3
49-
with:
50-
name: query-pack-zip
51-
path: ${{ runner.temp }}/query-pack.zip
52-
44+
5345
### Build the extractor ###
5446
- name: Cache entire extractor
5547
id: cache-extractor
@@ -85,59 +77,19 @@ jobs:
8577
- name: Generate dbscheme
8678
if: steps.cache-extractor.outputs.cache-hit != 'true'
8779
run: ql/target/release/ql-generator --dbscheme ql/ql/src/ql.dbscheme --library ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
88-
- uses: actions/upload-artifact@v3
89-
with:
90-
name: extractor-ubuntu-latest
91-
path: |
92-
ql/target/release/ql-autobuilder
93-
ql/target/release/ql-autobuilder.exe
94-
ql/target/release/ql-extractor
95-
ql/target/release/ql-extractor.exe
96-
retention-days: 1
9780

9881
### Package the queries and extractor ###
99-
- uses: actions/download-artifact@v3
100-
with:
101-
name: query-pack-zip
102-
path: query-pack-zip
103-
- uses: actions/download-artifact@v3
104-
with:
105-
name: extractor-ubuntu-latest
106-
path: linux64
10782
- run: |
108-
unzip query-pack-zip/*.zip -d pack
109-
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats pack/
110-
mkdir -p pack/tools/linux64
111-
if [[ -f linux64/ql-autobuilder ]]; then
112-
cp linux64/ql-autobuilder pack/tools/linux64/autobuilder
113-
chmod +x pack/tools/linux64/autobuilder
114-
fi
115-
if [[ -f linux64/ql-extractor ]]; then
116-
cp linux64/ql-extractor pack/tools/linux64/extractor
117-
chmod +x pack/tools/linux64/extractor
118-
fi
119-
cd pack
120-
zip -rq ../codeql-ql.zip .
121-
rm -rf *
122-
- uses: actions/upload-artifact@v3
123-
with:
124-
name: codeql-ql-pack
125-
path: codeql-ql.zip
126-
retention-days: 1
83+
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats ${PACK}/
84+
mkdir -p ${PACK}/tools/linux64
85+
cp ql/target/release/ql-autobuilder ${PACK}/tools/linux64/autobuilder
86+
cp ql/target/release/ql-extractor ${PACK}/tools/linux64/extractor
87+
chmod +x ${PACK}/tools/linux64/autobuilder
88+
chmod +x ${PACK}/tools/linux64/extractor
89+
env:
90+
PACK: ${{ runner.temp }}/pack
12791
12892
### Run the analysis ###
129-
- name: Download pack
130-
uses: actions/download-artifact@v3
131-
with:
132-
name: codeql-ql-pack
133-
path: ${{ runner.temp }}/codeql-ql-pack-artifact
134-
135-
- name: Prepare pack
136-
run: |
137-
unzip "${PACK_ARTIFACT}/*.zip" -d "${PACK}"
138-
env:
139-
PACK_ARTIFACT: ${{ runner.temp }}/codeql-ql-pack-artifact
140-
PACK: ${{ runner.temp }}/pack
14193
- name: Hack codeql-action options
14294
run: |
14395
JSON=$(jq -nc --arg pack "${PACK}" '.database."run-queries"=["--search-path", $pack] | .resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')

0 commit comments

Comments
 (0)