Skip to content

Commit edb8265

Browse files
authored
Merge pull request #1964 from github/redsun82/cpp-deptrace-pr-checks
C++: add deptrace pr-checks
2 parents dbe5586 + f1b64d8 commit edb8265

File tree

8 files changed

+325
-0
lines changed

8 files changed

+325
-0
lines changed

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

Lines changed: 78 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-on-macos.yml

Lines changed: 76 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: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "C/C++: disabling autoinstalling dependencies (Linux)"
2+
description: "Checks that running C/C++ autobuild with autoinstalling dependencies explicitly disabled works"
3+
operatingSystems: ["ubuntu"]
4+
versions: ["latest", "default", "nightly-latest"] # This feature is not compatible with CLIs < 2.15.0
5+
env:
6+
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
7+
steps:
8+
- name: Test setup
9+
shell: bash
10+
run: |
11+
cp -a ../action/tests/cpp-autobuild autobuild-dir
12+
- uses: ./../action/init
13+
with:
14+
languages: cpp
15+
tools: ${{ steps.prepare-test.outputs.tools-url }}
16+
- uses: ./../action/autobuild
17+
with:
18+
working-directory: autobuild-dir
19+
env:
20+
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
21+
- shell: bash
22+
run: |
23+
if ls /usr/bin/errno; then
24+
echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled."
25+
exit 1
26+
fi
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "C/C++: autoinstalling dependencies is skipped (macOS)"
2+
description: "Checks that running C/C++ autobuild with autoinstalling dependencies explicitly enabled is a no-op on macOS"
3+
operatingSystems: ["macos"]
4+
versions: ["nightly-latest"] # This is not released yet, will come with 2.15.2
5+
env:
6+
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
7+
steps:
8+
- name: Test setup
9+
shell: bash
10+
run: |
11+
cp -a ../action/tests/cpp-autobuild autobuild-dir
12+
- uses: ./../action/init
13+
with:
14+
languages: cpp
15+
tools: ${{ steps.prepare-test.outputs.tools-url }}
16+
- uses: ./../action/autobuild
17+
with:
18+
working-directory: autobuild-dir
19+
env:
20+
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
21+
- shell: bash
22+
run: |
23+
if ! ls /usr/bin/errno; then
24+
echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS"
25+
else
26+
echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS"
27+
exit 1
28+
fi
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "C/C++: autoinstalling dependencies (Linux)"
2+
description: "Checks that running C/C++ autobuild with autoinstalling dependencies works"
3+
operatingSystems: ["ubuntu"]
4+
versions: ["latest", "default", "nightly-latest"] # This feature is not compatible with CLIs < 2.15.0
5+
env:
6+
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
7+
steps:
8+
- name: Test setup
9+
shell: bash
10+
run: |
11+
cp -a ../action/tests/cpp-autobuild autobuild-dir
12+
- uses: ./../action/init
13+
with:
14+
languages: cpp
15+
tools: ${{ steps.prepare-test.outputs.tools-url }}
16+
- uses: ./../action/autobuild
17+
with:
18+
working-directory: autobuild-dir
19+
env:
20+
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
21+
- shell: bash
22+
run: |
23+
if ! ls /usr/bin/errno; then
24+
echo "Did not autoinstall errno"
25+
exit 1
26+
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)