"Fossies" - the Fresh Open Source Software Archive

Member "qt-creator-opensource-src-4.15.1/.github/workflows/build_cmake.yml" (8 Jun 2021, 27711 Bytes) of package /linux/misc/qt-creator-opensource-src-4.15.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ansible YAML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "build_cmake.yml": opensource-src-4.15.0_vs_opensource-src-4.15.1.

    1 name: CMake Build Matrix
    2 
    3 on: [push, pull_request]
    4 
    5 env:
    6   QT_VERSION: 5.15.2
    7   CLANG_VERSION: 110
    8   ELFUTILS_VERSION: 0.175
    9   CMAKE_VERSION: 3.18.3
   10   NINJA_VERSION: 1.10.1
   11   BUILD_TYPE: Release
   12   CCACHE_VERSION: 4.2.1
   13   QT_MIRRORS: download.qt.io;mirrors.ocf.berkeley.edu/qt;ftp.fau.de/qtproject;mirror.bit.edu.cn/qtproject
   14 
   15 jobs:
   16   build:
   17     name: ${{ matrix.config.name }}
   18     runs-on: ${{ matrix.config.os }}
   19     strategy:
   20       fail-fast: false
   21       matrix:
   22         config:
   23         - {
   24             name: "Windows Latest MSVC", artifact: "Windows-MSVC",
   25             os: windows-latest,
   26             cc: "cl", cxx: "cl",
   27             environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
   28             is_msvc: true
   29           }
   30         - {
   31             name: "Windows Latest MinGW", artifact: "Windows-MinGW",
   32             os: windows-latest,
   33             cc: "gcc", cxx: "g++",
   34             is_msvc: false
   35           }
   36         - {
   37             name: "Ubuntu Latest GCC", artifact: "Linux",
   38             os: ubuntu-20.04,
   39             cc: "gcc", cxx: "g++"
   40           }
   41         - {
   42             name: "macOS Latest Clang", artifact: "macOS",
   43             os: macos-latest,
   44             cc: "clang", cxx: "clang++"
   45           }
   46 
   47     steps:
   48     - uses: actions/checkout@v2
   49     - name: Checkout submodules
   50       run: |
   51         git submodule set-url -- perfparser https://code.qt.io/qt-creator/perfparser.git
   52         git submodule update --init --recursive
   53 
   54     - name: Download Ninja and CMake
   55       shell: cmake -P {0}
   56       run: |
   57         set(cmake_version "$ENV{CMAKE_VERSION}")
   58         set(ninja_version "$ENV{NINJA_VERSION}")
   59 
   60         if ("${{ runner.os }}" STREQUAL "Windows")
   61           set(ninja_suffix "win.zip")
   62           set(cmake_suffix "win64-x64.zip")
   63           set(cmake_dir "cmake-${cmake_version}-win64-x64/bin")
   64         elseif ("${{ runner.os }}" STREQUAL "Linux")
   65           set(ninja_suffix "linux.zip")
   66           set(cmake_suffix "Linux-x86_64.tar.gz")
   67           set(cmake_dir "cmake-${cmake_version}-Linux-x86_64/bin")
   68         elseif ("${{ runner.os }}" STREQUAL "macOS")
   69           set(ninja_suffix "mac.zip")
   70           set(cmake_suffix "Darwin-x86_64.tar.gz")
   71           set(cmake_dir "cmake-${cmake_version}-Darwin-x86_64/CMake.app/Contents/bin")
   72         endif()
   73 
   74         set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}")
   75         file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
   76         execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
   77 
   78         set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}")
   79         file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS)
   80         execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip)
   81 
   82         # Add to PATH environment variable
   83         file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir)
   84         set(path_separator ":")
   85         if ("${{ runner.os }}" STREQUAL "Windows")
   86           set(path_separator ";")
   87         endif()
   88         file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${cmake_dir}")
   89 
   90         if (NOT "${{ runner.os }}" STREQUAL "Windows")
   91           execute_process(
   92             COMMAND chmod +x ninja
   93             COMMAND chmod +x ${cmake_dir}/cmake
   94           )
   95         endif()
   96 
   97     - name: Download Qt
   98       id: qt
   99       shell: cmake -P {0}
  100       run: |
  101         set(qt_version "$ENV{QT_VERSION}")
  102 
  103         string(REPLACE "." "" qt_version_dotless "${qt_version}")
  104         if ("${{ runner.os }}" STREQUAL "Windows")
  105           set(url_os "windows_x86")
  106           if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
  107             set(qt_package_arch_suffix "win64_mingw81")
  108             set(qt_dir_prefix "${qt_version}/mingw81_64")
  109             set(qt_package_suffix "-Windows-Windows_10-Mingw-Windows-Windows_10-X86_64")
  110           elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
  111             set(qt_package_arch_suffix "win64_msvc2019_64")
  112             set(qt_dir_prefix "${qt_version}/msvc2019_64")
  113             set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64")
  114           elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
  115             set(qt_package_arch_suffix "win32_msvc2019")
  116             set(qt_dir_prefix "${qt_version}/msvc2019")
  117             set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86")
  118           endif()
  119         elseif ("${{ runner.os }}" STREQUAL "Linux")
  120           set(url_os "linux_x64")
  121           set(qt_package_arch_suffix "gcc_64")
  122           set(qt_dir_prefix "${qt_version}/gcc_64")
  123           set(qt_package_suffix "-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64")
  124         elseif ("${{ runner.os }}" STREQUAL "macOS")
  125           set(url_os "mac_x64")
  126           set(qt_package_arch_suffix "clang_64")
  127           set(qt_dir_prefix "${qt_version}/clang_64")
  128           set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64")
  129         endif()
  130 
  131         set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}")
  132         foreach(qt_mirror $ENV{QT_MIRRORS})
  133           cmake_language(EVAL CODE "
  134             message(\"Downloading: ${qt_base_url}/Updates.xml\")
  135             file(DOWNLOAD \"${qt_base_url}/Updates.xml\" ./Updates.xml)
  136           ")
  137           file(SIZE ./Updates.xml fileSize)
  138           if (fileSize GREATER 0)
  139             break()
  140           endif()
  141         endforeach()
  142 
  143         file(READ ./Updates.xml updates_xml)
  144         string(REGEX MATCH "<Name>qt.qt5.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}")
  145         set(qt_package_version ${CMAKE_MATCH_1})
  146 
  147         file(MAKE_DIRECTORY qt5)
  148 
  149         # Save the path for other steps
  150         file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir)
  151         message("::set-output name=qt_dir::${qt_dir}")
  152 
  153         function(downloadAndExtract url archive)
  154           foreach(qt_mirror $ENV{QT_MIRRORS})
  155             cmake_language(EVAL CODE "
  156               message(\"Downloading ${url}\")
  157               file(DOWNLOAD \"${url}\" ./${archive})
  158             ")
  159             file(SIZE ./${archive} fileSize)
  160             if (fileSize GREATER 0)
  161               break()
  162             endif()
  163           endforeach()
  164           execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt5)
  165         endfunction()
  166 
  167         foreach(package qtbase qtdeclarative qttools qtsvg qtserialport qtquickcontrols qtquickcontrols2 qtgraphicaleffects qtlocation qtimageformats qttranslations)
  168           downloadAndExtract(
  169             "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
  170             ${package}.7z
  171           )
  172         endforeach()
  173 
  174         foreach(package qtquicktimeline qtquick3d qtscript)
  175           downloadAndExtract(
  176             "${qt_base_url}/qt.qt5.${qt_version_dotless}.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
  177             ${package}.7z
  178           )
  179         endforeach()
  180 
  181         # uic depends on libicu56.so
  182         if ("${{ runner.os }}" STREQUAL "Linux")
  183           downloadAndExtract(
  184             "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z"
  185             icu.7z
  186           )
  187         endif()
  188 
  189         file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig)
  190         string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
  191         string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
  192         string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
  193         string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
  194         file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
  195 
  196         if ("${{ runner.os }}" STREQUAL "Windows")
  197           # deploy "system" runtimes into Qt, so they get deployed as well
  198           if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
  199             # deploy MinGW
  200             foreach(file libwinpthread-1.dll libstdc++-6.dll libgcc_s_seh-1.dll)
  201               file(INSTALL "C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/${file}"
  202                    DESTINATION "qt5/${qt_dir_prefix}/bin"
  203                    USE_SOURCE_PERMISSIONS)
  204             endforeach()
  205           else()
  206             # deploy MSVC
  207             foreach(file vcruntime140.dll concrt140.dll msvcp140_1.dll msvcp140_2.dll
  208                          msvcp140_codecvt_ids.dll vcruntime140_1.dll msvcp140.dll)
  209               file(INSTALL "C:/Windows/System32/${file}"
  210                    DESTINATION "qt5/${qt_dir_prefix}/bin")
  211             endforeach()
  212           endif()
  213         endif()
  214 
  215     - name: Download OpenSSL
  216       shell: cmake -P {0}
  217       run: |
  218         if ("${{ runner.os }}" STREQUAL "Windows")
  219           set(url_os "windows_x86")
  220           set(openssl_localdir "Tools/OpenSSL/Win_x64/bin")
  221           set(openssl_dest_dir "${{ steps.qt.outputs.qt_dir }}/bin")
  222           set(shared_suffix ".dll")
  223         elseif ("${{ runner.os }}" STREQUAL "Linux")
  224           set(url_os "linux_x64")
  225           set(openssl_localdir "Tools/OpenSSL/binary/lib")
  226           set(openssl_dest_dir "${{ steps.qt.outputs.qt_dir }}/lib/Qt/lib")
  227           set(shared_suffix ".so*")
  228         elseif ("${{ runner.os }}" STREQUAL "macOS")
  229           # Not needed on macOS
  230           return()
  231         endif()
  232 
  233         set(openssl_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/tools_openssl_x64")
  234         foreach(qt_mirror $ENV{QT_MIRRORS})
  235           cmake_language(EVAL CODE "
  236             message(\"Downloading ${openssl_base_url}/Updates.xml}\")
  237             file(DOWNLOAD \"${openssl_base_url}/Updates.xml\" ./Updates.xml)
  238           ")
  239           file(SIZE ./Updates.xml fileSize)
  240           if (fileSize GREATER 0)
  241             break()
  242           endif()
  243         endforeach()
  244 
  245         file(READ ./Updates.xml updates_xml)
  246         string(REGEX MATCH
  247           "<Name>(qt.tools.openssl.*)</Name>.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>(.*)</DownloadableArchives>" updates_xml_output "${updates_xml}")
  248 
  249         set(openssl_directory ${CMAKE_MATCH_1})
  250         set(openssl_version ${CMAKE_MATCH_2})
  251         set(openssl_archive ${CMAKE_MATCH_3})
  252 
  253         set(url "${openssl_base_url}/${openssl_directory}/${openssl_version}${openssl_archive}")
  254 
  255         file(MAKE_DIRECTORY openssl)
  256         file(MAKE_DIRECTORY ${openssl_dest_dir})
  257 
  258         foreach(qt_mirror $ENV{QT_MIRRORS})
  259           cmake_language(EVAL CODE "
  260             message(\"Downloading ${url}\")
  261             file(DOWNLOAD \"${url}\" ./openssl.7z)
  262           ")
  263           file(SIZE ./openssl.7z fileSize)
  264           if (fileSize GREATER 0)
  265             break()
  266           endif()
  267         endforeach()
  268         execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../openssl.7z WORKING_DIRECTORY openssl)
  269 
  270         file(GLOB openssl_shared_objects "openssl/${openssl_localdir}/*${shared_suffix}")
  271         execute_process(
  272           COMMAND ${CMAKE_COMMAND} -E copy ${openssl_shared_objects} ${openssl_dest_dir})
  273 
  274     - name: Download libclang
  275       id: libclang
  276       shell: cmake -P {0}
  277       run: |
  278         set(clang_version "$ENV{CLANG_VERSION}")
  279 
  280         if ("${{ runner.os }}" STREQUAL "Windows")
  281           if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
  282             set(libclang "libclang-release_${clang_version}-based-windows-mingw_64.7z")
  283           elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
  284             set(libclang "libclang-release_${clang_version}-based-windows-vs2019_64.7z")
  285           elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
  286             set(libclang "libclang-release_${clang_version}-based-windows-vs2019_32.7z")
  287           endif()
  288         elseif ("${{ runner.os }}" STREQUAL "Linux")
  289           set(libclang "libclang-release_${clang_version}-based-linux-Ubuntu20.04-gcc9.3-x86_64.7z")
  290         elseif ("${{ runner.os }}" STREQUAL "macOS")
  291           set(libclang "libclang-release_${clang_version}-based-mac.7z")
  292         endif()
  293 
  294         set(libclang_url "https://\${qt_mirror}/development_releases/prebuilt/libclang/${libclang}")
  295         foreach(qt_mirror $ENV{QT_MIRRORS})
  296           cmake_language(EVAL CODE "
  297             message(\"Downloading ${libclang_url}\")
  298             file(DOWNLOAD \"${libclang_url}\" ./libclang.7z)
  299           ")
  300           file(SIZE ./libclang.7z fileSize)
  301           if (fileSize GREATER 0)
  302             break()
  303           endif()
  304         endforeach()
  305 
  306         # Comes with libclang inside the archive
  307         execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./libclang.7z)
  308 
  309         # Save the path for other steps
  310         file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/libclang" libclang_dir)
  311         message("::set-output name=libclang_dir::${libclang_dir}")
  312 
  313     - name: Download elfutils
  314       if: runner.os == 'Windows' && matrix.config.is_msvc || runner.os == 'Linux'
  315       id: elfutils
  316       shell: cmake -P {0}
  317       run: |
  318         set(elfutils_version "$ENV{ELFUTILS_VERSION}")
  319 
  320         if ("${{ runner.os }}" STREQUAL "Windows")
  321           if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
  322             set(elfutils "elfutils-release_${elfutils_version}qt-windows-x86_64.7z")
  323           elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
  324             set(elfutils "elfutils-release_${elfutils_version}qt-windows-i686.7z")
  325           endif()
  326         elseif ("${{ runner.os }}" STREQUAL "Linux")
  327           set(elfutils "elfutils-release_${elfutils_version}qt-linux-x86_64.7z")
  328         endif()
  329 
  330         set(elfutils_url "https://\${qt_mirror}/development_releases/prebuilt/elfutils/${elfutils}")
  331 
  332         foreach(qt_mirror $ENV{QT_MIRRORS})
  333           cmake_language(EVAL CODE "
  334             message(\"Downloading ${elfutils_url}\")
  335             file(DOWNLOAD \"${elfutils_url}\" ./elfutils.7z)
  336           ")
  337           file(SIZE ./elfutils.7z fileSize)
  338           if (fileSize GREATER 0)
  339             break()
  340           endif()
  341         endforeach()
  342         file(MAKE_DIRECTORY elfutils)
  343         execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../elfutils.7z WORKING_DIRECTORY elfutils)
  344 
  345         # Save the path for other steps
  346         file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/elfutils" elfutils_dir)
  347         message("::set-output name=elfutils_dir::${elfutils_dir}")
  348 
  349     - name: Download ccache
  350       id: ccache
  351       shell: cmake -P {0}
  352       run: |
  353         set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_VERSION}/${{ runner.os }}.tar.xz")
  354         file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS)
  355         execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz)
  356 
  357     - name: Prepare ccache timestamp
  358       id: ccache_cache_timestamp
  359       shell: cmake -P {0}
  360       run: |
  361         string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
  362         message("::set-output name=timestamp::${current_date}")
  363 
  364     - name: ccache cache files
  365       uses: actions/cache@v1.1.0
  366       with:
  367         path: .ccache
  368         key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
  369         restore-keys: |
  370           ${{ matrix.config.name }}-ccache-
  371 
  372     - name: Install system libs
  373       shell: cmake -P {0}
  374       run: |
  375         if ("${{ runner.os }}" STREQUAL "Linux")
  376           execute_process(
  377             COMMAND sudo apt update
  378           )
  379           execute_process(
  380             COMMAND sudo apt install libgl1-mesa-dev
  381             RESULT_VARIABLE result
  382           )
  383           if (NOT result EQUAL 0)
  384             message(FATAL_ERROR "Failed to install dependencies")
  385           endif()
  386         endif()
  387         find_package(Python3 REQUIRED COMPONENTS Interpreter)
  388         # hack to replace 32-bit python found by this script with 64-bit one
  389         # required for linking qtcreatorcdbext
  390         string(REPLACE "x86" "x64" Python3_EXECUTABLE "${Python3_EXECUTABLE}")
  391         execute_process(
  392           COMMAND ${Python3_EXECUTABLE} -m pip install --user beautifulsoup4 lxml
  393           RESULT_VARIABLE result
  394         )
  395         if (NOT result EQUAL 0)
  396           message(FATAL_ERROR "Failed to install python dependencies")
  397         endif()
  398 
  399     - name: Build
  400       shell: cmake -P {0}
  401       run: |
  402         set(ENV{CC} ${{ matrix.config.cc }})
  403         set(ENV{CXX} ${{ matrix.config.cxx }})
  404         set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.13")
  405 
  406         if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
  407           execute_process(
  408             COMMAND "${{ matrix.config.environment_script }}" && set
  409             OUTPUT_FILE environment_script_output.txt
  410           )
  411           file(STRINGS environment_script_output.txt output_lines)
  412           foreach(line IN LISTS output_lines)
  413             if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
  414               set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
  415             endif()
  416           endforeach()
  417         endif()
  418 
  419         set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
  420 
  421         file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
  422         set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
  423         set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
  424         set(ENV{CCACHE_SLOPPINESS} "pch_defines,time_macros")
  425         set(ENV{CCACHE_COMPRESS} "true")
  426         set(ENV{CCACHE_COMPRESSLEVEL} "6")
  427         set(ENV{CCACHE_MAXSIZE} "800M")
  428         if ("${{ matrix.config.cxx }}" STREQUAL "cl")
  429           set(ENV{CCACHE_MAXSIZE} "1200M")
  430         endif()
  431 
  432         execute_process(
  433           COMMAND git log --format=%B -n 1 ${{ github.event.after }}
  434           OUTPUT_VARIABLE git_commit_msg
  435         )
  436         if (${git_commit_msg} MATCHES "ccache:[ ]*clea[r|n]")
  437           execute_process(COMMAND ccache --clear COMMAND_ECHO STDOUT)
  438         endif()
  439 
  440         execute_process(COMMAND ccache -p)
  441         execute_process(COMMAND ccache -z)
  442 
  443         if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
  444           set(CDB_OPTION "--no-cdb")
  445         else()
  446           set(CDB_OPTION)
  447         endif()
  448 
  449         if (NOT "${{ steps.elfutils.outputs.elfutils_dir }}" STREQUAL "")
  450           set(ELFUTILS_OPTION "--elfutils-path;${{ steps.elfutils.outputs.elfutils_dir }}")
  451         else()
  452           set(ELFUTILS_OPTION)
  453         endif()
  454 
  455         find_package(Python3 REQUIRED COMPONENTS Interpreter)
  456         string(REPLACE "x86" "x64" Python3_EXECUTABLE "${Python3_EXECUTABLE}")
  457 
  458         execute_process(
  459           COMMAND python
  460             -u
  461             scripts/build.py
  462             --build-type Release
  463             --src .
  464             --build build
  465             --qt-path "${{ steps.qt.outputs.qt_dir }}"
  466             --llvm-path "${{ steps.libclang.outputs.libclang_dir }}"
  467             --python3 "${Python3_EXECUTABLE}"
  468             --with-tests
  469             ${CDB_OPTION}
  470             ${ELFUTILS_OPTION}
  471             --add-config=-DCMAKE_C_COMPILER_LAUNCHER=ccache
  472             --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
  473             --add-config=-DIDE_REVISION_URL=https://github.com/$ENV{GITHUB_REPOSITORY}/commits/$ENV{GITHUB_SHA}
  474             --zip-infix=-${{ matrix.config.artifact }}-${{ github.run_id }}
  475           RESULT_VARIABLE result
  476           COMMAND_ECHO STDOUT
  477           OUTPUT_VARIABLE output
  478           ERROR_VARIABLE output
  479           ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
  480         )
  481         if (NOT result EQUAL 0)
  482           string(REGEX MATCH "FAILED:.*$" error_message "${output}")
  483           string(REPLACE "\n" "%0A" error_message "${error_message}")
  484           message("::error::${error_message}")
  485           message(FATAL_ERROR "Build failed")
  486         endif()
  487 
  488     - name: ccache statistics
  489       shell: cmake -P {0}
  490       run: |
  491         file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
  492         set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
  493         set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
  494         set(ENV{CCACHE_SLOPPINESS} "pch_defines,time_macros")
  495         set(ENV{CCACHE_COMPRESS} "true")
  496         set(ENV{CCACHE_COMPRESSLEVEL} "6")
  497         set(ENV{CCACHE_MAXSIZE} "800M")
  498         if ("${{ matrix.config.cxx }}" STREQUAL "cl")
  499           set(ENV{CCACHE_MAXSIZE} "1200M")
  500         endif()
  501         execute_process(COMMAND ccache -s)
  502 
  503     - name: Run tests
  504       shell: cmake -P {0}
  505       run: |
  506         include(ProcessorCount)
  507         ProcessorCount(N)
  508 
  509         set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
  510 
  511         if ("${{ runner.os }}" STREQUAL "Linux")
  512           set(ENV{QT_QPA_PLATFORM} "offscreen")
  513         endif()
  514 
  515         execute_process(
  516           COMMAND ctest -j ${N} --timeout 5
  517           WORKING_DIRECTORY build/build
  518           RESULT_VARIABLE result
  519           OUTPUT_VARIABLE output
  520           ERROR_VARIABLE output
  521           ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
  522           TIMEOUT 600
  523         )
  524         if (NOT result EQUAL 0)
  525           string(REGEX MATCH "[0-9]+% tests.*[0-9.]+ sec.*$" test_results "${output}")
  526           string(REPLACE "\n" "%0A" test_results "${test_results}")
  527           # Do not fail on ctest failure
  528           message("::warning::${test_results}")
  529         endif()
  530 
  531     - name: Upload
  532       uses: actions/upload-artifact@v1
  533       with:
  534         path: build/qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  535         name: qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  536 
  537     - name: Upload Devel
  538       uses: actions/upload-artifact@v1
  539       with:
  540         path: build/qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}_dev.7z
  541         name: qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}_dev.7z
  542 
  543     - name: Upload wininterrupt
  544       if: runner.os == 'Windows'
  545       uses: actions/upload-artifact@v1
  546       with:
  547         path: build/wininterrupt-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  548         name: wininterrupt-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  549 
  550     - name: Upload qtcreatorcdbext
  551       if: runner.os == 'Windows' && matrix.config.is_msvc
  552       uses: actions/upload-artifact@v1
  553       with:
  554         path: build/qtcreatorcdbext-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  555         name: qtcreatorcdbext-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  556 
  557     - name: Upload disk image
  558       if: runner.os == 'macOS'
  559       uses: actions/upload-artifact@v1
  560       with:
  561         path: build/qt-creator-${{ matrix.config.artifact }}-${{ github.run_id }}.dmg
  562         name: qt-creator-${{ matrix.config.artifact }}-${{ github.run_id }}.dmg
  563 
  564   release:
  565     if: contains(github.ref, 'tags/v')
  566     runs-on: ubuntu-latest
  567     needs: build
  568 
  569     steps:
  570     - name: Create Release
  571       id: create_release
  572       uses: actions/create-release@v1.0.0
  573       env:
  574         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  575       with:
  576         tag_name: ${{ github.ref }}
  577         release_name: Release ${{ github.ref }}
  578         draft: false
  579         prerelease: false
  580 
  581     - name: Store Release url
  582       run: |
  583         echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
  584 
  585     - uses: actions/upload-artifact@v1
  586       with:
  587         path: ./upload_url
  588         name: upload_url
  589 
  590   publish:
  591     if: contains(github.ref, 'tags/v')
  592     name: ${{ matrix.config.name }}
  593     runs-on: ${{ matrix.config.os }}
  594     strategy:
  595       fail-fast: false
  596       matrix:
  597         config:
  598         - {
  599             name: "Windows Latest MSVC", artifact: "Windows-MSVC",
  600             is_msvc: true,
  601             os: ubuntu-latest
  602           }
  603         - {
  604             name: "Windows Latest MinGW", artifact: "Windows-MinGW",
  605             is_msvc: false,
  606             os: ubuntu-latest
  607           }
  608         - {
  609             name: "Ubuntu Latest GCC", artifact: "Linux",
  610             os: ubuntu-latest
  611           }
  612         - {
  613             name: "macOS Latest Clang", artifact: "macOS",
  614             os: ubuntu-latest
  615           }
  616     needs: release
  617 
  618     steps:
  619     - name: Download artifact
  620       uses: actions/download-artifact@v1
  621       with:
  622         name: qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  623         path: ./
  624 
  625     - name: Download Devel artifact
  626       uses: actions/download-artifact@v1
  627       with:
  628         name: qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}_dev.7z
  629         path: ./
  630 
  631     - name: Download wininterrupt artifact
  632       if: runner.os == 'Windows'
  633       uses: actions/download-artifact@v1
  634       with:
  635         name: wininterrupt-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  636         path: ./
  637 
  638     - name: Download qtcreatorcdbext artifact
  639       if: runner.os == 'Windows' && matrix.config.is_msvc
  640       uses: actions/upload-artifact@v1
  641       with:
  642         name: qtcreatorcdbext-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  643         path: ./
  644 
  645     - name: Download disk image artifact
  646       if: runner.os == 'macOS'
  647       uses: actions/upload-artifact@v1
  648       with:
  649         name: qt-creator-${{ matrix.config.artifact }}-${{ github.run_id }}.dmg
  650         path: ./
  651 
  652     - name: Download URL
  653       uses: actions/download-artifact@v1
  654       with:
  655         name: upload_url
  656         path: ./
  657     - id: set_upload_url
  658       run: |
  659         upload_url=`cat ./upload_url`
  660         echo ::set-output name=upload_url::$upload_url
  661 
  662     - name: Upload to Release
  663       uses: actions/upload-release-asset@v1.0.1
  664       env:
  665         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  666       with:
  667         upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
  668         asset_path: ./qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  669         asset_name: qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  670         asset_content_type: application/x-gtar
  671 
  672     - name: Upload Devel to Release
  673       uses: actions/upload-release-asset@v1.0.1
  674       env:
  675         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  676       with:
  677         upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
  678         asset_path: ./qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}_dev.7z
  679         asset_name: qtcreator-${{ matrix.config.artifact }}-${{ github.run_id }}_dev.7z
  680         asset_content_type: application/x-gtar
  681 
  682     - name: Upload wininterrupt to Release
  683       if: runner.os == 'Windows'
  684       uses: actions/upload-release-asset@v1.0.1
  685       env:
  686         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  687       with:
  688         upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
  689         asset_path: ./wininterrupt-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  690         asset_name: wininterrupt-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  691         asset_content_type: application/x-gtar
  692 
  693     - name: Upload qtcreatorcdbext to Release
  694       if: runner.os == 'Windows' && matrix.config.is_msvc
  695       uses: actions/upload-release-asset@v1.0.1
  696       env:
  697         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  698       with:
  699         upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
  700         asset_path: ./qtcreatorcdbext-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  701         asset_name: qtcreatorcdbext-${{ matrix.config.artifact }}-${{ github.run_id }}.7z
  702         asset_content_type: application/x-gtar
  703 
  704     - name: Upload disk image to Release
  705       if: runner.os == 'macOS'
  706       uses: actions/upload-release-asset@v1.0.1
  707       env:
  708         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  709       with:
  710         upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
  711         asset_path: ./qt-creator-${{ matrix.config.artifact }}-${{ github.run_id }}.dmg
  712         asset_name: qt-creator-${{ matrix.config.artifact }}-${{ github.run_id }}.dmg
  713         asset_content_type: application/x-gtar