build(qt): update qt path #9
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Qt for Linux and Windows | |
| uses: jurplel/install-qt-action@v4 | |
| if: matrix.os != 'macOS-latest' | |
| with: | |
| version: '5.15.2' | |
| host: ${{ matrix.os == 'windows-latest' && 'windows' || 'linux' }} | |
| target: 'desktop' | |
| arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2019_64' || 'gcc_64' }} | |
| - name: Install Qt for macOS | |
| if: matrix.os == 'macOS-latest' | |
| run: | | |
| brew install qt@5 | |
| echo "Qt5_DIR=$(brew --prefix qt@5)/lib/cmake" >> $GITHUB_ENV | |
| echo "QT_PLUGIN_PATH=$(brew --prefix qt@5)/plugins" >> $GITHUB_ENV | |
| echo "QML2_IMPORT_PATH=$(brew --prefix qt@5)/qml" >> $GITHUB_ENV | |
| - name: Install dependencies on Ubuntu | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential cmake libgl1-mesa-dev libxcb1-dev libxkbcommon-x11-dev libxcb-cursor0 | |
| - name: Install dependencies on macOS | |
| if: matrix.os == 'macOS-latest' | |
| run: | | |
| brew install cmake | |
| - name: Install dependencies on Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| choco install cmake ninja | |
| - name: Configure CMake | |
| run: | | |
| cmake -B ${{github.workspace}}/build -G "Ninja" -DCMAKE_BUILD_TYPE=Release | |
| - name: Build project | |
| run: | | |
| cmake --build ${{github.workspace}}/build --config Release | |
| - name: Run tests | |
| run: | | |
| cd ${{github.workspace}}/build && ctest --output-on-failure -C Release | |
| env: | |
| CTEST_OUTPUT_ON_FAILURE: 1 | |
| - name: Upload build artifacts (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-${{ matrix.os }} | |
| path: target/ | |
| clang-tidy: | |
| name: Run clang-tidy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Qt | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: '5.15.2' | |
| host: 'linux' | |
| target: 'desktop' | |
| arch: 'gcc_64' | |
| - name: Install clang-tidy | |
| run: | | |
| sudo apt update | |
| sudo apt install -y clang-tidy cmake | |
| - name: Configure CMake with clang-tidy | |
| run: | | |
| cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_CLANG_TIDY="clang-tidy" | |
| - name: Build project with clang-tidy | |
| run: | | |
| cmake --build ${{github.workspace}}/build --config Release | |
| continue-on-error: true | |
| - name: Run clang-tidy analysis | |
| run: | | |
| find src/ -name "*.cpp" -o -name "*.h" | xargs clang-tidy -p ${{github.workspace}}/build | |
| memory-analysis: | |
| name: Memory analysis with Valgrind | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Qt | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: '5.15.2' | |
| host: 'linux' | |
| target: 'desktop' | |
| arch: 'gcc_64' | |
| - name: Install Valgrind | |
| run: | | |
| sudo apt update | |
| sudo apt install -y valgrind cmake | |
| - name: Configure CMake | |
| run: | | |
| cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug | |
| - name: Build project | |
| run: | | |
| cmake --build ${{github.workspace}}/build --config Debug | |
| - name: Run tests with Valgrind | |
| run: | | |
| cd ${{github.workspace}}/build && find . -name "*test*" -executable -type f -exec valgrind --leak-check=full --error-exitcode=1 {} \; || true |