Skip to content

Commit 0f6c464

Browse files
authored
Merge pull request #251 from github/aibaars/test
Add integration test
2 parents 4d6d6a4 + f26f8c1 commit 0f6c464

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)