Skip to content

Commit f2d54b6

Browse files
authored
Merge pull request #100 from trailofbits/mschwager-codeql-ci
Recommend trailofbits/setup-codeql for testing queries in CI
2 parents c6aea96 + 2a25ab4 commit f2d54b6

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

content/docs/static-analysis/codeql/10-advanced.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -566,27 +566,21 @@ For more information about testing CodeQL queries, see the
566566

567567
### GitHub Actions
568568

569-
The following workflow can be used to test custom CodeQL queries in GitHub Actions:
569+
The [`trailofbits/setup-codeql`](https://github.com/trailofbits/setup-codeql) workflow can be used to test custom CodeQL queries in GitHub Actions:
570570

571571
```yml
572572
name: Test CodeQL queries
573573
574574
on: [push, pull_request]
575575
576576
jobs:
577-
codeql-test:
577+
test:
578578
runs-on: ubuntu-latest
579579
steps:
580-
- uses: actions/checkout@v4
581-
- id: init
582-
uses: github/codeql-action/init@v3
583-
- uses: actions/cache@v4
584-
with:
585-
path: ~/.codeql
586-
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.init.outputs.codeql-version }}
587-
- name: Run tests
588-
run: |
589-
${{ steps.init.outputs.codeql-path }} test run ./path/to/query/tests/
580+
- uses: actions/checkout@v6
581+
- uses: trailofbits/setup-codeql@main
582+
- run: codeql test run --threads=0 /path/to/query-tests
583+
- run: codeql query format --check-only /path/to/query.ql
590584
```
591585

592586
This workflow also speeds up subsequent runs by caching query extraction and

0 commit comments

Comments
 (0)