Skip to content

Commit dcd959b

Browse files
authored
fix(ci): re-enable CodeQL for C++ COMPASS-7540 (#55)
1 parent 6c33033 commit dcd959b

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

.github/workflows/codeql.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ jobs:
3636
matrix:
3737
language:
3838
- 'javascript'
39-
# TODO: https://jira.mongodb.org/browse/COMPASS-7540, enable the cpp analysis.
40-
# - 'cpp'
39+
- 'cpp'
4140

4241
steps:
4342
- name: Checkout repository
@@ -78,7 +77,7 @@ jobs:
7877
- name: Build cpp
7978
if: matrix.language == 'cpp'
8079
run: |
81-
node bin/boxednode.js -s test/resources/example.js -t example
80+
./test/compile-main-template-only.sh
8281
8382
- name: Perform CodeQL Analysis
8483
uses: github/codeql-action/analyze@v2

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ tmp/
2222
.esm-wrapper.mjs
2323
/lib/
2424
package-lock.json
25+
main-template-build

resources/main-template.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using namespace v8;
3535
#endif
3636

3737
// Snapshot config is supported since https://github.com/nodejs/node/pull/50453
38-
#if NODE_VERSION_AT_LEAST(21, 6, 0) && !defined(BOXEDNODE_SNAPSHOT_CONFIG_FLAGS)
38+
#if NODE_VERSION_AT_LEAST(20, 12, 0) && !defined(BOXEDNODE_SNAPSHOT_CONFIG_FLAGS)
3939
#define BOXEDNODE_SNAPSHOT_CONFIG_FLAGS (SnapshotFlags::kWithoutCodeCache)
4040
#endif
4141

test/compile-main-template-only.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# script to only build the code in resources/
4+
# for CodeQL testing
5+
6+
set -e
7+
set -x
8+
cd "$(dirname $0)/.."
9+
if [ ! -e main-template-build ]; then
10+
mkdir main-template-build
11+
pushd main-template-build
12+
curl -O https://nodejs.org/dist/v20.12.0/node-v20.12.0.tar.xz
13+
tar --strip-components=1 -xf node-*.tar.xz
14+
popd
15+
fi
16+
17+
g++ \
18+
-Imain-template-build/src \
19+
-Imain-template-build/deps/v8/include \
20+
-Imain-template-build/deps/uv/include \
21+
-DREPLACE_DECLARE_LINKED_MODULES= \
22+
-DREPLACE_DEFINE_LINKED_MODULES= \
23+
-DREPLACE_WITH_ENTRY_POINT='"placeholder"' \
24+
-DBOXEDNODE_CODE_CACHE_MODE='"placeholder"' \
25+
-DREPLACE_WITH_MAIN_SCRIPT_SOURCE_GETTER= \
26+
-fPIC -shared \
27+
-o main-template-build/out.so \
28+
-include resources/add-node_api.h \
29+
-include resources/add-node.h \
30+
resources/main-template.cc

0 commit comments

Comments
 (0)