Skip to content
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
41 changes: 41 additions & 0 deletions .github/workflows/cmake-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CMake Format"

on:
# always run on main branch
push:
branches: [ main ]
paths-ignore:
- 'README.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
# run on PR to main branch if relevant files changed
pull_request:
branches: [ main ]
paths:
- '**/CMakeLists.txt'
- '.github/workflows/cmake-format.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
format:
name: "cmake-format"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.13'
cache-dependency-path: '.github/workflows/cmake-format.yml'
cache: 'pip'
- name: Install CMake formatting tool
run: pip install cmake-format

# Check all cmake files; ignore files in hidden directories
- name: Execute cmake-format
run: find . \( -path '*/.*' -prune \) -o
\( -type f -a -name 'CMakeLists.txt' \)
-exec echo "Format checking '{}'..." \;
-exec cmake-format --check -- {} +
12 changes: 7 additions & 5 deletions .github/workflows/cmake-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.13'
cache-dependency-path: '.github/workflows/cmake-lint.yml'
cache: 'pip'
- name: Install dependencies
run: |
sudo apt update -y
sudo apt -y --no-install-recommends install \
python3-pip='22.*'
pip install cmakelint
run: pip install cmakelint

- name: Execute cmakelint
run: find . \( \( -path './build' -o -path '*/.*' \) -prune \) -o
\( -type f -a -iname 'CMakeLists.txt' \)
Expand Down
125 changes: 97 additions & 28 deletions .github/workflows/cpp-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "C++ Build"
name: "Build|Test"

on:
# always run on main branch
Expand All @@ -25,47 +25,56 @@ concurrency:

jobs:
build:
name: "gcc/clang build"
name: "build"
runs-on: ubuntu-latest
strategy:
matrix:
cpp17_compatibility: [ "ON", "OFF" ]
cpp_compiler: [ "g++", "clang++" ]
include:
- cpp_compiler: "g++"
alpine_version: "v3.20"
cpp_version: "cpp17"
- cpp_compiler: "clang++"
alpine_version: "v3.19"
cpp_version: "cpp17"
- cpp_compiler: "g++"
alpine_version: "v3.19"
cpp_version: "cpp20"
- cpp_compiler: "clang++"
alpine_version: "v3.20"
cpp_version: "cpp20"
steps:
- uses: actions/checkout@v3
- uses: jirutka/setup-alpine@v1
with:
branch: v3.19
- name: Install dependencies
run: |
apk update
apk add \
cmake \
ninja-build \
g++ \
clang \
boost-dev \
boost-filesystem \
boost-python3 \
lua5.2-dev \
python3-dev \
fmt-dev \
gtest-dev
shell: alpine.sh --root {0}
branch: ${{ matrix.alpine_version }}
packages: >
cmake
ninja-build
g++
clang
boost-dev
boost-filesystem
boost-python3
lua5.2-dev
python3-dev
fmt-dev
gtest-dev
- name: Fixup environment
run: |
ln -s liblua-5.2.so.0 /usr/lib/liblua-5.2.so
ln -s /usr/lib/ninja-build/bin/ninja /usr/bin/ninja
shell: alpine.sh --root {0}

- name: Prepare
run: |
CXX=/usr/bin/${{ matrix.cpp_compiler }} \
cmake . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DPPPLUGIN_SHARED=ON \
-DPPPLUGIN_ENABLE_EXAMPLES=ON \
-DPPPLUGIN_ENABLE_TESTS=ON \
-DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp17_compatibility }}
CXX=/usr/bin/${{ matrix.cpp_compiler }} \
cmake . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DPPPLUGIN_SHARED=ON \
-DPPPLUGIN_ENABLE_EXAMPLES=ON \
-DPPPLUGIN_ENABLE_TESTS=ON \
-DPPPLUGIN_ENABLE_COVERAGE=${{ matrix.cpp_compiler == 'g++' && 'ON' || 'OFF' }} \
-DPPPLUGIN_ENABLE_CPP17_COMPATIBILITY=${{ matrix.cpp_version == 'cpp17' && 'ON' || 'OFF' }}
shell: alpine.sh {0}
- name: Build
run: |
Expand All @@ -75,3 +84,63 @@ jobs:
run: |
cmake --install build
shell: alpine.sh --root {0}

