@@ -80,13 +80,65 @@ jobs:
8080 exit 1
8181 fi
8282
83- multi-language-repo_test-custom-queries-and-remote-config :
83+ # Identify the CodeQL tool versions to integration test against.
84+ check-codeql-versions :
8485 needs : [check-js, check-node-modules]
86+ runs-on : ubuntu-latest
87+ outputs :
88+ versions : ${{ steps.compare.outputs.versions }}
89+
90+ steps :
91+ - uses : actions/checkout@v2
92+ - name : Move codeql-action
93+ shell : bash
94+ run : |
95+ mkdir ../action
96+ mv * .github ../action/
97+ mv ../action/tests/multi-language-repo/{*,.github} .
98+ mv ../action/.github/workflows .github
99+ - name : Init with default CodeQL bundle from the VM image
100+ id : init-default
101+ uses : ./../action/init
102+ with :
103+ languages : javascript
104+ - name : Remove empty database
105+ # allows us to run init a second time
106+ run : |
107+ rm -rf "$RUNNER_TEMP/codeql_databases"
108+ - name : Init with latest CodeQL bundle
109+ id : init-latest
110+ uses : ./../action/init
111+ with :
112+ tools : latest
113+ languages : javascript
114+ - name : Compare default and latest CodeQL bundle versions
115+ id : compare
116+ env :
117+ CODEQL_DEFAULT : ${{ steps.init-default.outputs.codeql-path }}
118+ CODEQL_LATEST : ${{ steps.init-latest.outputs.codeql-path }}
119+ run : |
120+ CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)"
121+ CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)"
122+ echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
123+ echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
124+ if [[ "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
125+ # Just use `tools: null` to avoid duplication in the integration tests.
126+ VERSIONS_JSON='[null]'
127+ else
128+ # Use both `tools: null` and `tools: latest` in the integration tests.
129+ VERSIONS_JSON='[null, "latest"]'
130+ fi
131+ # Output a JSON-encoded list with the distinct versions to test against.
132+ echo "Suggested matrix config for integration tests: $VERSIONS_JSON"
133+ echo "::set-output name=versions::${VERSIONS_JSON}"
134+
135+ multi-language-repo_test-custom-queries-and-remote-config :
136+ needs : [check-js, check-node-modules, check-codeql-versions]
85137 strategy :
86138 fail-fast : false
87139 matrix :
88140 os : [ubuntu-latest, windows-latest, macos-latest]
89- tools : [~, latest]
141+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
90142 runs-on : ${{ matrix.os }}
91143
92144 steps :
@@ -112,11 +164,12 @@ jobs:
112164
113165 # Currently is not possible to analyze Go in conjunction with other languages in macos
114166 multi-language-repo_test-go-custom-queries :
115- needs : [check-js, check-node-modules]
167+ needs : [check-js, check-node-modules, check-codeql-versions ]
116168 strategy :
117169 fail-fast : false
118170 matrix :
119171 os : [ubuntu-latest, windows-latest, macos-latest]
172+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
120173 runs-on : ${{ matrix.os }}
121174
122175 steps :
@@ -136,6 +189,7 @@ jobs:
136189 with :
137190 languages : go
138191 config-file : ./.github/codeql/custom-queries.yml
192+ tools : ${{ matrix.tools }}
139193 - name : Build code
140194 shell : bash
141195 run : ./build.sh
@@ -144,11 +198,12 @@ jobs:
144198 TEST_MODE : true
145199
146200 go-custom-tracing :
147- needs : [check-js, check-node-modules]
201+ needs : [check-js, check-node-modules, check-codeql-versions ]
148202 strategy :
149203 fail-fast : false
150204 matrix :
151205 os : [ubuntu-latest, windows-latest, macos-latest]
206+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
152207 runs-on : ${{ matrix.os }}
153208 env :
154209 CODEQL_EXTRACTOR_GO_BUILD_TRACING : " on"
@@ -169,6 +224,7 @@ jobs:
169224 - uses : ./../action/init
170225 with :
171226 languages : go
227+ tools : ${{ matrix.tools }}
172228 - name : Build code
173229 shell : bash
174230 run : go build main.go
@@ -177,7 +233,11 @@ jobs:
177233 TEST_MODE : true
178234
179235 go-custom-tracing-autobuild :
180- needs : [check-js, check-node-modules]
236+ needs : [check-js, check-node-modules, check-codeql-versions]
237+ strategy :
238+ fail-fast : false
239+ matrix :
240+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
181241 # No need to test Go autobuild on multiple OSes since
182242 # we're testing Go custom tracing with a manual build on all OSes.
183243 runs-on : ubuntu-latest
@@ -196,6 +256,7 @@ jobs:
196256 - uses : ./../action/init
197257 with :
198258 languages : go
259+ tools : ${{ matrix.tools }}
199260 - uses : ./../action/autobuild
200261 - uses : ./../action/analyze
201262 env :
@@ -235,7 +296,11 @@ jobs:
235296 TEST_MODE : true
236297
237298 test-proxy :
238- needs : [check-js, check-node-modules]
299+ needs : [check-js, check-node-modules, check-codeql-versions]
300+ strategy :
301+ fail-fast : false
302+ matrix :
303+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
239304 runs-on : ubuntu-latest
240305 container :
241306 image : ubuntu:18.04
@@ -259,6 +324,7 @@ jobs:
259324 - uses : ./../action/init
260325 with :
261326 languages : javascript
327+ tools : ${{ matrix.tools }}
262328 - uses : ./../action/analyze
263329 env :
264330 TEST_MODE : true
0 commit comments