Skip to content

Commit

Permalink
Merge pull request #154 from ImJimmi/pluginval
Browse files Browse the repository at this point in the history
Add pluginval to CTest for demo runner
  • Loading branch information
ImJimmi authored Sep 18, 2024
2 parents f0c3917 + 1c5b5f4 commit d93bace
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 113 deletions.
225 changes: 115 additions & 110 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
@@ -1,121 +1,126 @@
name: Test Runner

on:
pull_request:
branches: [main]
pull_request:
branches: [main]

run-name: "Test Runner - #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}"

env:
BUILD_TYPE: Debug
CMAKE_BUILD_DIRECTORY: build
BUILD_TYPE: Debug
CMAKE_BUILD_DIRECTORY: build

defaults:
run:
shell: bash
run:
shell: bash

jobs:
run-tests:
strategy:
matrix:
platform: [macos-latest, windows-latest]
include:
- platform: macos-latest
platform-name: macOS
package-manager: brew
additional-cmake-options: -DJIVE_ENABLE_COVERAGE=ON
- platform: windows-latest
platform-name: Windows
platform-shell: cmd
package-manager: choco

name: Test ${{ matrix.platform-name }}
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Ninja
run: ${{ matrix.package-manager }} install ninja
- name: Setup devcmd
if: runner.os == 'Windows'
uses: ilammy/[email protected]

- name: CMake Generate
run: |
cmake \
-B ${{ env.CMAKE_BUILD_DIRECTORY }} \
-G Ninja \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D JIVE_BUILD_TEST_RUNNER=ON \
-D JIVE_BUILD_DEMO_RUNNER=ON \
${{ matrix.additional-cmake-options }}
- name: CMake Build
run: |
cmake \
--build ${{ env.CMAKE_BUILD_DIRECTORY }} \
--config ${{ env.BUILD_TYPE }}
- name: Run CTest
run: |
cd ${{ env.CMAKE_BUILD_DIRECTORY }}
ctest \
--output-on-failure \
--extra-verbose \
-j14 \
-C ${{ env.BUILD_TYPE }} \
-T test \
-O ctest.log
- name: Install lcov
if: runner.os == 'macOS'
working-directory: ${{github.workspace}}/build
run: brew install lcov

- name: Generate Coverage Report
if: runner.os == 'macOS'
working-directory: ${{github.workspace}}/build
run: |
lcov \
--directory . \
--capture \
--output-file coverage.info \
--ignore-errors inconsistent \
--ignore-errors gcov \
--ignore-errors range \
--ignore-errors source
- name: Upload Coverage Report
if: runner.os == 'macOS'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./build/coverage.info
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

- name: Stage Artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.platform-name }} #${{ github.event.pull_request.number }}"
path: ${{ env.CMAKE_BUILD_DIRECTORY }}/ctest.log
if-no-files-found: ignore
retention-days: 7
overwrite: true

verify-formatting:
name: Verify Formatting
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Install clang-format
run: brew install clang-format

- name: Verify formatting
run: python3 .github/scripts/verify_formatting.py
run-tests:
strategy:
matrix:
platform: [macos-latest, windows-latest]
include:
- platform: macos-latest
platform-name: macOS
package-manager: brew
additional-cmake-options: -DJIVE_ENABLE_COVERAGE=ON -DJIVE_ENABLE_SANITISERS=ON

- platform: windows-latest
platform-name: Windows
platform-shell: cmd
package-manager: choco
additional-cmake-options: -DCMAKE_PROGRAM_PATH="C:\ProgramData\chocolatey\lib\pluginval\tools"

name: Test ${{ matrix.platform-name }}
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Ninja
run: ${{ matrix.package-manager }} install ninja
- name: Install pluginval
run: ${{matrix.package-manager}} install pluginval

- name: Setup devcmd
if: runner.os == 'Windows'
uses: ilammy/[email protected]

- name: CMake Generate
run: |
cmake \
-B ${{ env.CMAKE_BUILD_DIRECTORY }} \
-G Ninja \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D JIVE_BUILD_TEST_RUNNER=ON \
-D JIVE_BUILD_DEMO_RUNNER=ON \
${{ matrix.additional-cmake-options }}
- name: CMake Build
run: |
cmake \
--build ${{ env.CMAKE_BUILD_DIRECTORY }} \
--config ${{ env.BUILD_TYPE }}
- name: Run CTest
run: |
cd ${{ env.CMAKE_BUILD_DIRECTORY }}
ctest \
--output-on-failure \
--extra-verbose \
-j14 \
-C ${{ env.BUILD_TYPE }} \
-T test \
-O ctest.log
- name: Install lcov
if: runner.os == 'macOS'
working-directory: ${{github.workspace}}/build
run: brew install lcov

- name: Generate Coverage Report
if: runner.os == 'macOS'
working-directory: ${{github.workspace}}/build
run: |
lcov \
--directory . \
--capture \
--output-file coverage.info \
--ignore-errors inconsistent \
--ignore-errors gcov \
--ignore-errors range \
--ignore-errors source
- name: Upload Coverage Report
if: runner.os == 'macOS'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./build/coverage.info
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

- name: Stage Artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.platform-name }} #${{ github.event.pull_request.number }}"
path: ${{ env.CMAKE_BUILD_DIRECTORY }}/ctest.log
if-no-files-found: ignore
retention-days: 7
overwrite: true

verify-formatting:
name: Verify Formatting
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Install clang-format
run: brew install clang-format

- name: Verify formatting
run: python3 .github/scripts/verify_formatting.py
4 changes: 1 addition & 3 deletions cmake/jive_compiler_and_linker_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ if (APPLE)

if (JIVE_ENABLE_SANITISERS)
target_compile_options(jive_compiler_and_linker_options
INTERFACE -fsanitize=address
-fsanitize=undefined
INTERFACE -fsanitize=undefined
)

target_link_options(jive_compiler_and_linker_options
INTERFACE
-fsanitize=address
-fsanitize=undefined
)
endif ()
Expand Down
3 changes: 3 additions & 0 deletions runners/demo-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include(cmake/melatonin_inspector.cmake)
include(cmake/pluginval.cmake)

add_library(jive-demo
INTERFACE
Expand Down Expand Up @@ -78,3 +79,5 @@ target_link_libraries(jive-demo-plugin
juce::juce_audio_utils
juce::juce_audio_devices
)

add_pluginval_tests(jive-demo-plugin)
10 changes: 10 additions & 0 deletions runners/demo-runner/cmake/pluginval.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function (add_pluginval_tests
TARGET
)
file(DOWNLOAD
https://raw.githubusercontent.com/Tracktion/pluginval/refs/heads/develop/tests/AddPluginvalTests.cmake
${CMAKE_BINARY_DIR}/pluginval/AddPluginvalTests.cmake
)
include(${CMAKE_BINARY_DIR}/pluginval/AddPluginvalTests.cmake)
add_pluginval_tests(${TARGET})
endfunction ()

0 comments on commit d93bace

Please sign in to comment.