- uses: actions/upload-artifact@v4
with:
name: build_alpine-${{ matrix.alpine_version }}_${{ matrix.cpp_compiler }}_${{ matrix.cpp_version }}
path: build
retention-days: 5

unittest:
name: "unittest"
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
cpp_version: [ "cpp17", "cpp20" ]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
pattern: build_alpine-*_g++_${{ matrix.cpp_version }}
path: build
merge-multiple: true
- name: Fix artifact permissions
run: chmod +x build/test/tests

- uses: jirutka/setup-alpine@v1
with:
branch: v3.20
packages: >
g++
gtest-dev
lcov
gzip

- name: Execute tests
run: |
lcov --capture --initial \
--directory . \
--ignore-errors mismatch,source \
--output-file baseline_coverage
build/test/tests || echo $?
lcov --capture \
--directory . \
--ignore-errors mismatch,source \
--output-file total_coverage
lcov \
--add-tracefile baseline_coverage \
--add-tracefile total_coverage \
--ignore-errors mismatch,source \
--output-file measured_coverage
lcov --remove measured_coverage "/usr*" \
--ignore-errors mismatch,source \
--output-file coverage_without_system_files
lcov --remove coverage_without_system_files "*/test/*" \
--ignore-errors mismatch,source \
--output-file coverage_without_system_and_test_files
genhtml \
--output-directory coverage \
--legend coverage_without_system_and_test_files
lcov --list coverage_without_system_and_test_files
shell: alpine.sh {0}
25 changes: 6 additions & 19 deletions .github/workflows/format.yml → .github/workflows/cpp-format.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "C++/CMake Format"
name: "C++ Format"

on:
# always run on main branch
Expand All @@ -14,41 +14,28 @@ on:
paths:
- '**/*.cpp'
- '**/*.h'
- '**/CMakeLists.txt'
- '.github/workflows/format.yml'
- '.github/workflows/cpp-format.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
format:
name: "clang-format/cmake-format"
name: "clang-format"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jirutka/setup-alpine@v1
with:
branch: v3.19
- name: Install dependencies
run: |
apk update
apk add \
clang-extra-tools \
py3-pip
pip install --break-system-packages cmake-format
shell: alpine.sh --root {0}
packages: >
clang-extra-tools

# Check all source and header C++ files; ignore files in hidden directories
- name: Execute clang-format
run: find . \( -path '*/.*' -prune \) -o
\( -type f -a \( -iname '*.cpp' -o -iname '*.h' \) \)
-exec echo "Format checking '{}'..." \;
-exec clang-format --dry-run --Werror --Wno-error=unknown {} +
shell: alpine.sh {0}
# Check all cmake files; ignore files in hidden directories
- name: Execute cmake-format
run: find . \( -path '*/.*' -prune \) -o
\( -type f -a -name 'CMakeLists.txt' \)
-exec echo "Format checking '{}'..." \;
-exec cmake-format --check -- {} +
shell: alpine.sh {0}
30 changes: 14 additions & 16 deletions .github/workflows/cpp-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,32 @@ jobs:
- uses: jirutka/setup-alpine@v1
with:
branch: v3.19
- name: Install dependencies
run: |
apk update
apk add \
cmake \
ninja-build \
g++ \
boost-dev \
boost-filesystem \
boost-python3 \
lua5.2-dev \
python3-dev \
fmt-dev \
gtest-dev \
clang-extra-tools
shell: alpine.sh --root {0}
packages: >
cmake
ninja-build
g++
boost-dev
boost-filesystem
boost-python3
lua5.2-dev
python3-dev
fmt-dev
gtest-dev
clang-extra-tools
- name: Fixup environment
run: |
ln -s liblua-5.2.so.0 /usr/lib/liblua-5.2.so
ln -s /usr/lib/ninja-build/bin/ninja /usr/bin/ninja
shell: alpine.sh --root {0}

- name: Generate compile_commands.json
run: |
cmake . -B build -G Ninja \
-DPPPLUGIN_ENABLE_EXAMPLES=ON \
-DPPPLUGIN_ENABLE_TESTS=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
shell: alpine.sh {0}

# Check all source and header C++ files;
# ignore files in the build directory or in hidden directories
- name: Execute clang-tidy
Expand Down
Loading
Loading