Test Runner projucer-ci
#356
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Runner | |
run-name: "Test Runner `${{ github.ref_name || github.head_ref }}`" | |
on: push | |
env: | |
BUILD_TYPE: Debug | |
CMAKE_BUILD_DIRECTORY: build | |
CPM_CACHE_DIR: .cpm-cache | |
SCCACHE_CACHE_MULTIARCH: 1 | |
SCCACHE_GHA_ENABLED: true | |
defaults: | |
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 -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 | |
- 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: Setup sccache | |
uses: mozilla-actions/[email protected] | |
- name: Restore CPM dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ env.CPM_CACHE_DIR }} | |
key: cpm-${{ runner.os }}-${{ github.ref_name || github.head_ref }}-${{ github.run_number }}-${{ github.run_attempt }} | |
restore-keys: | | |
cpm-${{ runner.os }}-${{ github.ref_name || github.head_ref }}-${{ github.run_number }} | |
cpm-${{ runner.os }}-${{ github.ref_name || github.head_ref }} | |
cpm-${{ runner.os }}-main | |
cpm-${{ runner.os }} | |
- 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 \ | |
-D JIVE_BUILD_EXAMPLES=ON \ | |
-D CMAKE_C_COMPILER_LAUNCHER=sccache \ | |
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \ | |
-D CPM_SOURCE_CACHE=${{ env.CPM_CACHE_DIR }} \ | |
-D CMAKE_POLICY_DEFAULT_CMP0141=NEW \ | |
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded \ | |
${{ matrix.additional-cmake-options }} | |
- name: Cache CPM dependencies | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.CPM_CACHE_DIR }} | |
key: cpm-${{ runner.os }}-${{ github.ref_name || github.head_ref }}-${{ github.run_number }}-${{ github.run_attempt }} | |
- 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 | |
- 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 \ | |
--ignore-errors format | |
- name: Upload Coverage Report | |
if: runner.os == 'macOS' | |
uses: codecov/codecov-action@v5 | |
with: | |
fail_ci_if_error: true | |
files: ./build/coverage.info | |
flags: unittests | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
projucer-build: | |
name: Projucer Build | |
strategy: | |
matrix: | |
platform: [macos-latest, windows-latest] | |
include: | |
- platform: macos-latest | |
juce-asset-name: osx | |
- platform: windows-latest | |
juce-asset-name: windows | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Projucer | |
uses: robinraju/[email protected] | |
with: | |
extract: true | |
fileName: "*-${{ matrix.juce-asset-name }}.zip" | |
latest: true | |
out-file-path: ${{ runner.temp }}/JUCE | |
repository: juce-framework/JUCE | |
- name: Build projects | |
run: | | |
if [[ '${{ matrix.platform }}' == 'macos-latest' ]]; then | |
PROJUCER=${{ runner.temp }}/JUCE/Projucer.app/Contents/MacOS/Projucer | |
else | |
PROJUCER=${{ runner.temp }}/JUCE/Projucer.exe | |
fi | |
for JUCER_FILE in **/*.jucer; do | |
$PROJUCER --resave $JUCER_FILE | |
done | |
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 |