From f21d0b531f46f67ceb0569af08893882ddd506e3 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 9 Oct 2020 15:46:31 +0200 Subject: Fix github actions for Qt Creator plugin wizard For Qt Creator 4.13 - rename directory to 'workflows' - use MSVC 2019 for Qt - fix Qt Creator platform names - don't use GitHub's now deprected set-env Fixes: QTCREATORBUG-24412 Change-Id: Ifdd3e95da74fef4ad9f65ae2c084ff82b2ca1972 Reviewed-by: Alessandro Portale --- .../qtcreatorplugin/github_workflow_README.md | 41 --- .../github_workflow_build_qmake.yml | 320 --------------------- .../qtcreatorplugin/github_workflows_README.md | 41 +++ .../github_workflows_build_qmake.yml | 314 ++++++++++++++++++++ .../templates/wizards/qtcreatorplugin/myplugin.pro | 4 +- .../templates/wizards/qtcreatorplugin/wizard.json | 8 +- 6 files changed, 361 insertions(+), 367 deletions(-) delete mode 100644 share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_README.md delete mode 100644 share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_build_qmake.yml create mode 100644 share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md create mode 100644 share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_README.md b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_README.md deleted file mode 100644 index 8481ed15ae..0000000000 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_README.md +++ /dev/null @@ -1,41 +0,0 @@ -# GitHub Actions & Workflows - -The `build_qmake.yml` in this directory adds a [GitHub action][1] and workflow that builds -your plugin anytime you push commits to GitHub on Windows, Linux and macOS. - -The build artifacts can be downloaded from GitHub and be installed into an existing Qt Creator -installation. - -When you push a tag, the workflow also creates a new release on GitHub. - -## Keeping it up to date - -Near the top of the file you find a section starting with `env:`. - -The value for `QT_VERSION` specifies the Qt version to use for building the plugin. - -The value for `QT_CREATOR_VERSION` specifies the Qt Creator version to use for building the plugin. - -The value for `QT_CREATOR_SNAPSHOT` can either be `NO` or `latest` or the build ID of a specific -snapshot build for the Qt Creator version that you specified. - -You need to keep these values updated for different versions of your plugin, and take care -that the Qt version and Qt Creator version you specify are compatible. - -## What it does - -The build job consists of several steps: - -* Install required packages on the build host -* Download, unpack and install the binary for the Qt version -* Download and unpack the binary for the Qt Creator version -* Build the plugin and upload the plugin libraries to GitHub -* If a tag is pushed, create a release on GitHub for the tag, including zipped plugin libraries - for download - -## Limitations - -If your plugin requires additional resources besides the plugin library, you need to adapt the -script accordingly. - -[1]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-github-actions diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_build_qmake.yml b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_build_qmake.yml deleted file mode 100644 index 17ffdfe9bf..0000000000 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflow_build_qmake.yml +++ /dev/null @@ -1,320 +0,0 @@ -name: Build plugin - -on: [push] - -env: - QT_VERSION: %{JS: Util.qtVersion()} - QT_CREATOR_VERSION: %{JS: Util.qtCreatorVersion()} - QT_CREATOR_SNAPSHOT: NO - PLUGIN_PRO: %{ProFile} - PLUGIN_NAME: %{PluginName} - -jobs: - build: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} - strategy: - 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 - - - name: Installing system libs - shell: cmake -P {0} - run: | - if ("${{ runner.os }}" STREQUAL "Linux") - execute_process( - COMMAND sudo apt install libgl1-mesa-dev - ) - elseif ("${{ runner.os }}" STREQUAL "Windows") - # get JOM - file(DOWNLOAD "https://download.qt.io/official_releases/jom/jom.zip" ./jom.zip SHOW_PROGRESS) - file(MAKE_DIRECTORY ./jom) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../jom.zip WORKING_DIRECTORY ./jom) - endif() - - - name: Download Qt - id: qt - shell: cmake -P {0} - run: | - 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 "${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.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 - "${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/${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/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}") - - - name: Download Qt Creator - id: qt_creator - shell: cmake -P {0} - run: | - 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}/installer_source") - set(qtc_snapshot "$ENV{QT_CREATOR_SNAPSHOT}") - if (qtc_snapshot) - set(qtc_base_url "https://download.qt.io/snapshots/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}/installer_source/${qtc_snapshot}") - endif() - - 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 qtcreator_dev) - file(DOWNLOAD - "${qtc_base_url}/${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") - execute_process( - COMMAND ${CMAKE_COMMAND} -E make_directory qtcreator/bin - COMMAND ${CMAKE_COMMAND} -E create_symlink - "$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app" - "$ENV{GITHUB_WORKSPACE}/qtcreator/bin/Qt Creator.app" - ) - endif() - - - name: Configure - shell: cmake -P {0} - run: | - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") - execute_process( - COMMAND "${{ matrix.config.environment_script }}" && set - OUTPUT_FILE environment_script_output.txt - ) - 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}") - - # 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 ${{ steps.qt.outputs.qt_dir }}/bin/qmake - $ENV{PLUGIN_PRO} - CONFIG+=release - IDE_SOURCE_TREE="${qtcreator_dir}" - IDE_BUILD_TREE="${qtcreator_dir}" - RESULT_VARIABLE result - ) - if (NOT result EQUAL 0) - message(FATAL_ERROR "Bad exit status") - endif() - - - name: Build - shell: cmake -P {0} - run: | - if ("${{ runner.os }}" STREQUAL "Windows") - set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}") - else() - 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() - - include(ProcessorCount) - ProcessorCount(N) - - set(make_program make -j ${N}) - if ("${{ runner.os }}" STREQUAL "Windows") - set(make_program "jom/jom") - endif() - - execute_process( - COMMAND ${make_program} - RESULT_VARIABLE result - ) - if (NOT result EQUAL 0) - message(FATAL_ERROR "Bad exit status") - 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: ./${{ 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') - runs-on: ubuntu-latest - needs: build - - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - - - name: Store Release url - run: | - echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url - - - uses: actions/upload-artifact@v1 - with: - path: ./upload_url - name: upload_url - - publish: - if: contains(github.ref, 'tags/v') - - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} - strategy: - 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: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} - path: ./ - - - name: Download URL - uses: actions/download-artifact@v1 - with: - name: upload_url - path: ./ - - id: set_upload_url - run: | - upload_url=`cat ./upload_url` - echo ::set-output name=upload_url::$upload_url - - - name: Upload to Release - id: upload_to_release - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.set_upload_url.outputs.upload_url }} - 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 diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md new file mode 100644 index 0000000000..8481ed15ae --- /dev/null +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md @@ -0,0 +1,41 @@ +# GitHub Actions & Workflows + +The `build_qmake.yml` in this directory adds a [GitHub action][1] and workflow that builds +your plugin anytime you push commits to GitHub on Windows, Linux and macOS. + +The build artifacts can be downloaded from GitHub and be installed into an existing Qt Creator +installation. + +When you push a tag, the workflow also creates a new release on GitHub. + +## Keeping it up to date + +Near the top of the file you find a section starting with `env:`. + +The value for `QT_VERSION` specifies the Qt version to use for building the plugin. + +The value for `QT_CREATOR_VERSION` specifies the Qt Creator version to use for building the plugin. + +The value for `QT_CREATOR_SNAPSHOT` can either be `NO` or `latest` or the build ID of a specific +snapshot build for the Qt Creator version that you specified. + +You need to keep these values updated for different versions of your plugin, and take care +that the Qt version and Qt Creator version you specify are compatible. + +## What it does + +The build job consists of several steps: + +* Install required packages on the build host +* Download, unpack and install the binary for the Qt version +* Download and unpack the binary for the Qt Creator version +* Build the plugin and upload the plugin libraries to GitHub +* If a tag is pushed, create a release on GitHub for the tag, including zipped plugin libraries + for download + +## Limitations + +If your plugin requires additional resources besides the plugin library, you need to adapt the +script accordingly. + +[1]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-github-actions diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml new file mode 100644 index 0000000000..5326dfeb9d --- /dev/null +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml @@ -0,0 +1,314 @@ +name: Build plugin + +on: [push] + +env: + QT_VERSION: %{JS: Util.qtVersion()} + QT_CREATOR_VERSION: %{JS: Util.qtCreatorVersion()} + QT_CREATOR_SNAPSHOT: NO + PLUGIN_PRO: %{ProFile} + PLUGIN_NAME: %{PluginName} + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + 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 + + - name: Installing system libs + shell: cmake -P {0} + run: | + if ("${{ runner.os }}" STREQUAL "Linux") + execute_process( + COMMAND sudo apt install libgl1-mesa-dev + ) + elseif ("${{ runner.os }}" STREQUAL "Windows") + # get JOM + file(DOWNLOAD "https://download.qt.io/official_releases/jom/jom.zip" ./jom.zip SHOW_PROGRESS) + file(MAKE_DIRECTORY ./jom) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../jom.zip WORKING_DIRECTORY ./jom) + endif() + + - name: Download Qt + id: qt + shell: cmake -P {0} + run: | + 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_msvc2019_64") + set(qt_dir_prefix "${qt_version}/msvc2019_64") + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2019") + set(qt_dir_prefix "${qt_version}/msvc2019") + 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 "${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.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 + "${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/${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/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}") + + - name: Download Qt Creator + id: qt_creator + shell: cmake -P {0} + run: | + 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}/installer_source") + set(qtc_snapshot "$ENV{QT_CREATOR_SNAPSHOT}") + if (qtc_snapshot) + set(qtc_base_url "https://download.qt.io/snapshots/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}/installer_source/${qtc_snapshot}") + endif() + + 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_x64") + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + set(qtc_platform "windows_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_x64") + 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 qtcreator_dev) + file(DOWNLOAD + "${qtc_base_url}/${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") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory qtcreator/bin + COMMAND ${CMAKE_COMMAND} -E create_symlink + "$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app" + "$ENV{GITHUB_WORKSPACE}/qtcreator/bin/Qt Creator.app" + ) + endif() + + - name: Build + shell: cmake -P {0} + run: | + if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") + execute_process( + COMMAND "${{ matrix.config.environment_script }}" && set + OUTPUT_FILE environment_script_output.txt + ) + 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() + + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir) + + execute_process( + COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake + $ENV{PLUGIN_PRO} + CONFIG+=release + IDE_SOURCE_TREE="${qtcreator_dir}" + IDE_BUILD_TREE="${qtcreator_dir}" + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Bad exit status") + endif() + + if ("${{ runner.os }}" STREQUAL "Windows") + set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}") + else() + 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() + + include(ProcessorCount) + ProcessorCount(N) + + set(make_program make -j ${N}) + if ("${{ runner.os }}" STREQUAL "Windows") + set(make_program "jom/jom") + endif() + + execute_process( + COMMAND ${make_program} + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Bad exit status") + 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: ./${{ 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') + runs-on: ubuntu-latest + needs: build + + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Store Release url + run: | + echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url + + - uses: actions/upload-artifact@v1 + with: + path: ./upload_url + name: upload_url + + publish: + if: contains(github.ref, 'tags/v') + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + 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: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + path: ./ + + - name: Download URL + uses: actions/download-artifact@v1 + with: + name: upload_url + path: ./ + - id: set_upload_url + run: | + upload_url=`cat ./upload_url` + echo ::set-output name=upload_url::$upload_url + + - name: Upload to Release + id: upload_to_release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.set_upload_url.outputs.upload_url }} + 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 diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro index 82328264a7..34eed0aeea 100644 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro @@ -11,8 +11,8 @@ HEADERS += \\ %{ConstantsHdrFileName} DISTFILES += \\ - .github/workflow/build_qmake.yml \\ - .github/workflow/README.md + .github/workflows/build_qmake.yml \\ + .github/workflows/README.md # Qt Creator linking diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json b/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json index cbaca648fe..443fa25c25 100644 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json @@ -190,12 +190,12 @@ "openAsProject": true }, { - "source": "github_workflow_build_qmake.yml", - "target": ".github/workflow/build_qmake.yml" + "source": "github_workflows_build_qmake.yml", + "target": ".github/workflows/build_qmake.yml" }, { - "source": "github_workflow_README.md", - "target": ".github/workflow/README.md" + "source": "github_workflows_README.md", + "target": ".github/workflows/README.md" }, { "source": "myplugin.cpp", -- cgit v1.2.3 From fb0db5c745bc6fe4885afd11750e267f89cf99da Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 19 Oct 2020 18:26:20 +0200 Subject: ProjectExplorer: Fix sorting predicate to have a strict weak order Fixes random crashes when opening the 'Manage session' dialog. Amends 8c0906e8fb632b82135a843657a1df9216a93c60 Fixes: QTCREATORBUG-24797 Change-Id: Ic3118163d1a9a10eacc1ea1cc90f54c86ac790d9 Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/sessionmodel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/sessionmodel.cpp b/src/plugins/projectexplorer/sessionmodel.cpp index b0d847e7df..4cfa95eea5 100644 --- a/src/plugins/projectexplorer/sessionmodel.cpp +++ b/src/plugins/projectexplorer/sessionmodel.cpp @@ -183,10 +183,18 @@ void SessionModel::sort(int column, Qt::SortOrder order) beginResetModel(); const auto cmp = [column, order](const QString &s1, const QString &s2) { bool isLess; - if (column == 0) + if (column == 0) { + if (s1 == s2) + return false; isLess = s1 < s2; - else - isLess = SessionManager::sessionDateTime(s1) < SessionManager::sessionDateTime(s2); + } + else { + const auto s1time = SessionManager::sessionDateTime(s1); + const auto s2time = SessionManager::sessionDateTime(s2); + if (s1time == s2time) + return false; + isLess = s1time < s2time; + } if (order == Qt::DescendingOrder) isLess = !isLess; return isLess; -- cgit v1.2.3 From 15c9de9251af76fdfd6798ad35d7d912deb99644 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 12 Oct 2020 19:50:24 +0200 Subject: Squish: Update tst_codepasting Change-Id: Ie908f0af267f420e107c06ae039bb085462f945d Reviewed-by: Christian Stenger --- tests/system/suite_tools/tst_codepasting/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index a5441050a9..37b9832c3a 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -239,7 +239,7 @@ def main(): clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) continue test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") - if protocol in (NAME_PBCOM, NAME_DPCOM) and pastedText.endswith("\n"): + if protocol in (NAME_DPCOM) and pastedText.endswith("\n"): pastedText = pastedText[:-1] test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same") -- cgit v1.2.3