Skip to content

Commit e777934

Browse files
authored
Merge pull request github#11316 from erik-krogh/examplesComp
CI: Also compile the `examples` folder
2 parents e83cc59 + 7c091fa commit e777934

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.github/workflows/compile-queries.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
if: ${{ github.event_name == 'pull_request' }}
2727
uses: actions/cache@v3
2828
with:
29-
path: '*/ql/src/.cache'
29+
path: '**/.cache'
3030
key: codeql-compile-pr-${{ github.sha }} # deliberately not using the `compile-compile-main` keys here.
3131
restore-keys: |
3232
codeql-compile-${{ github.base_ref }}-${{ env.merge-base }}
@@ -36,7 +36,7 @@ jobs:
3636
if: ${{ github.event_name != 'pull_request' }}
3737
uses: actions/cache@v3
3838
with:
39-
path: '*/ql/src/.cache'
39+
path: '**/.cache'
4040
key: codeql-compile-${{ github.ref_name }}-${{ github.sha }} # just fill on main
4141
restore-keys: | # restore from another random commit, to speed up compilation.
4242
codeql-compile-${{ github.ref_name }}-
@@ -51,21 +51,21 @@ jobs:
5151
# run with --check-only if running in a PR (github.sha != main)
5252
if : ${{ github.event_name == 'pull_request' }}
5353
shell: bash
54-
run: codeql query compile -j0 */ql/src --keep-going --warnings=error --check-only
54+
run: codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --check-only
5555
- name: compile queries - full
5656
# do full compile if running on main - this populates the cache
5757
if : ${{ github.event_name != 'pull_request' }}
5858
shell: bash
5959
run: |
6060
# Move all the existing cache into another folder, so we only preserve the cache for the current queries.
6161
mkdir -p ${COMBINED_CACHE_DIR}
62-
rm */ql/src/.cache/{lock,size}
62+
rm -f */ql/{src,examples}/.cache/{lock,size} # -f to avoid errors if the cache is empty.
6363
# copy the contents of the .cache folders into the combined cache folder.
64-
cp -r */ql/src/.cache/* ${COMBINED_CACHE_DIR}/
64+
cp -r */ql/{src,examples}/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
6565
# clean up the .cache folders
66-
rm -rf */ql/src/.cache/*
66+
rm -rf */ql/{src,examples}/.cache/*
6767
6868
# compile the queries
69-
codeql query compile -j0 */ql/src --keep-going --warnings=error --compilation-cache ${COMBINED_CACHE_DIR}
69+
codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache ${COMBINED_CACHE_DIR}
7070
env:
7171
COMBINED_CACHE_DIR: ${{ github.workspace }}/compilation-dir

go/ql/examples/snippets/incompleteswitchoverenum.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @name Incomplete switch over enum
33
* @description A switch statement of enum type should explicitly reference each
44
* of the members of that enum.
5+
* @severity warning
56
* @kind problem
67
* @id go/examples/incomplete-switch
78
*/

0 commit comments

Comments
 (0)