diff --git a/.github/workflows/build_qmake.yml b/.github/workflows/build_qmake.yml index 348d1be..7d0506d 100644 --- a/.github/workflows/build_qmake.yml +++ b/.github/workflows/build_qmake.yml @@ -2,58 +2,37 @@ name: QMake Build Matrix on: [push] +env: + QT_VERSION: 5.14.0 + QT_CREATOR_VERSION: 4.11.0 + PLUGIN_PRO: doxygen.pro + PLUGIN_NAME: Doxygen + jobs: build: + name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} strategy: - matrix: - config: - - { - artifact: "Doxygen-4.11.0-x64.dll", - os: windows-latest, - environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", - - qt-base-url: "https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5140", - qt-package-name: "qt.qt5.5140.win64_msvc2017_64", - qt-dir-prefix: "5.14.0/msvc2017_64", - qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0", - qtc-platform: "windows_msvc2017_x64", - qtc-source: "qt-creator-opensource-src-4.11.0" - } - - { - artifact: "Doxygen-4.11.0-x86.dll", - os: windows-latest, - environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat", - - qt-base-url: "https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5140", - qt-package-name: "qt.qt5.5140.win32_msvc2017", - qt-dir-prefix: "5.14.0/msvc2017", - qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0", - qtc-platform: "windows_msvc2017_x86", - qtc-source: "qt-creator-opensource-src-4.11.0" - } - - { - artifact: "libDoxygen-4.11.0-x64.so", - os: ubuntu-latest, - - qt-base-url: "https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_5140", - qt-package-name: "qt.qt5.5140.gcc_64", - qt-dir-prefix: "5.14.0/gcc_64", - qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0", - qtc-platform: "linux_gcc_64_rhel72", - qtc-source: "qt-creator-opensource-src-4.11.0" - } - - { - artifact: "libDoxygen-4.11.0-x64.dylib", - os: macos-latest, - - qt-base-url: "https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt5_5140", - qt-package-name: "qt.qt5.5140.clang_64", - qt-dir-prefix: "5.14.0/clang_64", - qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0", - qtc-platform: "mac_x64", - qtc-source: "qt-creator-opensource-src-4.11.0" - } + matrix: + config: + - { + name: "Windows Latest x64", artifact: "Windows-x64.zip", + os: windows-latest, + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" + } + - { + name: "Windows Latest x86", artifact: "Windows-x86.zip", + os: windows-latest, + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat" + } + - { + name: "Linux Latest x64", artifact: "Linux-x64.zip", + os: ubuntu-latest + } + - { + name: "macOS Latest x64", artifact: "macOS-x64.zip", + os: macos-latest + } steps: - uses: actions/checkout@v1 @@ -68,47 +47,104 @@ jobs: endif() - name: Download Qt + id: qt shell: cmake -P {0} run: | - file(DOWNLOAD "${{ matrix.config.qt-base-url }}/Updates.xml" ./Updates.xml SHOW_PROGRESS) + set(qt_version $ENV{QT_VERSION}) + + string(REPLACE "." "" qt_version_dotless "${qt_version}") + if ("${{ runner.os }}" STREQUAL "Windows") + set(url_os "windows_x86") + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") + set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2017_64") + set(qt_dir_prefix "${qt_version}/msvc2017_64") + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2017") + set(qt_dir_prefix "${qt_version}/msvc2017") + else() + endif() + elseif ("${{ runner.os }}" STREQUAL "Linux") + set(url_os "linux_x64") + set(qt_package_name "qt.qt5.${qt_version_dotless}.gcc_64") + set(qt_dir_prefix "${qt_version}/gcc_64") + elseif ("${{ runner.os }}" STREQUAL "macOS") + set(url_os "mac_x64") + set(qt_package_name "qt.qt5.${qt_version_dotless}.clang_64") + set(qt_dir_prefix "${qt_version}/clang_64") + endif() + + set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}") + file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS) file(READ ./Updates.xml updates_xml) - string(REGEX MATCH "${{ matrix.config.qt-package-name }}.*([0-9+-.]+).*qtbase([a-zA-Z0-9_-]+).7z" + string(REGEX MATCH "${qt_package_name}.*([0-9+-.]+).*qtbase([a-zA-Z0-9_-]+).7z" updates_xml_output "${updates_xml}") set(package_version ${CMAKE_MATCH_1}) set(package_suffix ${CMAKE_MATCH_2}) string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}") # Workaround for CMake's greedy regex - if ("${{ matrix.config.qt-package-name }}" MATCHES "win32") + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") string(REPLACE "X86_64" "X86" package_suffix "${package_suffix}") endif() file(MAKE_DIRECTORY qt5) + # Save the path for other steps + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir) + message("::set-output name=qt_dir::${qt_dir}") + foreach(package qtbase qtdeclarative qttools qtsvg) - file(DOWNLOAD "${{ matrix.config.qt-base-url }}/${{ matrix.config.qt-package-name }}/${package_version}${package}${package_suffix}.7z" ./${package}.7z SHOW_PROGRESS) + file(DOWNLOAD + "${qt_base_url}/${qt_package_name}/${package_version}${package}${package_suffix}.7z" ./${package}.7z + SHOW_PROGRESS + ) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qt5) endforeach() - file(READ "qt5/${{ matrix.config.qt-dir-prefix }}/mkspecs/qconfig.pri" qtconfig) + file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig) string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}") string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}") string(REPLACE "licheck64" "" qtconfig "${qtconfig}") string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}") - file(WRITE "qt5/${{ matrix.config.qt-dir-prefix }}/mkspecs/qconfig.pri" "${qtconfig}") + file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}") - name: Download Qt Creator + id: qt_creator shell: cmake -P {0} run: | - file(DOWNLOAD "${{ matrix.config.qtc-base-url }}/${{ matrix.config.qtc-source }}" ./qtcreator_src.7z SHOW_PROGRESS) - file(DOWNLOAD "${{ matrix.config.qtc-base-url }}/installer_source/${{ matrix.config.qtc-platform }}/qtcreator.7z" ./qtcreator.7z SHOW_PROGRESS) - file(DOWNLOAD "${{ matrix.config.qtc-base-url }}/installer_source/${{ matrix.config.qtc-platform }}/qtcreator_dev.7z" ./qtcreator_dev.7z SHOW_PROGRESS) + string(REGEX MATCH "([0-9]+.[0-9]+).[0-9]+" outvar "$ENV{QT_CREATOR_VERSION}") + set(qtc_base_url "https://download.qt.io/official_releases/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}") + + if ("${{ runner.os }}" STREQUAL "Windows") + set(qtc_output_directory "qtcreator/lib/qtcreator/plugins") + set(qtc_binary_name "$ENV{PLUGIN_NAME}4.dll") + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") + set(qtc_platform "windows_msvc2017_x64") + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + set(qtc_platform "windows_msvc2017_x86") + endif() + elseif ("${{ runner.os }}" STREQUAL "Linux") + set(qtc_output_directory "qtcreator/lib/qtcreator/plugins") + set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.so") + set(qtc_platform "linux_gcc_64_rhel72") + elseif ("${{ runner.os }}" STREQUAL "macOS") + set(qtc_output_directory "qtcreator/bin/Qt Creator.app/Contents/PlugIns") + set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.dylib") + set(qtc_platform "mac_x64") + endif() + + # Save the path for other steps + message("::set-output name=qtc_binary_name::${qtc_binary_name}") + message("::set-output name=qtc_output_directory::${qtc_output_directory}") file(MAKE_DIRECTORY qtcreator) - foreach(package qtcreator_src qtcreator qtcreator_dev) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator) + foreach(package qtcreator qtcreator_dev) + file(DOWNLOAD + "${qtc_base_url}/installer_source/${qtc_platform}/${package}.7z" ./${package}.7z SHOW_PROGRESS) + execute_process(COMMAND + ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator) endforeach() if ("${{ runner.os }}" STREQUAL "macOS") @@ -132,16 +168,21 @@ jobs: foreach(line IN LISTS output_lines) if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") + + # Set for other steps + message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}") endif() endforeach() endif() + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir) + execute_process( - COMMAND qt5/${{ matrix.config.qt-dir-prefix }}/bin/qmake - doxygen.pro + COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake + $ENV{PLUGIN_PRO} CONFIG+=release - QTC_SOURCE="$ENV{GITHUB_WORKSPACE}/qtcreator" - QTC_BUILD="$ENV{GITHUB_WORKSPACE}/qtcreator" + QTC_SOURCE="${qtcreator_dir}" + QTC_BUILD="${qtcreator_dir}" RESULT_VARIABLE result ) if (NOT result EQUAL 0) @@ -151,20 +192,10 @@ jobs: - name: Build shell: cmake -P {0} run: | - - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") - file(STRINGS environment_script_output.txt output_lines) - foreach(line IN LISTS output_lines) - if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") - set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") - endif() - endforeach() - endif() - if ("${{ runner.os }}" STREQUAL "Windows") - set(ENV{PATH} "qt5/${{ matrix.config.qt-dir-prefix }}/bin/;$ENV{PATH}") + set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}") else() - set(ENV{PATH} "qt5/${{ matrix.config.qt-dir-prefix }}/bin/:$ENV{PATH}") + set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/:$ENV{PATH}") set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}") endif() @@ -184,18 +215,18 @@ jobs: message(FATAL_ERROR "Bad exit status") endif() - if ("${{ runner.os }}" STREQUAL "Windows") - execute_process(COMMAND ${CMAKE_COMMAND} -E rename qtcreator/lib/qtcreator/plugins/Doxygen4.dll ${{ matrix.config.artifact }}) - elseif ("${{ runner.os }}" STREQUAL "Linux") - execute_process(COMMAND ${CMAKE_COMMAND} -E rename qtcreator/lib/qtcreator/plugins/libDoxygen.so ${{ matrix.config.artifact }}) - elseif ("${{ runner.os }}" STREQUAL "macOS") - execute_process(COMMAND ${CMAKE_COMMAND} -E rename "qtcreator/bin/Qt Creator.app/Contents/PlugIns/libDoxygen.dylib" ${{ matrix.config.artifact }}) - endif() + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact) + + execute_process(COMMAND + ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}" + WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}" + ) - uses: actions/upload-artifact@v1 + id: upload_artifact with: - path: ./${{ matrix.config.artifact }} - name: ${{ matrix.config.artifact }} + path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} release: if: contains(github.ref, 'tags/v') @@ -225,33 +256,35 @@ jobs: publish: if: contains(github.ref, 'tags/v') + + name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} strategy: - matrix: - config: - - { - artifact: "Doxygen-4.11.0-x64.dll", - os: ubuntu-latest - } - - { - artifact: "Doxygen-4.11.0-x86.dll", - os: ubuntu-latest - } - - { - artifact: "libDoxygen-4.11.0-x64.so", - os: ubuntu-latest - } - - { - artifact: "libDoxygen-4.11.0-x64.dylib", - os: ubuntu-latest - } + matrix: + config: + - { + name: "Windows Latest x64", artifact: "Windows-x64.zip", + os: ubuntu-latest + } + - { + name: "Windows Latest x86", artifact: "Windows-x86.zip", + os: ubuntu-latest + } + - { + name: "Linux Latest x64", artifact: "Linux-x64.zip", + os: ubuntu-latest + } + - { + name: "macOS Latest x64", artifact: "macOS-x64.zip", + os: macos-latest + } needs: release steps: - name: Download artifact uses: actions/download-artifact@v1 with: - name: ${{ matrix.config.artifact }} + name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} path: ./ - name: Download URL @@ -271,6 +304,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.set_upload_url.outputs.upload_url }} - asset_path: ./${{ matrix.config.artifact }} - asset_name: ${{ matrix.config.artifact }} - asset_content_type: application/x-gtar + asset_path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + asset_name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + asset_content_type: application/zip