Skip to content

Commit

Permalink
C++: add deptrace pr-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
redsun82 committed Oct 23, 2023
1 parent a291b7c commit 9c3ff35
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/__cpp-deptrace-disabled.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions .github/workflows/__cpp-deptrace-enabled.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions pr-checks/checks/cpp-deptrace-disabled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Cpp: disabling autoinstalling dependencies"
description: "Checks that running C/C++ autobuild with autoinstalling dependencies explicitly disabled works"
operatingSystems: ["ubuntu", "macos"]
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps:
- name: Test setup
shell: bash
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init
with:
languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
- shell: bash
run: |
if [[ ls /usr/bin/errno ]]; then
echo "Did autoinstall errno, and it should not have"
exit 1
fi
25 changes: 25 additions & 0 deletions pr-checks/checks/cpp-deptrace-enabled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Cpp: enabling autoinstalling dependencies"
description: "Checks that running C/C++ autobuild with autoinstalling dependencies works"
operatingSystems: ["ubuntu", "macos"]
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps:
- name: Test setup
shell: bash
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init
with:
languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- shell: bash
run: |
if [[ ! ls /usr/bin/errno ]]; then
echo "Did not autoinstall errno"
exit 1
fi
5 changes: 5 additions & 0 deletions tests/cpp-autobuild/src/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

errno || true # just a command to check its autoinstallation by deptrace

gcc -o main main.c
8 changes: 8 additions & 0 deletions tests/cpp-autobuild/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "stdio.h"

int main(int argc, char **argv) {
if (1) {
printf("Hello, World!\n");
}
}

0 comments on commit 9c3ff35

Please sign in to comment.