|
| 1 | +name: QMake Build Matrix |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +env: |
| 6 | + QT_VERSION: 5.14.2 |
| 7 | + QT_CREATOR_VERSION: 4.12.0 |
| 8 | + PLUGIN_PRO: doxygen.pro |
| 9 | + PLUGIN_NAME: Doxygen |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: ${{ matrix.config.name }} |
| 14 | + runs-on: ${{ matrix.config.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + config: |
| 18 | + - { |
| 19 | + name: "Windows Latest x64", artifact: "Windows-x64.zip", |
| 20 | + msvc: win64_msvc2017_64, |
| 21 | + os: windows-latest, |
| 22 | + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" |
| 23 | + } |
| 24 | + - { |
| 25 | + name: "Windows Latest x86", artifact: "Windows-x86.zip", |
| 26 | + msvc: win32_msvc2017, |
| 27 | + os: windows-latest, |
| 28 | + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat" |
| 29 | + } |
| 30 | + - { |
| 31 | + name: "Linux Latest x64", artifact: "Linux-x64.zip", |
| 32 | + os: ubuntu-latest |
| 33 | + } |
| 34 | + - { |
| 35 | + name: "macOS Latest x64", artifact: "macOS-x64.zip", |
| 36 | + os: macos-latest |
| 37 | + } |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v1 |
| 41 | + |
| 42 | + - name: Installing system libs |
| 43 | + shell: cmake -P {0} |
| 44 | + run: | |
| 45 | + if ("${{ runner.os }}" STREQUAL "Linux") |
| 46 | + execute_process( |
| 47 | + COMMAND sudo apt install libgl1-mesa-dev |
| 48 | + ) |
| 49 | + endif() |
| 50 | +
|
| 51 | + - name: Download Qt |
| 52 | + id: qt |
| 53 | + uses: jurplel/install-qt-action@v2 |
| 54 | + with: |
| 55 | + version: "${{ env.QT_VERSION }}" |
| 56 | + modules: qtdeclarative qttools qtsvg |
| 57 | + arch: "${{ matrix.config.msvc }}" |
| 58 | + |
| 59 | + - name: Download Qt Creator |
| 60 | + id: qt_creator |
| 61 | + shell: cmake -P {0} |
| 62 | + run: | |
| 63 | + string(REGEX MATCH "([0-9]+.[0-9]+).[0-9]+" outvar "$ENV{QT_CREATOR_VERSION}") |
| 64 | + set(qtc_base_url "https://download.qt.io/official_releases/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}") |
| 65 | +
|
| 66 | + if ("${{ runner.os }}" STREQUAL "Windows") |
| 67 | + set(qtc_output_directory "qtcreator/lib/qtcreator/plugins") |
| 68 | + set(qtc_binary_name "$ENV{PLUGIN_NAME}4.dll") |
| 69 | + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") |
| 70 | + set(qtc_platform "windows_msvc2017_x64") |
| 71 | + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") |
| 72 | + set(qtc_platform "windows_msvc2017_x86") |
| 73 | + endif() |
| 74 | + elseif ("${{ runner.os }}" STREQUAL "Linux") |
| 75 | + set(qtc_output_directory "qtcreator/lib/qtcreator/plugins") |
| 76 | + set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.so") |
| 77 | + set(qtc_platform "linux_gcc_64_rhel72") |
| 78 | + elseif ("${{ runner.os }}" STREQUAL "macOS") |
| 79 | + set(qtc_output_directory "qtcreator/bin/Qt Creator.app/Contents/PlugIns") |
| 80 | + set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.dylib") |
| 81 | + set(qtc_platform "mac_x64") |
| 82 | + endif() |
| 83 | +
|
| 84 | + # Save the path for other steps |
| 85 | + message("::set-output name=qtc_binary_name::${qtc_binary_name}") |
| 86 | + message("::set-output name=qtc_output_directory::${qtc_output_directory}") |
| 87 | +
|
| 88 | + file(MAKE_DIRECTORY qtcreator) |
| 89 | +
|
| 90 | + foreach(package qtcreator qtcreator_dev) |
| 91 | + file(DOWNLOAD |
| 92 | + "${qtc_base_url}/installer_source/${qtc_platform}/${package}.7z" ./${package}.7z SHOW_PROGRESS) |
| 93 | + execute_process(COMMAND |
| 94 | + ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator) |
| 95 | + endforeach() |
| 96 | +
|
| 97 | + if ("${{ runner.os }}" STREQUAL "macOS") |
| 98 | + execute_process( |
| 99 | + COMMAND ${CMAKE_COMMAND} -E make_directory qtcreator/bin |
| 100 | + COMMAND ${CMAKE_COMMAND} -E create_symlink |
| 101 | + "$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app" |
| 102 | + "$ENV{GITHUB_WORKSPACE}/qtcreator/bin/Qt Creator.app" |
| 103 | + ) |
| 104 | + endif() |
| 105 | +
|
| 106 | + - name: Configure |
| 107 | + shell: cmake -P {0} |
| 108 | + run: | |
| 109 | + if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") |
| 110 | + execute_process( |
| 111 | + COMMAND "${{ matrix.config.environment_script }}" && set |
| 112 | + OUTPUT_FILE environment_script_output.txt |
| 113 | + ) |
| 114 | + file(STRINGS environment_script_output.txt output_lines) |
| 115 | + foreach(line IN LISTS output_lines) |
| 116 | + if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") |
| 117 | + set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") |
| 118 | +
|
| 119 | + # Set for other steps |
| 120 | + message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}") |
| 121 | + endif() |
| 122 | + endforeach() |
| 123 | + endif() |
| 124 | +
|
| 125 | + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir) |
| 126 | +
|
| 127 | + execute_process( |
| 128 | + COMMAND qmake |
| 129 | + $ENV{PLUGIN_PRO} |
| 130 | + CONFIG+=release |
| 131 | + QTC_SOURCE="${qtcreator_dir}" |
| 132 | + QTC_BUILD="${qtcreator_dir}" |
| 133 | + RESULT_VARIABLE result |
| 134 | + ) |
| 135 | + if (NOT result EQUAL 0) |
| 136 | + message(FATAL_ERROR "Bad exit status") |
| 137 | + endif() |
| 138 | +
|
| 139 | + - name: Build |
| 140 | + shell: cmake -P {0} |
| 141 | + run: | |
| 142 | + if (NOT "${{ runner.os }}" STREQUAL "Windows") |
| 143 | + set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}") |
| 144 | + endif() |
| 145 | +
|
| 146 | + include(ProcessorCount) |
| 147 | + ProcessorCount(N) |
| 148 | +
|
| 149 | + set(make_program make -j ${N}) |
| 150 | + if ("${{ runner.os }}" STREQUAL "Windows") |
| 151 | + set(make_program "qtcreator/bin/jom") |
| 152 | + endif() |
| 153 | +
|
| 154 | + execute_process( |
| 155 | + COMMAND ${make_program} |
| 156 | + RESULT_VARIABLE result |
| 157 | + ) |
| 158 | + if (NOT result EQUAL 0) |
| 159 | + message(FATAL_ERROR "Bad exit status") |
| 160 | + endif() |
| 161 | +
|
| 162 | + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact) |
| 163 | +
|
| 164 | + execute_process(COMMAND |
| 165 | + ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}" |
| 166 | + WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}" |
| 167 | + ) |
| 168 | +
|
| 169 | + - uses: actions/upload-artifact@v1 |
| 170 | + id: upload_artifact |
| 171 | + with: |
| 172 | + path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} |
| 173 | + name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} |
| 174 | + |
| 175 | + release: |
| 176 | + if: contains(github.ref, 'tags/v') |
| 177 | + runs-on: ubuntu-latest |
| 178 | + needs: build |
| 179 | + |
| 180 | + steps: |
| 181 | + - name: Create Release |
| 182 | + id: create_release |
| 183 | + uses: actions/create-release@v1.0.0 |
| 184 | + env: |
| 185 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 186 | + with: |
| 187 | + tag_name: ${{ github.ref }} |
| 188 | + release_name: Release ${{ github.ref }} |
| 189 | + draft: false |
| 190 | + prerelease: false |
| 191 | + |
| 192 | + - name: Store Release url |
| 193 | + run: | |
| 194 | + echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url |
| 195 | +
|
| 196 | + - uses: actions/upload-artifact@v1 |
| 197 | + with: |
| 198 | + path: ./upload_url |
| 199 | + name: upload_url |
| 200 | + |
| 201 | + publish: |
| 202 | + if: contains(github.ref, 'tags/v') |
| 203 | + |
| 204 | + name: ${{ matrix.config.name }} |
| 205 | + runs-on: ${{ matrix.config.os }} |
| 206 | + strategy: |
| 207 | + matrix: |
| 208 | + config: |
| 209 | + - { |
| 210 | + name: "Windows Latest x64", artifact: "Windows-x64.zip", |
| 211 | + os: ubuntu-latest |
| 212 | + } |
| 213 | + - { |
| 214 | + name: "Windows Latest x86", artifact: "Windows-x86.zip", |
| 215 | + os: ubuntu-latest |
| 216 | + } |
| 217 | + - { |
| 218 | + name: "Linux Latest x64", artifact: "Linux-x64.zip", |
| 219 | + os: ubuntu-latest |
| 220 | + } |
| 221 | + - { |
| 222 | + name: "macOS Latest x64", artifact: "macOS-x64.zip", |
| 223 | + os: macos-latest |
| 224 | + } |
| 225 | + needs: release |
| 226 | + |
| 227 | + steps: |
| 228 | + - name: Download artifact |
| 229 | + uses: actions/download-artifact@v1 |
| 230 | + with: |
| 231 | + name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} |
| 232 | + path: ./ |
| 233 | + |
| 234 | + - name: Download URL |
| 235 | + uses: actions/download-artifact@v1 |
| 236 | + with: |
| 237 | + name: upload_url |
| 238 | + path: ./ |
| 239 | + - id: set_upload_url |
| 240 | + run: | |
| 241 | + upload_url=`cat ./upload_url` |
| 242 | + echo ::set-output name=upload_url::$upload_url |
| 243 | +
|
| 244 | + - name: Upload to Release |
| 245 | + id: upload_to_release |
| 246 | + uses: actions/upload-release-asset@v1.0.1 |
| 247 | + env: |
| 248 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 249 | + with: |
| 250 | + upload_url: ${{ steps.set_upload_url.outputs.upload_url }} |
| 251 | + asset_path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} |
| 252 | + asset_name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} |
| 253 | + asset_content_type: application/zip |
0 commit comments