Skip to content

Commit d53a59d

Browse files
committed
C++: add deptrace pr-checks
1 parent a291b7c commit d53a59d

File tree

6 files changed

+271
-0
lines changed

6 files changed

+271
-0
lines changed

.github/workflows/__cpp-deptrace-disabled.yml

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__cpp-deptrace-enabled.yml

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Cpp: disabling autoinstalling dependencies"
2+
description: "Checks that running C/C++ autobuild with autoinstalling dependencies explicitly disabled works"
3+
operatingSystems: ["ubuntu", "macos"]
4+
env:
5+
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
6+
steps:
7+
- name: Test setup
8+
shell: bash
9+
run: |
10+
cp -a ../action/tests/cpp-autobuild autobuild-dir
11+
- uses: ./../action/init
12+
with:
13+
languages: cpp
14+
tools: ${{ steps.prepare-test.outputs.tools-url }}
15+
- uses: ./../action/autobuild
16+
with:
17+
working-directory: autobuild-dir
18+
env:
19+
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
20+
- shell: bash
21+
run: |
22+
if ls /usr/bin/errno; then
23+
echo "Did autoinstall errno, and it should not have"
24+
exit 1
25+
fi
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Cpp: enabling autoinstalling dependencies"
2+
description: "Checks that running C/C++ autobuild with autoinstalling dependencies works"
3+
operatingSystems: ["ubuntu", "macos"]
4+
env:
5+
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
6+
steps:
7+
- name: Test setup
8+
shell: bash
9+
run: |
10+
cp -a ../action/tests/cpp-autobuild autobuild-dir
11+
- uses: ./../action/init
12+
with:
13+
languages: cpp
14+
tools: ${{ steps.prepare-test.outputs.tools-url }}
15+
- uses: ./../action/autobuild
16+
with:
17+
working-directory: autobuild-dir
18+
env:
19+
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
20+
- shell: bash
21+
run: |
22+
if ! ls /usr/bin/errno; then
23+
echo "Did not autoinstall errno"
24+
exit 1
25+
fi

tests/cpp-autobuild/src/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
errno || true # just a command to check its autoinstallation by deptrace
4+
5+
gcc -o main main.c

tests/cpp-autobuild/src/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "stdio.h"
2+
3+
int main(int argc, char **argv) {
4+
if (1) {
5+
printf("Hello, World!\n");
6+
}
7+
}
8+

0 commit comments

Comments
 (0)