Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++: add deptrace pr-checks #1964

Merged
merged 7 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 78 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.

76 changes: 76 additions & 0 deletions .github/workflows/__cpp-deptrace-enabled-on-macos.yml

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

78 changes: 78 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.

26 changes: 26 additions & 0 deletions pr-checks/checks/cpp-deptrace-disabled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Cpp: disabling autoinstalling dependencies"
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
description: "Checks that running C/C++ autobuild with autoinstalling dependencies explicitly disabled works"
operatingSystems: ["ubuntu"]
versions: ["latest", "default", "nightly-latest"] # This feature is not compatible with old CLIs
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
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"
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi
28 changes: 28 additions & 0 deletions pr-checks/checks/cpp-deptrace-enabled-on-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Cpp: disabling autoinstalling dependencies"
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
description: "Checks that running C/C++ autobuild with autoinstalling dependencies explicitly disabled works"
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
operatingSystems: ["macos"]
versions: ["nightly-latest"] # This is not released yet, will come with 2.15.2
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 "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS"
else
echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS"
exit 1
fi
26 changes: 26 additions & 0 deletions pr-checks/checks/cpp-deptrace-enabled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Cpp: enabling autoinstalling dependencies"
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
description: "Checks that running C/C++ autobuild with autoinstalling dependencies works"
operatingSystems: ["ubuntu"]
versions: ["latest", "default", "nightly-latest"] # This feature is not compatible with old CLIs
redsun82 marked this conversation as resolved.
Show resolved Hide resolved
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");
}
}