@@ -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,12 +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]
120- tools : [~, latest]
172+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
121173 runs-on : ${{ matrix.os }}
122174
123175 steps :
@@ -146,12 +198,12 @@ jobs:
146198 TEST_MODE : true
147199
148200 go-custom-tracing :
149- needs : [check-js, check-node-modules]
201+ needs : [check-js, check-node-modules, check-codeql-versions ]
150202 strategy :
151203 fail-fast : false
152204 matrix :
153205 os : [ubuntu-latest, windows-latest, macos-latest]
154- tools : [~, latest]
206+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
155207 runs-on : ${{ matrix.os }}
156208 env :
157209 CODEQL_EXTRACTOR_GO_BUILD_TRACING : " on"
@@ -181,11 +233,11 @@ jobs:
181233 TEST_MODE : true
182234
183235 go-custom-tracing-autobuild :
184- needs : [check-js, check-node-modules]
236+ needs : [check-js, check-node-modules, check-codeql-versions ]
185237 strategy :
186238 fail-fast : false
187239 matrix :
188- tools : [~, latest]
240+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
189241 # No need to test Go autobuild on multiple OSes since
190242 # we're testing Go custom tracing with a manual build on all OSes.
191243 runs-on : ubuntu-latest
@@ -244,11 +296,11 @@ jobs:
244296 TEST_MODE : true
245297
246298 test-proxy :
247- needs : [check-js, check-node-modules]
299+ needs : [check-js, check-node-modules, check-codeql-versions ]
248300 strategy :
249301 fail-fast : false
250302 matrix :
251- tools : [~, latest]
303+ tools : ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
252304 runs-on : ubuntu-latest
253305 container :
254306 image : ubuntu:18.04
0 commit comments