@@ -167,3 +167,63 @@ jobs:
167167 codeql-ruby-bundle.zip
168168 env :
169169 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
170+ test :
171+ strategy :
172+ fail-fast : false
173+ matrix :
174+ os : [ubuntu-latest, macos-latest, windows-latest]
175+
176+ runs-on : ${{ matrix.os }}
177+ needs : [package]
178+ steps :
179+ - uses : actions/checkout@v2
180+ with :
181+ repository : Shopify/example-ruby-app
182+ ref : 67a0decc5eb550f3a9228eda53925c3afd40dfe9
183+ - name : Fetch CodeQL
184+ shell : bash
185+ run : |
186+ LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -1)
187+ gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql.zip "$LATEST"
188+ unzip -q codeql.zip
189+ env :
190+ GITHUB_TOKEN : ${{ github.token }}
191+ working-directory : ${{ runner.temp }}
192+ - name : Download Ruby bundle
193+ uses : actions/download-artifact@v2
194+ with :
195+ name : codeql-ruby-bundle
196+ path : ${{ runner.temp }}
197+ - name : Unzip Ruby bundle
198+ shell : bash
199+ run : unzip -q -d "${{ runner.temp }}/ruby-bundle" "${{ runner.temp }}/codeql-ruby-bundle.zip"
200+ - name : Prepare test files
201+ shell : bash
202+ run : |
203+ echo "import ruby select count(File f)" > "test.ql"
204+ echo "| 2 |" > "test.expected"
205+ echo 'name: sample-tests
206+ version: 0.0.0
207+ libraryPathDependencies:
208+ - codeql-ruby
209+ extractor: ruby
210+ tests: .
211+ ' > qlpack.yml
212+ echo '- qlpack: codeql-ruby
213+ - include:
214+ kind:
215+ - problem
216+ - path-problem
217+ ' > suite.qls
218+ - name : Run QL test
219+ shell : bash
220+ run : |
221+ "${{ runner.temp }}/codeql/codeql" test run --search-path "${{ runner.temp }}/ruby-bundle" .
222+ - name : Create database
223+ shell : bash
224+ run : |
225+ "${{ runner.temp }}/codeql/codeql" database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root . ../database
226+ - name : Analyze database
227+ shell : bash
228+ run : |
229+ "${{ runner.temp }}/codeql/codeql" database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database suite.qls
0 commit comments