1212
1313jobs :
1414
15+ build_query_pack :
16+ runs-on : ubuntu-latest-xl
17+ steps :
18+ - uses : actions/checkout@v2
19+ - name : Find codeql
20+ id : find-codeql
21+ uses : github/codeql-action/init@esbena/ql
22+ with :
23+ languages : javascript # does not matter
24+ - name : Build query pack
25+ run : |
26+ cd ql/src
27+ "${CODEQL}" pack create
28+ cd .codeql/pack/codeql/ql-all/0.0.0
29+ zip "${PACKZIP}" -r .
30+ env :
31+ CODEQL : ${{ steps.find-codeql.outputs.codeql-path }}
32+ PACKZIP : ${{ runner.temp }}/query-pack.zip
33+ - name : Upload query pack
34+ uses : actions/upload-artifact@v2
35+ with :
36+ name : query-pack
37+ path : ${{ runner.temp }}/query-pack.zip
38+
1539 # XXX this is mostly an inlined copy of the 'build' job in build.yml
1640 build_extractor_pack :
1741 strategy :
@@ -79,71 +103,67 @@ jobs:
79103
80104 analyze :
81105 name : Analyze
82- needs : build_extractor_pack
106+ needs :
107+ - build_query_pack
108+ - build_extractor_pack
83109
84- runs-on : ubuntu-latest
110+ runs-on : ubuntu-latest-xl
85111
86112 permissions :
87113 actions : read
88114 contents : read
89115 security-events : write
90116
91117 steps :
92- - name : Download pack
118+ - name : Download query pack
119+ uses : actions/download-artifact@v2
120+ with :
121+ name : query-pack
122+ path : ${{ runner.temp }}/query-pack-artifact
123+
124+ - name : Download extractor pack
93125 uses : actions/download-artifact@v2
94126 with :
95127 name : extractor-pack
96128 path : ${{ runner.temp }}/extractor-pack-artifact
97129
98- - name : Unzip pack
130+ - name : Prepare packs
131+ id : prepare-packs
99132 run : |
100133 set -x
101- mkdir "${PACKTMP}"
102- cd "${PACKTMP}"
103- unzip "${PACKARTIFACT}/*.zip" -d unzipped
104- cp -r unzipped/ql "${PACK}"
134+ mkdir -p "${COMPLETE_PACK}" "${PACKS_TMP}"
135+ cd "${PACKS_TMP}"
136+ unzip "${QUERY_PACK_ARTIFACT}/*.zip" -d query-pack-artifact-unzipped
137+ cp -r query-pack-artifact-unzipped/. "${COMPLETE_PACK}"
138+ unzip "${EXTRACTOR_PACK_ARTIFACT}/*.zip" -d extractor-pack-artifact-unzipped
139+ cp -r extractor-pack-artifact-unzipped/ql/. "${COMPLETE_PACK}"
140+ cd "${COMPLETE_PACK}"
141+ zip "${COMPLETE_PACK_ZIP}" -r .
105142 env :
106- PACKTMP : ${{ runner.temp }}/extractor-pack-artifact.tmp
107- PACKARTIFACT : ${{ runner.temp }}/extractor-pack-artifact
108- PACK : ${{ runner.temp }}/extractor-pack
109-
110- - name : Checkout repository
111- uses : actions/checkout@v2
112-
113- - name : Make config file
114- run : |
115- set -x
116- echo "name: CodeQL config for QL" >> "${CONFIG_FILE}"
117- echo "" >> "${CONFIG_FILE}"
118- echo "disable-default-queries: true" >> "${CONFIG_FILE}"
119- echo "" >> "${CONFIG_FILE}"
120- echo "queries: " >> "${CONFIG_FILE}"
121- echo " - name: Standard queries" >> "${CONFIG_FILE}"
122- echo " uses: ${SUITE}" >> "${CONFIG_FILE}"
123- cat "${CONFIG_FILE}"
124- env :
125- SUITE : ./ql/src/codeql-suites/ql-code-scanning.qls
126- CONFIG_FILE : ./.custom-codeql-actions-config.yml
143+ PACKS_TMP : ${{ runner.temp }}/pack-artifacts.tmp
144+ QUERY_PACK_ARTIFACT : ${{ runner.temp }}/query-pack-artifact
145+ EXTRACTOR_PACK_ARTIFACT : ${{ runner.temp }}/extractor-pack-artifact
146+ COMPLETE_PACK : ${{ runner.temp }}/pack
147+ COMPLETE_PACK_ZIP : ${{ runner.temp }}/pack.zip
127148
128149 - name : Hack codeql-action options
129150 run : |
130- JSON=$(jq -nc --arg pack "${PACK }" '.resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
151+ JSON=$(jq -nc --arg pack "${COMPLETE_PACK }" '.resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
131152 echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV}
132153 env :
133- PACK : ${{ runner.temp }}/extractor-pack
154+ COMPLETE_PACK : ${{ runner.temp }}/pack
155+
156+ - name : Checkout repository
157+ uses : actions/checkout@v2
134158
135159 - name : Initialize CodeQL
136160 uses : github/codeql-action/init@esbena/ql
137161 with :
138162 languages : ql
139163 db-location : ${{ runner.temp }}/db
140- config-file : ./.custom-codeql-actions-config.yml
141164
142165 - name : Perform CodeQL Analysis
143166 uses : github/codeql-action/analyze@esbena/ql
144- with :
145- results : ${{ runner.temp }}/results
146- add-snippets : true
147167
148168 - name : Upload db
149169 uses : actions/upload-artifact@v2
@@ -152,9 +172,9 @@ jobs:
152172 path : ${{ runner.temp }}/db
153173 retention-days : 1
154174
155- - name : Upload results
175+ - name : Upload complete pack
156176 uses : actions/upload-artifact@v2
157177 with :
158- name : results
159- path : ${{ runner.temp }}/results
178+ name : complete-pack
179+ path : ${{ runner.temp }}/pack.zip
160180 retention-days : 1
0 commit comments