|
| 1 | +# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. |
| 2 | +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml |
| 3 | +name: CMake on multiple platforms |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - 'v*' # This will trigger the workflow on any tag starting with 'v', like v1.0.0, v2.1, etc. |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + env: |
| 16 | + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} |
| 17 | + |
| 18 | + strategy: |
| 19 | + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. |
| 20 | + fail-fast: false |
| 21 | + |
| 22 | + # Set up a matrix to run the following 3 configurations: |
| 23 | + # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator> |
| 24 | + # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator> |
| 25 | + # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator> |
| 26 | + # |
| 27 | + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. |
| 28 | + matrix: |
| 29 | + os: [windows-2025, ubuntu-22.04] |
| 30 | + build_type: [Release] |
| 31 | + c_compiler: [gcc] |
| 32 | + |
| 33 | + |
| 34 | + steps: |
| 35 | + |
| 36 | + - name: Install Qt |
| 37 | + |
| 38 | + if: runner.os == 'Windows' |
| 39 | + with: |
| 40 | + version: '6.10.1' |
| 41 | + target: 'desktop' |
| 42 | + arch: 'win64_llvm_mingw' |
| 43 | + cache: true |
| 44 | + tools: 'tools_llvm_mingw1706' |
| 45 | + modules: 'qtquick3d qtquick3dphysics qtmultimedia qtquicktimeline qtshadertools' |
| 46 | + aqtversion: ==3.2.* |
| 47 | + |
| 48 | + - name: Install Qt |
| 49 | + |
| 50 | + if: runner.os == 'Linux' |
| 51 | + with: |
| 52 | + version: '6.10.1' |
| 53 | + target: 'desktop' |
| 54 | + arch: 'linux_gcc_64' |
| 55 | + cache: true |
| 56 | + modules: 'qtquick3d qtquick3dphysics qtmultimedia qtquicktimeline qtshadertools' |
| 57 | + aqtversion: ==3.2.* |
| 58 | + |
| 59 | + - name: Install Snapcraft |
| 60 | + if: runner.os == 'Linux' |
| 61 | + uses: samuelmeuli/action-snapcraft@v3 |
| 62 | + |
| 63 | + # Checkout main repository without submodules first |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + submodules: true |
| 67 | + fetch-tags: true |
| 68 | + fetch-depth: 0 |
| 69 | + |
| 70 | + - name: Download and Extract CQtDeployer Linux |
| 71 | + if: runner.os == 'Linux' |
| 72 | + uses: robinraju/release-downloader@v1 |
| 73 | + with: |
| 74 | + repository: 'QuasarApp/CQtDeployer' |
| 75 | + latest: true |
| 76 | + fileName: 'CQtDeployer_1.6.2365.7cce7f3_Linux_x86_64.zip' |
| 77 | + extract: true |
| 78 | + out-file-path: ${{ github.workspace }}/cqt |
| 79 | + |
| 80 | + - name: Install CQtDeployer Linux |
| 81 | + if: runner.os == 'Linux' |
| 82 | + run: | |
| 83 | + chmod +x "${{ github.workspace }}/cqt/CQtDeployer.sh" |
| 84 | + chmod +x "${{ github.workspace }}/cqt/bin/CQtDeployer" |
| 85 | + ln -s ${{ github.workspace }}/cqt/CQtDeployer.sh ${{ github.workspace }}/cqt/cqtdeployer |
| 86 | + echo "$GITHUB_WORKSPACE/cqt" >> $GITHUB_PATH |
| 87 | +
|
| 88 | + - name: Download and Extract CQtDeployer Windows |
| 89 | + if: runner.os == 'Windows' |
| 90 | + uses: robinraju/release-downloader@v1 |
| 91 | + with: |
| 92 | + repository: 'QuasarApp/CQtDeployer' |
| 93 | + latest: true |
| 94 | + fileName: 'CQtDeployer_1.6.2365.7cce7f3_Windows_AMD64.zip' |
| 95 | + extract: true |
| 96 | + out-file-path: ${{ github.workspace }}/cqt |
| 97 | + |
| 98 | + - name: Install CQtDeployer Windows |
| 99 | + if: runner.os == 'Windows' |
| 100 | + run: echo "${{ github.workspace }}\cqt" >> $env:GITHUB_PATH |
| 101 | + shell: pwsh |
| 102 | + |
| 103 | + |
| 104 | + - name: ccache |
| 105 | + uses: hendrikmuhs/[email protected] |
| 106 | + with: |
| 107 | + key: ${{ matrix.os }}-${{ matrix.type }} |
| 108 | + |
| 109 | + - name: Configure CMake |
| 110 | + if: runner.os == 'Windows' |
| 111 | + run: > |
| 112 | + cmake -B ${{ steps.strings.outputs.build-output-dir }} |
| 113 | + -G Ninja |
| 114 | + -DCMAKE_CXX_COMPILER=clang++ |
| 115 | + -DCMAKE_C_COMPILER=clang |
| 116 | + -DBUILD_SHARED_LIBS=ON |
| 117 | + -DCMAKE_PREFIX_PATH='${{ steps.sdl.outputs.prefix }};${{ env.QT_ROOT_DIR }}' |
| 118 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
| 119 | + -S ${{ github.workspace }} |
| 120 | +
|
| 121 | + - name: Configure CMake |
| 122 | + if: runner.os == 'Linux' |
| 123 | + run: > |
| 124 | + cmake -B ${{ steps.strings.outputs.build-output-dir }} |
| 125 | + -G Ninja |
| 126 | + -DBUILD_SHARED_LIBS=ON |
| 127 | + -DCMAKE_PREFIX_PATH='${{ steps.sdl.outputs.prefix }};${{ env.QT_ROOT_DIR }}' |
| 128 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
| 129 | + -S ${{ github.workspace }} |
| 130 | +
|
| 131 | + - name: Build |
| 132 | + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). |
| 133 | + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16 |
| 134 | + |
| 135 | + - name: deploy |
| 136 | + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). |
| 137 | + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target deploy |
| 138 | + |
| 139 | + - name: release |
| 140 | + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). |
| 141 | + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target release |
| 142 | + |
| 143 | + - name: Create Release and Upload Assets Installer |
| 144 | + uses: svenstaro/upload-release-action@v2 |
| 145 | + with: |
| 146 | + tag: v${{ env.CQT_DEPLOYER_VERSION }} |
| 147 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 148 | + file: Distro/${{ env.INSTALLER_FULL_NAME }} |
| 149 | + prerelease: true |
| 150 | + asset_name: ${{ env.INSTALLER_FULL_NAME }} |
| 151 | + overwrite: true |
| 152 | + body: CQtDeployer ${{ env.CQT_DEPLOYER_VERSION }} |
| 153 | + |
| 154 | + - name: Create Release and Upload Assets Deb |
| 155 | + if: runner.os == 'Linux' |
| 156 | + |
| 157 | + uses: svenstaro/upload-release-action@v2 |
| 158 | + with: |
| 159 | + tag: v${{ env.CQT_DEPLOYER_VERSION }} |
| 160 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 161 | + file: Distro/${{ env.BASE_FULL_NAME }}.deb |
| 162 | + prerelease: true |
| 163 | + asset_name: ${{ env.BASE_FULL_NAME }}.deb |
| 164 | + overwrite: true |
| 165 | + body: CQtDeployer ${{ env.CQT_DEPLOYER_VERSION }} |
| 166 | + |
| 167 | + - name: Create Release and Upload Assets zip |
| 168 | + uses: svenstaro/upload-release-action@v2 |
| 169 | + with: |
| 170 | + tag: v${{ env.CQT_DEPLOYER_VERSION }} |
| 171 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 172 | + file: Distro/${{ env.BASE_FULL_NAME }}.zip |
| 173 | + prerelease: true |
| 174 | + asset_name: ${{ env.BASE_FULL_NAME }}.zip |
| 175 | + overwrite: true |
| 176 | + body: CQtDeployer ${{ env.CQT_DEPLOYER_VERSION }} |
| 177 | + |
0 commit comments