-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (68 loc) · 3.06 KB
/
query-unit-tests.yml
File metadata and controls
80 lines (68 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Query Unit Tests - CodeQL Development MCP Server
on:
pull_request:
branches: ['main', 'next']
paths:
- '.codeql-version'
- '.gitmodules'
- '.github/actions/setup-codeql-environment/**'
- '.github/workflows/query-unit-tests.yml'
- '.node-version'
- 'codeql-pack.yml'
- 'codeql-pack.lock.yml'
- 'qlpack.yml'
- 'server/ql/**'
- 'server/scripts/install-packs.sh'
- 'server/scripts/run-query-unit-tests.sh'
push:
branches: ['main', 'next']
paths:
- '.codeql-version'
- '.gitmodules'
- '.github/actions/setup-codeql-environment/**'
- '.github/workflows/query-unit-tests.yml'
- '.node-version'
- 'codeql-pack.yml'
- 'codeql-pack.lock.yml'
- 'qlpack.yml'
- 'server/ql/**'
- 'server/scripts/install-packs.sh'
- 'server/scripts/run-query-unit-tests.sh'
permissions:
contents: read
jobs:
query-unit-tests:
name: Query Unit Tests - ${{ matrix.language }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ['actions', 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'rust']
steps:
- name: Query Unit Tests - ${{ matrix.language }} - Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Query Unit Tests - ${{ matrix.language }} - Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
cache: 'npm'
node-version-file: '.node-version'
- name: Query Unit Tests - ${{ matrix.language }} - Install OS dependencies
run: sudo apt-get install -y jq
- name: Query Unit Tests - ${{ matrix.language }} - Install node dependencies for all workspaces
run: npm ci --workspaces --ignore-scripts
- name: Query Unit Tests - ${{ matrix.language }} - Setup CodeQL environment
uses: ./.github/actions/setup-codeql-environment
with:
install-language-runtimes: true
## Install packs used in the unit tests that we're about to run.
- name: Query Unit Tests - ${{ matrix.language }} - Install CodeQL packs used in unit tests
run: ./server/scripts/install-packs.sh --language ${{ matrix.language }}
## Ensure the `codeql` CLI is installed and PATH env is setup before running
## the unit test script, which requires the `codeql` CLI to be accessible via user PATH env.
- name: Query Unit Tests - ${{ matrix.language }} - Run unit tests for `server/ql/${{ matrix.language }}/tools/test/**` directories
run: ./server/scripts/run-query-unit-tests.sh --language ${{ matrix.language }}
- name: Query Unit Tests - ${{ matrix.language }} - Summary
run: |
echo "## Query Unit Tests Summary - ${{ matrix.language }}" >> $GITHUB_STEP_SUMMARY
echo "✅ CodeQL query unit tests completed successfully for ${{ matrix.language }}" >> $GITHUB_STEP_SUMMARY
echo "✅ All PrintAST and tool queries validated for ${{ matrix.language }}" >> $GITHUB_STEP_SUMMARY