Build QLiteHtmlBrowser #60
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build QLiteHtmlBrowser | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
#name: CMake | |
#on: | |
# push: | |
# branches: [ main ] | |
# pull_request: | |
# branches: [ main ] | |
#env: | |
# # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
# BUILD_TYPE: Release | |
#jobs: | |
# build: | |
# # The CMake configure and build commands are platform agnostic and should work equally | |
# # well on Windows or Mac. You can convert this to a matrix build if you need | |
# # cross-platform coverage. | |
# # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# | |
# - name: Configure CMake | |
# # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
# - name: Build | |
# # Build your program with the given configuration | |
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
# - name: Test | |
# working-directory: ${{github.workspace}}/build | |
# # Execute tests defined by the CMake configuration. | |
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: ctest -C ${{env.BUILD_TYPE}} | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - master | |
push: | |
tags: | |
- "v*" | |
env: | |
PLUGIN_NAME: qlitehtmlbrowser | |
QT_VERSION: 5.15.2 | |
BUILD_TYPE: Release | |
#NINJA_VERSION: 1.10.1 | |
jobs: | |
formatting-check: | |
name: Formatting Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
path: | |
- 'include' | |
- 'src' | |
- 'test' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check for C/C++ programs. | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '18' | |
check-path: ${{ matrix.path }} | |
# fallback-style: 'LLVM' | |
build: | |
needs: formatting-check | |
name: Build ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
outputs: | |
qt_url: ${{ steps.qt.outputs.qt_base_url }} | |
strategy: | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MSVC", artifact: "Windows", | |
os: windows-latest, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
} | |
- { | |
name: "Ubuntu Latest GCC", artifact: "Linux", | |
os: ubuntu-latest, | |
cc: "gcc", cxx: "g++" | |
} | |
#- { | |
# name: "Ubuntu Latest CLANG", artifact: "Linux", | |
# os: ubuntu-latest, | |
# cc: "clang", cxx: "clang++" | |
#} | |
#- { | |
# name: "macOS Latest Clang", artifact: "macOS", | |
# os: macos-latest, | |
# cc: "clang", cxx: "clang++" | |
#} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install system libs | |
shell: cmake -P {0} | |
run: | | |
if ("${{ runner.os }}" STREQUAL "Linux") | |
execute_process( | |
COMMAND sudo apt update | |
) | |
execute_process( | |
COMMAND sudo apt install libgl1-mesa-dev | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Failed to install dependencies") | |
endif() | |
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") | |
set(qt_package_arch_suffix "win64_msvc2019_64") | |
set(qt_dir_prefix "${qt_version}/msvc2019_64") | |
set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64") | |
elseif ("${{ runner.os }}" STREQUAL "Linux") | |
set(url_os "linux_x64") | |
set(qt_package_arch_suffix "gcc_64") | |
set(qt_dir_prefix "${qt_version}/gcc_64") | |
set(qt_package_suffix "-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64") | |
elseif ("${{ runner.os }}" STREQUAL "macOS") | |
set(url_os "mac_x64") | |
set(qt_package_arch_suffix "clang_64") | |
set(qt_dir_prefix "${qt_version}/clang_64") | |
set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64") | |
endif() | |
file(MAKE_DIRECTORY build-qt5) | |
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}") | |
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./build-qt5/Updates.xml SHOW_PROGRESS) | |
file(READ ./build-qt5/Updates.xml updates_xml) | |
string(REGEX MATCH "<Name>qt.qt5.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}") | |
set(qt_package_version ${CMAKE_MATCH_1}) | |
# Save the path for other steps | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/build-qt5/${qt_dir_prefix}" qt_dir) | |
#message("\"qt_dir=${qt_dir}\" >> $GITHUB_OUTPUT") | |
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}\n") | |
message("Downloading Qt to ${qt_dir}") | |
function(downloadAndExtract url archive) | |
message("Downloading ${url}") | |
file(DOWNLOAD "${url}" ./build-qt5/${archive} SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ${archive} WORKING_DIRECTORY build-qt5) | |
endfunction() | |
# qtdeclarative qttools qtsvg qtxmlpatterns | |
foreach(package qtbase qttools ) | |
downloadAndExtract( | |
"${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" | |
${package}.7z | |
) | |
endforeach() | |
# uic depends on libicu56.so | |
if ("${{ runner.os }}" STREQUAL "Linux") | |
downloadAndExtract( | |
"${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z" | |
icu.7z | |
) | |
endif() | |
# message("::set-output name=qt_base_url::${qt_base_url}") | |
# message("\"qt_base_url::${qt_base_url}\" >> $GITHUB_OUTPUT") | |
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_base_url=${qt_base_url}\n") | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
cmake --version | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
env: | |
Qt5_DIR: ${{ steps.qt.outputs.qt_dir}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
shell: cmake -P {0} | |
run: | | |
execute_process(COMMAND ctest -C ${{env.BUILD_TYPE}} -E NOT_BUILT --verbose | |
WORKING_DIRECTORY build | |
RESULT_VARIABLE result | |
COMMAND_ECHO STDOUT | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "running tests failed") | |
endif() | |
env: | |
QT_QPA_PLATFORM: offscreen | |
Qt5_DIR: ${{ steps.qt.outputs.qt_dir}} | |
- name: Deploy | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: | | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target dist-source |