Skip to content

Change from custom package manager to vcpkg. #6

Change from custom package manager to vcpkg.

Change from custom package manager to vcpkg. #6

name: C++ CI Pipeline
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
jobs:
cppcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cppcheck
version: 1.0
- name: Run cppcheck
run: |
cppcheck --error-exitcode=1 --force . \
--std=c++17 --enable=warning,style,performance,portability,unusedFunction \
--suppress=constParameterCallback
clangformat:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run clang-format
run: |
find . -type f \( -iname "*.cpp" -o -iname "*.hpp" \) \
-exec clang-format --dry-run -style=file {} +
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup VCPKG
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{github.workspace}}/vcpkg'
vcpkgGitCommitId: 'a42af01b72c28a8e1d7b48107b33e4f286a55ef6'
vcpkgJsonGlob: '${{github.workspace}}/vcpkg.json'
- name: Configure CMake
run: cmake --preset=release
- name: Build
run: cmake --build build -j$(nproc)
tests:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup VCPKG
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{github.workspace}}/vcpkg'
vcpkgGitCommitId: 'a42af01b72c28a8e1d7b48107b33e4f286a55ef6'
vcpkgJsonGlob: '${{github.workspace}}/vcpkg.json'
- name: Configure CMake
run: cmake --preset=debug
- name: Build
run: cmake --build build -j$(nproc)
- name: Run tests
run: ctest --test-dir build
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Dependencies for testing:
# - doxygen
# - graphviz
- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: doxygen graphviz
version: 1.0
- name: Generate documentation
shell: bash
run: |
# Generate the documentation
sudo dot -c
ERRORS_FILE=doxygen_errors.txt
doxygen -s doxygen.cfg 2> ${ERRORS_FILE}
# Check if there are errors
if [ -s "${ERRORS_FILE}" ]; then
echo "-----------------------------------------------"
echo "FAILED: Doxygen documentation generation failed"
echo "-----------------------------------------------"
exit 1
else
echo "----------------------------------------------------"
echo "PASSED: Doxygen documentation generated successfully"
echo "----------------------------------------------------"
fi
# Upload errors as an artifact, when failed
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Doxygen errors
path: doxygen_errors.txt
retention-days: 1
# Upload the documentation as an artifact, when successful
- uses: actions/upload-artifact@v3
if: success()
with:
name: Doxygen Documentation
path: doc
retention-days: 1