@@ -33,19 +33,73 @@ jobs:
3333 ~/.cargo/registry
3434 ~/.cargo/git
3535 ql/target
36- key : ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
36+ key : ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/ **/Cargo.lock') }}
3737 - name : Build extractor
3838 run : |
3939 cd ql;
4040 codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
4141 env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
42+ - name : Cache compilation cache
43+ id : query-cache
44+ uses : ./.github/actions/cache-query-compilation
45+ with :
46+ key : ql-for-ql-tests
4247 - name : Run QL tests
4348 run : |
44- "${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries ql/ql/test
49+ "${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test
4550 env :
4651 CODEQL : ${{ steps.find-codeql.outputs.codeql-path }}
47- - name : Check QL formatting
52+
53+ other-os :
54+ strategy :
55+ matrix :
56+ os : [macos-latest, windows-latest]
57+ needs : [qltest]
58+ runs-on : ${{ matrix.os }}
59+ steps :
60+ - uses : actions/checkout@v3
61+ - name : Install GNU tar
62+ if : runner.os == 'macOS'
63+ run : |
64+ brew install gnu-tar
65+ echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
66+ - name : Find codeql
67+ id : find-codeql
68+ uses : github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
69+ with :
70+ languages : javascript # does not matter
71+ - uses : ./.github/actions/os-version
72+ id : os_version
73+ - uses : actions/cache@v3
74+ with :
75+ path : |
76+ ~/.cargo/registry
77+ ~/.cargo/git
78+ ql/target
79+ key : ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
80+ - name : Build extractor
81+ if : runner.os != 'Windows'
82+ run : |
83+ cd ql;
84+ codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
85+ env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
86+ - name : Build extractor (Windows)
87+ if : runner.os == 'Windows'
88+ shell : pwsh
4889 run : |
49- find ql/ql/src "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only
90+ cd ql;
91+ $Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
92+ pwsh ./scripts/create-extractor-pack.ps1
93+ - name : Run a single QL tests - Unix
94+ if : runner.os != 'Windows'
95+ run : |
96+ "${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref
5097 env :
5198 CODEQL : ${{ steps.find-codeql.outputs.codeql-path }}
99+ - name : Run a single QL tests - Windows
100+ if : runner.os == 'Windows'
101+ shell : pwsh
102+ run : |
103+ $Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
104+ codeql test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref
105+
0 commit comments