Skip to content

update github workflows #240

update github workflows

update github workflows #240

Workflow file for this run

name: build-macos
on:
push:
branches:
- master
env:
QT_VERSION: 5.15.2
jobs:
build:
name: ${{ matrix.config.name }}
strategy:
matrix:
config:
- {
name: "macOS-10.13-x64", artifact: "macOS-10.13-x64.zip",
os: macos-12
}
runs-on: ${{ matrix.config.os }}
steps:
- name: Clone repository
uses: actions/checkout@v2
- 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 "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")
elseif ("${{ 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()
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 "<Name>${qt_package_name}.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>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 qtquickcontrols2 qtgraphicaleffects qttranslations qtsensors qtlocation)
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: Configure
run: |
git submodule init && git submodule update
find ${{ steps.qt.outputs.qt_dir }}/lib/cmake -maxdepth 1
mkdir -p build
cd build
cmake .. \
-DBUILD_DEPENDENCIES=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" \
-DCMAKE_PREFIX_PATH=${{ steps.qt.outputs.qt_dir }} \
-DQt5Core_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Core \
-DQt5Gui_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Gui \
-DQt5Qml_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Qml \
-DQt5Network_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Network \
-DQt5Quick_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Quick \
-DQt5QuickControls2_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5QuickControls2 \
-DQt5Xml_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Xml \
-DQt5Svg_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Svg \
-DQt5Widgets_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Widgets
- name: Build from sources
run: |
cd build
make
- name: Build package
run: |
export QT_DIR=${{ steps.qt.outputs.qt_dir }}
export SOURCE_DIR=${{ github.workspace }}
export BUILD_DIR=${{ github.workspace }}/build
cd ${BUILD_DIR}
${SOURCE_DIR}/macosx/bundle.sh icon
${SOURCE_DIR}/macosx/bundle.sh bundle
${SOURCE_DIR}/macosx/bundle.sh archive
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.name }}
path: ${{ github.workspace }}/build/noson-MacOSX_*.tar.gz
retention-days: 5