Skip to content

Commit 2b996f1

Browse files
committed
use query compilation cache
1 parent 1e732ad commit 2b996f1

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

.github/workflows/go-tests.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
name: "Go: Run Tests"
22
on:
3+
push:
4+
paths:
5+
- "go/**"
6+
- .github/workflows/go-tests.yml
7+
- .github/actions/fetch-codeql/action.yml
8+
- .github/actions/cache-query-compilation/action.yml
9+
- codeql-workspace.yml
10+
branches:
11+
- main
12+
- "rc/*"
313
pull_request:
414
paths:
515
- "go/**"
616
- .github/workflows/go-tests.yml
717
- .github/actions/fetch-codeql/action.yml
18+
- .github/actions/cache-query-compilation/action.yml
819
- codeql-workspace.yml
920
jobs:
1021
test-linux:
@@ -48,14 +59,21 @@ jobs:
4859
name: qhelp-markdown
4960
path: go/qhelp-out/**/*.md
5061

62+
- name: Cache compilation cache
63+
id: query-cache
64+
uses: ./.github/actions/cache-query-compilation
65+
with:
66+
key: go-qltest
67+
5168
- name: Test
5269
run: |
5370
cd go
54-
make test
71+
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
5572
5673
test-mac:
5774
name: Test MacOS
5875
runs-on: macos-latest-xl
76+
if: ${{ github.event_name == 'pull_request' }}
5977
steps:
6078
- name: Set up Go 1.19
6179
uses: actions/setup-go@v3
@@ -78,14 +96,20 @@ jobs:
7896
cd go
7997
make
8098
99+
- name: Cache compilation cache
100+
id: query-cache
101+
uses: ./.github/actions/cache-query-compilation
102+
with:
103+
key: go-qltest
81104
- name: Test
82105
run: |
83106
cd go
84-
make test
107+
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
85108
86109
test-win:
87110
name: Test Windows
88111
runs-on: windows-latest-xl
112+
if: ${{ github.event_name == 'pull_request' }}
89113
steps:
90114
- name: Set up Go 1.19
91115
uses: actions/setup-go@v3
@@ -108,7 +132,13 @@ jobs:
108132
cd go
109133
make
110134
135+
- name: Cache compilation cache
136+
id: query-cache
137+
uses: ./.github/actions/cache-query-compilation
138+
with:
139+
key: go-qltest
140+
111141
- name: Test
112142
run: |
113143
cd go
114-
make test
144+
make test cache="${{ steps.query-cache.outputs.cache-dir }}"

go/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ ql/lib/go.dbscheme.stats: ql/lib/go.dbscheme build/stats/src.stamp extractor
116116
codeql dataset measure -o $@ build/stats/database/db-go
117117

118118
test: all build/testdb/check-upgrade-path
119-
codeql test run -j0 ql/test --search-path build/codeql-extractor-go --consistency-queries ql/test/consistency
119+
codeql test run -j0 ql/test --search-path build/codeql-extractor-go --consistency-queries ql/test/consistency --compilation-cache=$(cache)
120120
# use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported
121-
env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path build/codeql-extractor-go --consistency-queries ql/test/consistency
121+
env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path build/codeql-extractor-go --consistency-queries ql/test/consistency --compilation-cache=$(cache)
122122
cd extractor; go test -mod=vendor ./... | grep -vF "[no test files]"
123123
bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1)
124124

0 commit comments

Comments
 (0)