Update ci.yml #175
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: CI workflow | |
on: push | |
jobs: | |
cmakelint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
- run: pip install cmakelint | |
- run: cmakelint `find . -name CMakeLists.txt` | |
cpplint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo apt-get install -y cpplint | |
- run: cpplint --recursive . | |
build_and_test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
compiler: | |
- g++ | |
- clang++ | |
extra_check: | |
- '' | |
include: | |
- os: windows-latest | |
compiler: msvc | |
generator_flag: '-G "Visual Studio 17 2022"' | |
- os: windows-latest | |
compiler: g++ | |
generator_flag: '-G "MinGW Makefiles"' | |
- os: ubuntu-latest | |
compiler: clazy | |
extra_check: clazy | |
- os: ubuntu-latest | |
compiler: clang++ | |
extra_check: clang-tidy | |
extra_check_flag: '-DCMAKE_CXX_CLANG_TIDY="/usr/bin/clang-tidy;-checks=*"' | |
- os: ubuntu-latest | |
compiler: clang++ | |
extra_check: lwyu | |
extra_check_flag: '-DCMAKE_LINK_WHAT_YOU_USE=TRUE' | |
- os: ubuntu-latest | |
compiler: clang++ | |
extra_check: iwyu | |
extra_check_flag: '-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="/usr/bin/iwyu"' | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.extra_check || join(matrix.*) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies (linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get -y install libgl1-mesa-dev qt6-base-dev libgtest-dev libasound2-dev ninja-build | |
- name: Install dependencies (macos) | |
if: matrix.os == 'macos-latest' | |
run: brew install googletest qt6 ninja | |
- name: Install Qt6 (windows) | |
if: matrix.os == 'windows-latest' | |
uses: jurplel/install-qt-action@v4 | |
with: | |
aqtversion: '==3.1.*' | |
version: '6.7.1' | |
host: 'windows' | |
target: 'desktop' | |
arch: ${{ matrix.compiler == 'msvc' && 'win64_msvc2019_64' || matrix.compiler == 'g++' && 'win64_mingw' }} | |
- name: Install clang (linux) | |
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang++' | |
run: sudo apt-get -y install clang | |
- name: Install clang (macos) | |
if: matrix.os == 'macos-latest' && matrix.compiler == 'clang++' | |
run: brew install llvm | |
- name: Install clazy | |
if: matrix.compiler == 'clazy' | |
run: sudo apt-get -y install clazy | |
- name: Install clang-tidy | |
if: matrix.extra_check == 'cland-tidy' | |
run: sudo apt-get install -y clang-tidy | |
- name: Install IWYU | |
if: matrix.extra_check == 'iwyu' | |
run: sudo apt-get install -y iwyu | |
- name: Configure CMake | |
run: cmake -Bbuild ${{matrix.generator_flag}}. -DCMAKE_CXX_COMPILER="${{matrix.compiler}}" ${{matrix.extra_check_flag}} | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
if: matrix.extra_check == '' && matrix.os != 'windows-latest' | |
run: ctest --test-dir build | |
# for some reason ctest doesn't work on windows. Execute tests directly: | |
- name: Test (windows, msvc) | |
if: matrix.os == 'windows-latest' && matrix.compiler == 'msvc' | |
run: ${{ github.workspace }}\build\tests\Debug\tests.exe | |
- name: Test (windows, MinGW) | |
if: matrix.os == 'windows-latest' && matrix.compiler == 'g++' | |
run: D:\a\cxxmidi\cxxmidi\build\tests\tests.exe |