forked from qt-creator/qt-creator
GitHub Actions: Use qt mirrors for downloading Qt
This was removed at some point due to a refactoring. This commit brings it back, since there are cases when download.qt.io is down. Add download retry for libclang, mingw compiler. Change the OpenSSL download url to v3. Change-Id: Iba6a0ae6da64277b0b7b549367d6f5fc73f2478d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
217
.github/workflows/build_cmake.yml
vendored
217
.github/workflows/build_cmake.yml
vendored
@@ -15,7 +15,7 @@ env:
|
|||||||
NINJA_VERSION: 1.10.2
|
NINJA_VERSION: 1.10.2
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCACHE_VERSION: 4.11.2
|
CCACHE_VERSION: 4.11.2
|
||||||
QT_MIRRORS: download.qt.io;mirrors.ocf.berkeley.edu/qt;ftp.fau.de/qtproject;mirror.bit.edu.cn/qtproject
|
QT_MIRRORS: download.qt.io;mirrors.ocf.berkeley.edu/qt;ftp.fau.de/qtproject;mirrors.sau.edu.cn/qt
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
- {
|
- {
|
||||||
name: "Windows Latest MinGW", artifact: "windows-x64-mingw",
|
name: "Windows Latest MinGW", artifact: "windows-x64-mingw",
|
||||||
os: windows-latest,
|
os: windows-latest,
|
||||||
toolchain: "https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_mingw1310/qt.tools.win64_mingw1310/13.1.0-202407240918mingw1310.7z",
|
toolchain: "https://\\${qt_mirror}/online/qtsdkrepository/windows_x86/desktop/tools_mingw1310/qt.tools.win64_mingw1310/13.1.0-202407240918mingw1310.7z",
|
||||||
toolchain_path: "Tools/mingw1310_64/bin",
|
toolchain_path: "Tools/mingw1310_64/bin",
|
||||||
cc: "gcc", cxx: "g++",
|
cc: "gcc", cxx: "g++",
|
||||||
is_msvc: false
|
is_msvc: false
|
||||||
@@ -165,8 +165,20 @@ jobs:
|
|||||||
|
|
||||||
if ("${{ runner.os }}" STREQUAL "Windows")
|
if ("${{ runner.os }}" STREQUAL "Windows")
|
||||||
file(MAKE_DIRECTORY build/build/bin)
|
file(MAKE_DIRECTORY build/build/bin)
|
||||||
foreach(retry RANGE 10)
|
set(opengl_sw_url "https://\${qt_mirror}/development_releases/prebuilt/llvmpipe/windows/opengl32sw-64.7z")
|
||||||
file(DOWNLOAD "https://download.qt.io/development_releases/prebuilt/llvmpipe/windows/opengl32sw-64.7z" ./opengl32sw-64.7z SHOW_PROGRESS)
|
foreach(qt_mirror $ENV{QT_MIRRORS})
|
||||||
|
foreach(retry RANGE 10)
|
||||||
|
cmake_language(EVAL CODE "
|
||||||
|
message(\"Downloading ${opengl_sw_url}\")
|
||||||
|
file(DOWNLOAD \"${opengl_sw_url}\" ./opengl32sw-64.7z SHOW_PROGRESS)
|
||||||
|
")
|
||||||
|
file(SIZE ./opengl32sw-64.7z fileSize)
|
||||||
|
if (fileSize GREATER 0)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Check to see if we have the file, if not, go to next mirror
|
||||||
file(SIZE ./opengl32sw-64.7z fileSize)
|
file(SIZE ./opengl32sw-64.7z fileSize)
|
||||||
if (fileSize GREATER 0)
|
if (fileSize GREATER 0)
|
||||||
break()
|
break()
|
||||||
@@ -176,8 +188,19 @@ jobs:
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT "x${{ matrix.config.toolchain }}" STREQUAL "x")
|
if (NOT "x${{ matrix.config.toolchain }}" STREQUAL "x")
|
||||||
foreach(retry RANGE 10)
|
foreach(qt_mirror $ENV{QT_MIRRORS})
|
||||||
file(DOWNLOAD "${{ matrix.config.toolchain }}" ./toolchain.7z SHOW_PROGRESS)
|
foreach(retry RANGE 10)
|
||||||
|
cmake_language(EVAL CODE "
|
||||||
|
message(\"Downloading ${{ matrix.config.toolchain }}\")
|
||||||
|
file(DOWNLOAD \"${{ matrix.config.toolchain }}\" ./toolchain.7z SHOW_PROGRESS)
|
||||||
|
")
|
||||||
|
file(SIZE ./toolchain.7z fileSize)
|
||||||
|
if (fileSize GREATER 0)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Check to see if we have the file, if not, go to next mirror
|
||||||
file(SIZE ./toolchain.7z fileSize)
|
file(SIZE ./toolchain.7z fileSize)
|
||||||
if (fileSize GREATER 0)
|
if (fileSize GREATER 0)
|
||||||
break()
|
break()
|
||||||
@@ -214,64 +237,86 @@ jobs:
|
|||||||
set(compiler_id "clang_64")
|
set(compiler_id "clang_64")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}/qt6_${qt_version_dotless}")
|
set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}/qt6_${qt_version_dotless}")
|
||||||
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
|
foreach(qt_mirror $ENV{QT_MIRRORS})
|
||||||
|
|
||||||
file(READ ./Updates.xml updates_xml)
|
|
||||||
# get the package sections, only for given compiler, without the "debug info" ones
|
|
||||||
string(REGEX REPLACE "<PackageUpdate>" ";<PackageUpdate>" sections "${updates_xml}")
|
|
||||||
list(FILTER sections EXCLUDE REGEX "<Name>.*debug.*</Name>")
|
|
||||||
list(FILTER sections INCLUDE REGEX "<Name>.*${compiler_id}.*</Name>")
|
|
||||||
|
|
||||||
# Save the path for other steps
|
|
||||||
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt/" qt_dir)
|
|
||||||
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}")
|
|
||||||
|
|
||||||
function(get_sub_url outvar module)
|
|
||||||
set(filtered ${sections})
|
|
||||||
list(FILTER filtered INCLUDE REGEX "<DownloadableArchives>.*${module}.*</DownloadableArchives>")
|
|
||||||
list(LENGTH filtered count)
|
|
||||||
if (count LESS 1)
|
|
||||||
set(${outvar} "<notfound>" PARENT_SCOPE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
list(GET filtered 0 section)
|
|
||||||
string(REGEX MATCH "<Name>(.*)</Name>" match "${section}")
|
|
||||||
set(name ${CMAKE_MATCH_1})
|
|
||||||
string(REGEX MATCH "<Version>(.*)</Version>" match "${section}")
|
|
||||||
set(version ${CMAKE_MATCH_1})
|
|
||||||
string(REGEX MATCH "<DownloadableArchives>.*(${module}[^,]+).*</DownloadableArchives>" match "${section}")
|
|
||||||
set(archive ${CMAKE_MATCH_1})
|
|
||||||
set(${outvar} "${name}/${version}${archive}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
message("Downloading Qt to ${qt_dir}")
|
|
||||||
function(downloadAndExtract module subdir)
|
|
||||||
file(MAKE_DIRECTORY "${qt_dir}/${subdir}")
|
|
||||||
set(archive "${module}.7z")
|
|
||||||
get_sub_url(sub_url ${module})
|
|
||||||
set(url "${qt_base_url}/${sub_url}")
|
|
||||||
message("Downloading ${module} from ${url}")
|
|
||||||
message("... extracting to ${qt_dir}/${subdir}")
|
|
||||||
foreach(retry RANGE 10)
|
foreach(retry RANGE 10)
|
||||||
file(DOWNLOAD "${url}" "$ENV{GITHUB_WORKSPACE}/${archive}" SHOW_PROGRESS)
|
cmake_language(EVAL CODE "
|
||||||
file(SIZE "$ENV{GITHUB_WORKSPACE}/${archive}" fileSize)
|
message(\"Downloading ${qt_base_url}/Updates.xml}\")
|
||||||
|
file(DOWNLOAD \"${qt_base_url}/Updates.xml\" ./Updates.xml)
|
||||||
|
")
|
||||||
|
file(SIZE ./Updates.xml fileSize)
|
||||||
if (fileSize GREATER 0)
|
if (fileSize GREATER 0)
|
||||||
break()
|
break()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "$ENV{GITHUB_WORKSPACE}/${archive}" WORKING_DIRECTORY "${qt_dir}/${subdir}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
foreach(package qtbase qtdeclarative qttools qtsvg qttranslations qtimageformats qtserialport qtquicktimeline qtquick3d qt5compat qtshadertools)
|
# try the next mirror if we didn't manage to get an Updates.xml file
|
||||||
downloadAndExtract(${package} "")
|
file(SIZE ./Updates.xml fileSize)
|
||||||
|
if (fileSize EQUAL 0)
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ ./Updates.xml updates_xml)
|
||||||
|
# get the package sections, only for given compiler, without the "debug info" ones
|
||||||
|
string(REGEX REPLACE "<PackageUpdate>" ";<PackageUpdate>" sections "${updates_xml}")
|
||||||
|
list(FILTER sections EXCLUDE REGEX "<Name>.*debug.*</Name>")
|
||||||
|
list(FILTER sections INCLUDE REGEX "<Name>.*${compiler_id}.*</Name>")
|
||||||
|
|
||||||
|
# Save the path for other steps
|
||||||
|
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt/" qt_dir)
|
||||||
|
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}")
|
||||||
|
|
||||||
|
function(get_sub_url outvar module)
|
||||||
|
set(filtered ${sections})
|
||||||
|
list(FILTER filtered INCLUDE REGEX "<DownloadableArchives>.*${module}.*</DownloadableArchives>")
|
||||||
|
list(LENGTH filtered count)
|
||||||
|
if (count LESS 1)
|
||||||
|
set(${outvar} "<notfound>" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
list(GET filtered 0 section)
|
||||||
|
string(REGEX MATCH "<Name>(.*)</Name>" match "${section}")
|
||||||
|
set(name ${CMAKE_MATCH_1})
|
||||||
|
string(REGEX MATCH "<Version>(.*)</Version>" match "${section}")
|
||||||
|
set(version ${CMAKE_MATCH_1})
|
||||||
|
string(REGEX MATCH "<DownloadableArchives>.*(${module}[^,]+).*</DownloadableArchives>" match "${section}")
|
||||||
|
set(archive ${CMAKE_MATCH_1})
|
||||||
|
set(${outvar} "${name}/${version}${archive}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
message("Downloading Qt to ${qt_dir}")
|
||||||
|
function(downloadAndExtract module subdir)
|
||||||
|
file(MAKE_DIRECTORY "${qt_dir}/${subdir}")
|
||||||
|
set(archive "${module}.7z")
|
||||||
|
get_sub_url(sub_url ${module})
|
||||||
|
set(url "${qt_base_url}/${sub_url}")
|
||||||
|
foreach(retry RANGE 10)
|
||||||
|
cmake_language(EVAL CODE "
|
||||||
|
message(\"Downloading ${module} from ${url}\")
|
||||||
|
file(DOWNLOAD \"${url}\" \"$ENV{GITHUB_WORKSPACE}/${archive}\" SHOW_PROGRESS)
|
||||||
|
")
|
||||||
|
file(SIZE "$ENV{GITHUB_WORKSPACE}/${archive}" fileSize)
|
||||||
|
if (fileSize GREATER 0)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
message("... extracting to ${qt_dir}/${subdir}")
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "$ENV{GITHUB_WORKSPACE}/${archive}" WORKING_DIRECTORY "${qt_dir}/${subdir}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
foreach(package qtbase qtdeclarative qttools qtsvg qttranslations qtimageformats qtserialport qtquicktimeline qtquick3d qt5compat qtshadertools)
|
||||||
|
downloadAndExtract(${package} "")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# uic depends on libicu*.so
|
||||||
|
if ("${{ runner.os }}" STREQUAL "Linux")
|
||||||
|
downloadAndExtract("icu" "lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Work is done, no need to try the next mirror.
|
||||||
|
break()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# uic depends on libicu*.so
|
|
||||||
if ("${{ runner.os }}" STREQUAL "Linux")
|
|
||||||
downloadAndExtract("icu" "lib")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
execute_process(COMMAND ${qt_dir}/bin/qmake -query)
|
execute_process(COMMAND ${qt_dir}/bin/qmake -query)
|
||||||
|
|
||||||
if ("${{ runner.os }}" STREQUAL "Windows")
|
if ("${{ runner.os }}" STREQUAL "Windows")
|
||||||
@@ -298,25 +343,31 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
if ("${{ runner.os }}" STREQUAL "Windows")
|
if ("${{ runner.os }}" STREQUAL "Windows")
|
||||||
set(url_os "windows_x86")
|
set(url_os "windows_x86")
|
||||||
set(openssl_localdir "Tools/OpenSSL/Win_x64/bin")
|
set(openssl_localdir "Win_x64/bin")
|
||||||
set(openssl_dest_dir "${{ steps.qt.outputs.qt_dir }}/bin")
|
set(openssl_dest_dir "${{ steps.qt.outputs.qt_dir }}/bin")
|
||||||
set(shared_suffix ".dll")
|
set(shared_suffix ".dll")
|
||||||
elseif ("${{ runner.os }}" STREQUAL "Linux")
|
elseif ("${{ runner.os }}" STREQUAL "Linux")
|
||||||
set(url_os "linux_x64")
|
# TODO: only sources are provided for Linux
|
||||||
set(openssl_localdir "Tools/OpenSSL/binary/lib")
|
return()
|
||||||
set(openssl_dest_dir "${{ steps.qt.outputs.qt_dir }}/lib/Qt/lib")
|
|
||||||
set(shared_suffix ".so*")
|
|
||||||
elseif ("${{ runner.os }}" STREQUAL "macOS")
|
elseif ("${{ runner.os }}" STREQUAL "macOS")
|
||||||
# Not needed on macOS
|
# Not needed on macOS
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(openssl_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/tools_openssl_x64")
|
set(openssl_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/tools_opensslv3_x64")
|
||||||
foreach(qt_mirror $ENV{QT_MIRRORS})
|
foreach(qt_mirror $ENV{QT_MIRRORS})
|
||||||
cmake_language(EVAL CODE "
|
foreach(retry RANGE 10)
|
||||||
message(\"Downloading ${openssl_base_url}/Updates.xml}\")
|
cmake_language(EVAL CODE "
|
||||||
file(DOWNLOAD \"${openssl_base_url}/Updates.xml\" ./Updates.xml)
|
message(\"Downloading ${openssl_base_url}/Updates.xml}\")
|
||||||
")
|
file(DOWNLOAD \"${openssl_base_url}/Updates.xml\" ./Updates.xml SHOW_PROGRESS)
|
||||||
|
")
|
||||||
|
file(SIZE ./Updates.xml fileSize)
|
||||||
|
if (fileSize GREATER 0)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Check to see if we have the file, if not, go to next mirror
|
||||||
file(SIZE ./Updates.xml fileSize)
|
file(SIZE ./Updates.xml fileSize)
|
||||||
if (fileSize GREATER 0)
|
if (fileSize GREATER 0)
|
||||||
break()
|
break()
|
||||||
@@ -325,7 +376,7 @@ jobs:
|
|||||||
|
|
||||||
file(READ ./Updates.xml updates_xml)
|
file(READ ./Updates.xml updates_xml)
|
||||||
string(REGEX MATCH
|
string(REGEX MATCH
|
||||||
"<Name>(qt.tools.openssl.*)</Name>.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>(.*)</DownloadableArchives>" updates_xml_output "${updates_xml}")
|
"<Name>(qt.tools.opensslv3.*)</Name>.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>(.*)</DownloadableArchives>" updates_xml_output "${updates_xml}")
|
||||||
|
|
||||||
set(openssl_directory ${CMAKE_MATCH_1})
|
set(openssl_directory ${CMAKE_MATCH_1})
|
||||||
set(openssl_version ${CMAKE_MATCH_2})
|
set(openssl_version ${CMAKE_MATCH_2})
|
||||||
@@ -337,10 +388,18 @@ jobs:
|
|||||||
file(MAKE_DIRECTORY ${openssl_dest_dir})
|
file(MAKE_DIRECTORY ${openssl_dest_dir})
|
||||||
|
|
||||||
foreach(qt_mirror $ENV{QT_MIRRORS})
|
foreach(qt_mirror $ENV{QT_MIRRORS})
|
||||||
cmake_language(EVAL CODE "
|
foreach(retry RANGE 10)
|
||||||
message(\"Downloading ${url}\")
|
cmake_language(EVAL CODE "
|
||||||
file(DOWNLOAD \"${url}\" ./openssl.7z)
|
message(\"Downloading ${url}\")
|
||||||
")
|
file(DOWNLOAD \"${url}\" ./openssl.7z)
|
||||||
|
")
|
||||||
|
file(SIZE ./openssl.7z fileSize)
|
||||||
|
if (fileSize GREATER 0)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Check to see if we have the file, if not, go to next mirror
|
||||||
file(SIZE ./openssl.7z fileSize)
|
file(SIZE ./openssl.7z fileSize)
|
||||||
if (fileSize GREATER 0)
|
if (fileSize GREATER 0)
|
||||||
break()
|
break()
|
||||||
@@ -374,10 +433,18 @@ jobs:
|
|||||||
|
|
||||||
set(libclang_url "https://\${qt_mirror}/development_releases/prebuilt/libclang/${libclang}")
|
set(libclang_url "https://\${qt_mirror}/development_releases/prebuilt/libclang/${libclang}")
|
||||||
foreach(qt_mirror $ENV{QT_MIRRORS})
|
foreach(qt_mirror $ENV{QT_MIRRORS})
|
||||||
cmake_language(EVAL CODE "
|
foreach(retry RANGE 10)
|
||||||
message(\"Downloading ${libclang_url}\")
|
cmake_language(EVAL CODE "
|
||||||
file(DOWNLOAD \"${libclang_url}\" ./libclang.7z)
|
message(\"Downloading ${libclang_url}\")
|
||||||
")
|
file(DOWNLOAD \"${libclang_url}\" ./libclang.7z)
|
||||||
|
")
|
||||||
|
file(SIZE ./libclang.7z fileSize)
|
||||||
|
if (fileSize GREATER 0)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Check to see if we have the file, if not, go to next mirror
|
||||||
file(SIZE ./libclang.7z fileSize)
|
file(SIZE ./libclang.7z fileSize)
|
||||||
if (fileSize GREATER 0)
|
if (fileSize GREATER 0)
|
||||||
break()
|
break()
|
||||||
|
Reference in New Issue
Block a user