Skip to content
Closed
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
42 changes: 24 additions & 18 deletions .github/workflows/cpp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,29 @@ on:
workflow_dispatch:

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: ./Sources/backend-cpp/Windows/com.ctytler.dcs.sdPlugin.sln

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
SOURCE_DIR: ./Sources/backend-cpp
BUILD_DIR: ./Sources/backend-cpp/build

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Ninja
run: choco install ninja -y
shell: powershell

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Install Boost
run: vcpkg install boost-thread:x64-windows

- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: CMake
run: cmake -G Ninja -S ${{env.SOURCE_DIR}} -B ${{env.BUILD_DIR}} -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake

- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
run: cmake --build ${{env.BUILD_DIR}}

- name: Setup OpenCppCoverage and add to PATH
id: setup_opencppcoverage
Expand All @@ -50,11 +45,22 @@ jobs:
- name: Run C++ Unit Tests and Generate Coverage Report
id: generate_test_report
shell: cmd
run: OpenCppCoverage.exe --sources Sources\backend-cpp --excluded_sources Vendor --excluded_sources Windows --export_type cobertura:StreamdeckDcsInterfaceCov.xml .\Sources\backend-cpp\Windows\x64\Release\Test.exe
run: |
OpenCppCoverage.exe ^
--quiet ^
--sources Sources\backend-cpp ^
--excluded_sources Vendor ^
--excluded_sources Windows ^
--excluded_sources Tools ^
--export_type cobertura:StreamdeckDcsInterfaceCov.xml ^
--cover_children ^
-- ctest --test-dir ./${{env.BUILD_DIR}} --output-on-failure

- name: Upload Report to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./StreamdeckDcsInterfaceCov.xml
flags: Cpp
disable_search: true

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <iostream>
json backwardsCompatibilityHandler(const json &prevVersionPayload)
{
if (prevVersionPayload.empty()) {
return prevVersionPayload;
}

json payload = prevVersionPayload;
const auto prevSettings = prevVersionPayload["settings"];
if (!prevSettings.contains("send_address") && prevSettings.contains("device_id") &&
Expand Down
13 changes: 5 additions & 8 deletions Tools/build_plugin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@
:: Change directory to the project root (directory above this batch file location)
cd /D "%~dp0"\..

:: Restore NuGet packages
MSBuild.exe .\Sources\backend-cpp\Windows\com.ctytler.dcs.sdPlugin.sln /t:Restore /p:RestorePackagesConfig=true
if %errorlevel% neq 0 echo "Canceling plugin build due to failure to restore NuGet packages" && pause && exit /b %errorlevel%

:: Build C++ executable:
MSBuild.exe .\Sources\backend-cpp\Windows\com.ctytler.dcs.sdPlugin.sln /p:Configuration="Release"
cmake -G Ninja -S ./Sources/backend-cpp -B ./Sources/backend-cpp/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
cmake --build ./Sources/backend-cpp/build
if %errorlevel% neq 0 echo "Canceling plugin build due to failed backend build" && pause && exit /b %errorlevel%

:: Run unit tests, only continue if all tests pass
Sources\backend-cpp\Windows\x64\Release\Test.exe
ctest --test-dir ./Sources/backend-cpp/build --output-on-failure
if %errorlevel% neq 0 echo "Canceling plugin build due to failed unit tests" && pause && exit /b %errorlevel%

:: Copy C++ executable and DLLs to StreamDeck Plugin package:
echo. && echo *** C++ binary compilation complete, published to Sources/com.ctytler.dcs.sdPlugin/bin/ *** && echo.
copy Sources\backend-cpp\Windows\x64\Release\streamdeck_dcs_interface.exe Sources\com.ctytler.dcs.sdPlugin\bin\
copy Sources\backend-cpp\Windows\x64\Release\*.dll Sources\com.ctytler.dcs.sdPlugin\bin\
copy Sources\backend-cpp\build\bin\StreamdeckInterface.exe Sources\com.ctytler.dcs.sdPlugin\bin\streamdeck_dcs_interface.exe
copy Sources\backend-cpp\build\bin\*.dll Sources\com.ctytler.dcs.sdPlugin\bin\

:: Remove any prior build of the Plugin:
echo. && echo *** Removing any previous builds of com.ctytler.dcs.streamDeckPlugin from Release/ ***
Expand Down
23 changes: 16 additions & 7 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
codecov:
require_ci_to_pass: true
notify:
after_n_builds: 2

coverage:
status:
default_rules:
project:
default:
target: auto
threshold: 1%
cpp:
informational: true
flags:
- Cpp

react:
informational: true
flags:
- ReactJS
codecov:
notify:
after_n_builds: 2
patch:
default:
informational: true

comment:
after_n_builds: 2

Loading