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++ API #19

Merged
merged 21 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 6 additions & 24 deletions .github/workflows/codeql_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,8 @@ on:
push:
branches: ["main"]
paths:
- .github/workflows/codeql_c.yml
- bindings/c/cmocka/**
- bindings/c/corrosion/**
- bindings/c/include/**
- bindings/c/src/**
- bindings/c/tests/**
- bindings/c/build.rs
- bindings/c/Cargo.toml
- bindings/c/Cargo.lock
- bindings/c/cbindgen.toml
- bindings/c/CMakeLists.txt
- .github/workflows/*_c.yml
- bindings/c/**
- src/**
- Cargo.lock
- Cargo.toml
Expand All @@ -35,18 +26,9 @@ on:
# The branches below must be a subset of the branches above
branches: ["main"]
paths:
- .github/workflows/codeql_c.yml
- bindings/c/cmocka/**
- bindings/c/corrosion/**
- bindings/c/include/**
- bindings/c/src/**
- bindings/c/tests/**
- bindings/c/build.rs
- bindings/c/Cargo.toml
- bindings/c/Cargo.lock
- bindings/c/cbindgen.toml
- bindings/c/CMakeLists.txt
- src/*
- .github/workflows/*_c.yml
- bindings/c/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
Expand Down Expand Up @@ -87,7 +69,7 @@ jobs:
working-directory: bindings/c/build
run: |
# Make cmocka a static dependency when testing.
cmake ../ -DBUILD_SHARED_LIBS=OFF
cmake ../ -DBUILD_SHARED_LIBS=OFF -DBUILD_CCHECKS_TESTS=ON
- name: CMake Build
working-directory: bindings/c/build
run: |
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/codeql_cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: ["main"]
paths:
- .github/workflows/*_cpp.yml
- bindings/cpp/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
paths:
- .github/workflows/*_cpp.yml
- bindings/cpp/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
schedule:
- cron: "0 0 * * 1"

jobs:
analyze_cpp:
name: Analyze C++
defaults:
run:
working-directory: bindings/cpp
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp

# Build C++ Project
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Make Build Directory
run: mkdir -p build
- name: CMake Configure
working-directory: bindings/cpp/build
run: |
# Make cmocka a static dependency when testing.
cmake ../ -DBUILD_SHARED_LIBS=OFF -DBUILD_CPPCHECKS_TESTS=ON
- name: CMake Build
working-directory: bindings/cpp/build
run: |
cmake --build . --config=Debug

# Run the analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:cpp"
24 changes: 14 additions & 10 deletions .github/workflows/codeql_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ on:
push:
branches: ["main"]
paths:
- .github/workflows/codeql_python.yml
- bindings/python/pychecks/**
- bindings/python/tests/**
- bindings/python/conftest.py
- bindings/python/pyproject.toml
- .github/workflows/*_python.yml
- bindings/python/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
paths:
- .github/workflows/codeql_python.yml
- bindings/python/pychecks/**
- bindings/python/tests/**
- bindings/python/conftest.py
- bindings/python/pyproject.toml
- .github/workflows/*_python.yml
- bindings/python/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
schedule:
- cron: "0 0 * * 1"

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/rust-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: EmbarkStudios/cargo-deny-action@v1
audit_cpp:
name: Audit C++
runs-on: ubuntu-latest
defaults:
run:
working-directory: bindings/cpp
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: EmbarkStudios/cargo-deny-action@v1
audit_python:
name: Audit Python
runs-on: ubuntu-latest
Expand Down
37 changes: 13 additions & 24 deletions .github/workflows/test_suite_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,17 @@ name: C Test Suite
on:
push:
paths:
- .github/workflows/test_suite_c.yml
- bindings/c/cmocka/**
- bindings/c/corrosion/**
- bindings/c/include/**
- bindings/c/src/**
- bindings/c/tests/**
- bindings/c/build.rs
- bindings/c/Cargo.toml
- bindings/c/Cargo.lock
- bindings/c/cbindgen.toml
- bindings/c/CMakeLists.txt
- .github/workflows/*_c.yml
- bindings/c/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
pull_request:
paths:
- .github/workflows/test_suite_c.yml
- bindings/c/cmocka/**
- bindings/c/corrosion/**
- bindings/c/include/**
- bindings/c/src/**
- bindings/c/tests/**
- bindings/c/build.rs
- bindings/c/Cargo.toml
- bindings/c/Cargo.lock
- bindings/c/cbindgen.toml
- bindings/c/CMakeLists.txt
- .github/workflows/*_c.yml
- bindings/c/**
- src/**
- Cargo.lock
- Cargo.toml
Expand Down Expand Up @@ -67,7 +49,7 @@ jobs:
working-directory: bindings/c/build
run: |
# Make cmocka a static dependency when testing.
cmake ../ -DBUILD_SHARED_LIBS=OFF -DCODE_COVERAGE=ON
cmake ../ -DBUILD_SHARED_LIBS=OFF -DBUILD_CCHECKS_TESTS=ON
- name: CMake Build
working-directory: bindings/c/build
run: |
Expand All @@ -79,13 +61,20 @@ jobs:
working-directory: bindings/c/build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y valgrind
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_check
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_item
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_result
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_runner
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_status
- name: Run LCov
working-directory: bindings/c/build
run: |
sudo apt update
sudo apt install -y lcov
lcov -c -d . -o coverage.info
- uses: codecov/codecov-action@v3
with:
files: lcov.info
flags: lang-c
files: build/coverage.info
76 changes: 76 additions & 0 deletions .github/workflows/test_suite_cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: C++ Test Suite

on:
push:
paths:
- .github/workflows/*_cpp.yml
- bindings/cpp/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
pull_request:
paths:
- .github/workflows/*_cpp.yml
- bindings/cpp/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules

jobs:
test:
name: C++ test
defaults:
run:
working-directory: bindings/cpp
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Make Build Directory
run: mkdir -p build
- name: CMake Configure
working-directory: bindings/cpp/build
run: |
# Make cmocka a static dependency when testing.
cmake ../ -DBUILD_SHARED_LIBS=OFF -DBUILD_CPPCHECKS_TESTS=ON
- name: CMake Build
working-directory: bindings/cpp/build
run: |
cmake --build . --config=Debug
- name: Run Test
working-directory: bindings/cpp/build
run: ctest -C Debug -VV --output-on-failure
- name: Run Valgrind
working-directory: bindings/cpp/build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y valgrind
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_check
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_item
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_result
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_runner
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_status
- name: Run LCov
working-directory: bindings/cpp/build
run: |
sudo apt update
sudo apt install -y lcov
lcov -c -d . -o coverage.info
- uses: codecov/codecov-action@v3
with:
flags: lang-cpp
files: build/coverage.info
32 changes: 17 additions & 15 deletions .github/workflows/test_suite_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ name: Python Test Suite

on:
push:
# paths:
# - .github/workflows/test_suite_python.yml
# - bindings/python/conftest.py
# - bindings/python/pychecks/**
# - bindings/python/pyproject.toml
# - bindings/python/src/**
# - bindings/python/tests/**
# pull_request:
# paths:
# - .github/workflows/test_suite_python.yml
# - bindings/python/conftest.py
# - bindings/python/pychecks/**
# - bindings/python/pyproject.toml
# - bindings/python/src/**
# - bindings/python/tests/**
paths:
- .github/workflows/*_python.yml
- bindings/python/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
pull_request:
paths:
- .github/workflows/*_python.yml
- bindings/python/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules

jobs:
test:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_suite_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Rust Test Suite
on:
push:
paths:
- .github/workflows/test_suite_rust.yml
- .github/workflows/*_rust.yml
- src/**
- tests/**
- Cargo.lock
- Cargo.toml
- deny.toml
pull_request:
paths:
- .github/workflows/test_suite_rust.yml
- .github/workflows/*_rust.yml
- src/**
- tests/**
- Cargo.lock
Expand Down
Loading
Loading