mirror of
https://github.com/zealdocs/zeal.git
synced 2026-08-29 08:34:50 +08:00
284 lines
8.7 KiB
YAML
284 lines
8.7 KiB
YAML
name: Build Check
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
QT_VERSION: "6.11.1"
|
|
QT_MODULES: >-
|
|
qtpositioning
|
|
qtwebchannel
|
|
qtwebengine
|
|
|
|
jobs:
|
|
build-ubuntu:
|
|
name: ${{ matrix.config.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- name: Ubuntu 24.04
|
|
os: ubuntu-24.04
|
|
qt_packages: >-
|
|
libgl-dev
|
|
libqt6opengl6-dev
|
|
libqt6svg6-dev
|
|
qt6-webengine-dev
|
|
configurePreset: release
|
|
buildPreset: release
|
|
- name: Ubuntu 24.04 ARM64
|
|
os: ubuntu-24.04-arm
|
|
qt_packages: >-
|
|
libgl-dev
|
|
libqt6opengl6-dev
|
|
libqt6svg6-dev
|
|
qt6-webengine-dev
|
|
configurePreset: release
|
|
buildPreset: release
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get -y -qq update
|
|
sudo apt-get -y -qq --no-install-recommends install \
|
|
cmake \
|
|
extra-cmake-modules \
|
|
libarchive-dev \
|
|
libsqlite3-dev \
|
|
libvulkan-dev \
|
|
libxcb-keysyms1-dev \
|
|
ninja-build \
|
|
${{ matrix.config.qt_packages }}
|
|
|
|
- name: Configure & Build
|
|
uses: lukka/run-cmake@v10
|
|
with:
|
|
configurePreset: ${{ matrix.config.configurePreset }}
|
|
buildPreset: ${{ matrix.config.buildPreset }}
|
|
|
|
build-windows:
|
|
name: ${{ matrix.config.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- name: Windows Server 2022
|
|
os: windows-2022
|
|
configurePreset: release
|
|
buildPreset: release
|
|
publishArtifacts: true
|
|
- name: Windows Server 2022 Portable
|
|
os: windows-2022
|
|
configurePreset: release-portable
|
|
buildPreset: release-portable
|
|
publishArtifacts: true
|
|
- name: Windows 11 ARM64
|
|
os: windows-11-arm
|
|
configurePreset: release
|
|
buildPreset: release
|
|
publishArtifacts: true
|
|
- name: Windows 11 ARM64 Portable
|
|
os: windows-11-arm
|
|
configurePreset: release-portable
|
|
buildPreset: release-portable
|
|
publishArtifacts: true
|
|
|
|
env:
|
|
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/.vcpkg-cache,readwrite
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Detect compiler version
|
|
id: compiler-version
|
|
shell: pwsh
|
|
run: |
|
|
if ($IsWindows) {
|
|
$msvc = Get-ChildItem "C:\Program Files*\Microsoft Visual Studio\*\*\VC\Tools\MSVC\*" `
|
|
-Directory | Sort-Object { [version]$_.Name } -Descending | Select-Object -First 1
|
|
"version=$($msvc.Name)" >> $env:GITHUB_OUTPUT
|
|
} else {
|
|
"version=n/a" >> $env:GITHUB_OUTPUT
|
|
}
|
|
|
|
- name: Restore vcpkg binary cache
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ${{ github.workspace }}/.vcpkg-cache
|
|
key: vcpkg-${{ matrix.config.os }}-${{ matrix.config.buildPreset }}-${{ steps.compiler-version.outputs.version }}-${{ hashFiles('vcpkg.json') }}
|
|
restore-keys: vcpkg-${{ matrix.config.os }}-${{ matrix.config.buildPreset }}-${{ steps.compiler-version.outputs.version }}-
|
|
|
|
- name: Prepare vcpkg
|
|
uses: lukka/run-vcpkg@v11
|
|
with:
|
|
vcpkgDirectory: ${{ github.workspace }}/.vcpkg
|
|
|
|
- name: Install Qt
|
|
uses: trollixx/setup-qt@v1
|
|
with:
|
|
version: ${{ env.QT_VERSION }}
|
|
modules: ${{ env.QT_MODULES }}
|
|
|
|
- name: Configure & Build
|
|
uses: lukka/run-cmake@v10
|
|
with:
|
|
configurePreset: ${{ matrix.config.configurePreset }}
|
|
buildPreset: ${{ matrix.config.buildPreset }}
|
|
configurePresetAdditionalArgs: "['-DVCPKG_INSTALL_OPTIONS=--x-abi-tools-use-exact-versions']"
|
|
|
|
- name: Retrieve Application Version
|
|
run: |
|
|
$zeal_version = Get-Content build/${{ matrix.config.configurePreset }}/zeal_version
|
|
Write-Output "Zeal Version: $zeal_version"
|
|
"ZEAL_VERSION=$zeal_version" >> $env:GITHUB_ENV
|
|
|
|
- name: Install WiX
|
|
if: matrix.config.publishArtifacts && matrix.config.configurePreset == 'release'
|
|
run: |
|
|
dotnet tool install --global wix --version 5.0.2
|
|
wix extension add --global WixToolset.UI.wixext/5.0.2
|
|
wix extension add --global WixToolset.Util.wixext/5.0.2
|
|
|
|
- name: Package
|
|
if: matrix.config.publishArtifacts
|
|
run: cmake --build --preset ${{ matrix.config.buildPreset }} --target package
|
|
|
|
- name: Upload ZIP Artifacts
|
|
if: matrix.config.publishArtifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: build/${{ matrix.config.configurePreset }}/zeal-*.zip
|
|
archive: false
|
|
|
|
- name: Upload MSI Artifacts
|
|
if: matrix.config.publishArtifacts && matrix.config.configurePreset == 'release'
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: build/${{ matrix.config.configurePreset }}/zeal-*.msi
|
|
archive: false
|
|
|
|
build-macos:
|
|
name: ${{ matrix.config.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- name: macOS 15 ARM64
|
|
os: macos-15
|
|
configurePreset: release
|
|
buildPreset: release
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Dependencies
|
|
run: brew install cpp-httplib libarchive tomlplusplus
|
|
|
|
- name: Install Qt
|
|
uses: trollixx/setup-qt@v1
|
|
with:
|
|
version: ${{ env.QT_VERSION }}
|
|
modules: ${{ env.QT_MODULES }}
|
|
|
|
- name: Configure & Build
|
|
uses: lukka/run-cmake@v10
|
|
with:
|
|
configurePreset: ${{ matrix.config.configurePreset }}
|
|
buildPreset: ${{ matrix.config.buildPreset }}
|
|
|
|
build-appimage:
|
|
name: AppImage
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get -y -qq update
|
|
sudo apt-get -y -qq --no-install-recommends install \
|
|
appstream \
|
|
cmake \
|
|
extra-cmake-modules \
|
|
libarchive-dev \
|
|
libfuse2t64 \
|
|
libgl-dev \
|
|
libqt6opengl6-dev \
|
|
libqt6svg6-dev \
|
|
libsqlite3-dev \
|
|
libvulkan-dev \
|
|
libxcb-keysyms1-dev \
|
|
ninja-build \
|
|
qt6-webengine-dev
|
|
|
|
- name: Install linuxdeploy
|
|
run: |
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage
|
|
chmod +x linuxdeploy*.AppImage
|
|
|
|
- name: Configure & Build
|
|
run: |
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
|
cmake --build build
|
|
|
|
- name: Retrieve Application Version
|
|
run: |
|
|
zeal_version=$(<build/zeal_version)
|
|
echo "Zeal Version: ${zeal_version}"
|
|
echo "ZEAL_VERSION=${zeal_version}" >> $GITHUB_ENV
|
|
|
|
- name: Prepare AppDir
|
|
run: DESTDIR=${{ github.workspace }}/AppDir cmake --install build
|
|
|
|
- name: Validate AppStream Metadata
|
|
run: appstreamcli validate AppDir/usr/share/metainfo/org.zealdocs.zeal.appdata.xml
|
|
|
|
- name: Set Up AppRun Hooks
|
|
run: |
|
|
mkdir -p AppDir/apprun-hooks
|
|
echo 'export QTWEBENGINE_DISABLE_SANDBOX=1' > AppDir/apprun-hooks/qtwebengine.sh
|
|
|
|
- name: Build AppImage
|
|
run: |
|
|
export QMAKE=$(which qmake6)
|
|
export OUTPUT=Zeal-${{ env.ZEAL_VERSION }}-x86_64.AppImage
|
|
./linuxdeploy-x86_64.AppImage \
|
|
--appdir AppDir \
|
|
--plugin qt \
|
|
--output appimage
|
|
|
|
- name: Upload AppImage
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: Zeal-${{ env.ZEAL_VERSION }}-x86_64.AppImage
|
|
archive: false
|