Skip to content

Build

Build #109

Workflow file for this run

name: Build
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
build-server-on-mac:
runs-on: macos-26
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
include:
- arch: x86_64
target: x86_64-unknown-linux-gnu
- arch: aarch64
target: aarch64-unknown-linux-gnu
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
submodules: "recursive"
- name: Install Swift SDK
run: |
swift sdk install https://download.swift.org/swift-6.2.3-release/static-sdk/swift-6.2.3-RELEASE/swift-6.2.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum f30ec724d824ef43b5546e02ca06a8682dafab4b26a99fbb0e858c347e507a2c
- name: Build hazkey-server
run: |
mkdir -p ${{ github.workspace }}/hazkey-server/build
cd ${{ github.workspace }}/hazkey-server/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DHAZKEY_SERVER_BUILD_ON_MAC=ON -DHAZKEY_SERVER_SWIFT_SDK=${{ matrix.target }} -G Ninja ..
ninja
env DESTDIR=${{ github.workspace }}/workdir ninja install
# build:
# strategy:
# fail-fast: false
# matrix:
# include:
# - runner: ubuntu-22.04
# label: ubuntu-22.04
# arch: x86_64
# swift_url: https://download.swift.org/swift-6.2-release/ubuntu2204/swift-6.2-RELEASE/swift-6.2-RELEASE-ubuntu22.04.tar.gz
# static_protobuf: false
# - runner: ubuntu-24.04
# label: ubuntu-24.04
# arch: x86_64
# swift_url: https://download.swift.org/swift-6.2-release/ubuntu2404/swift-6.2-RELEASE/swift-6.2-RELEASE-ubuntu24.04.tar.gz
# static_protobuf: false
# - runner: ubuntu-24.04-arm
# label: ubuntu-24.04
# arch: aarch64
# swift_url: https://download.swift.org/swift-6.2-release/ubuntu2404-aarch64/swift-6.2-RELEASE/swift-6.2-RELEASE-ubuntu24.04-aarch64.tar.gz
# static_protobuf: false
# - runner: ubuntu-22.04
# label: ubuntu-22.04-static_protobuf
# arch: x86_64
# swift_url: https://download.swift.org/swift-6.2-release/ubuntu2204/swift-6.2-RELEASE/swift-6.2-RELEASE-ubuntu22.04.tar.gz
# static_protobuf: true
# - runner: ubuntu-24.04-arm
# label: ubuntu-24.04-static_protobuf
# arch: aarch64
# swift_url: https://download.swift.org/swift-6.2-release/ubuntu2404-aarch64/swift-6.2-RELEASE/swift-6.2-RELEASE-ubuntu24.04-aarch64.tar.gz
# static_protobuf: true
# runs-on: ${{ matrix.runner }}
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v6
# with:
# submodules: "recursive"
# - name: Cache Swift Environment
# id: cache-swift
# uses: actions/cache@v5
# with:
# path: ${{ github.workspace }}/swift
# key: ${{ matrix.runner }}-${{ matrix.arch }}-swift-6.2-RELEASE
# - name: Install Swift Environment
# if: steps.cache-swift.outputs.cache-hit != 'true'
# run: |
# mkdir -p ${{ github.workspace }}/swift
# wget ${{ matrix.swift_url }}
# tar xf $(basename ${{ matrix.swift_url }}) --strip-components=1 -C ${{ github.workspace }}/swift
# - name: Add Swift to PATH
# run: |
# echo "${{ github.workspace }}/swift/usr/bin" >> $GITHUB_PATH
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v2
# with:
# cmake-version: "4.1.x"
# - name: Install Dependencies
# run: |
# sudo apt-get update -y
# sudo apt-get install -y --no-install-recommends wget gnupg2 \
# build-essential gettext fakeroot libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev \
# ninja-build qt6-base-dev qt6-tools-dev qt6-tools-dev-tools libqt6widgets6 libqt6gui6 qt6-l10n-tools libglx-dev libgl1-mesa-dev libxkbcommon-dev
# - name: Install Dependencies (protobuf)
# if: ${{ !matrix.static_protobuf }}
# run: |
# sudo apt-get install -y protobuf-compiler libprotoc-dev
# - name: Vulkan Dependencies (Ubuntu 22.04)
# if: matrix.runner == 'ubuntu-22.04'
# run: |
# wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
# sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
# sudo apt-get update -y
# sudo apt-get install -y mesa-vulkan-drivers vulkan-sdk
# - name: Vulkan Dependencies (Ubuntu 24.04+)
# if: matrix.runner == 'ubuntu-24.04' || matrix.runner == 'ubuntu-24.04-arm'
# run: |
# sudo apt-get install -y libvulkan-dev glslc
# - name: Create Directories
# run: |
# mkdir -p ${{ github.workspace }}/local_deps
# mkdir -p ${{ github.workspace }}/workdir
# mkdir -p ${{ github.workspace }}/packages
# - name: Cache C++ Dependencies
# if: matrix.static_protobuf
# id: cache-deps
# uses: actions/cache@v5
# with:
# path: ${{ github.workspace }}/local_deps
# key: ${{ matrix.runner }}-${{ matrix.arch }}-protobuf-21-12-v1
# - name: Build and Install Protobuf
# if: matrix.static_protobuf && steps.cache-deps.outputs.cache-hit != 'true'
# run: |
# git clone --branch v21.12 --depth 1 https://github.com/protocolbuffers/protobuf.git
# cd protobuf
# mkdir build && cd build
# cmake .. \
# -DCMAKE_BUILD_TYPE=Release \
# -DBUILD_SHARED_LIBS=OFF \
# -Dprotobuf_BUILD_TESTS=OFF \
# -DCMAKE_CXX_FLAGS="-fPIC" \
# -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
# -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/local_deps
# make -j$(nproc)
# sudo make install
# - name: Add local_deps to PATH
# if: matrix.static_protobuf
# run: |
# echo "${{ github.workspace }}/local_deps/bin" >> $GITHUB_PATH
# - name: Build hazkey-settings
# run: |
# mkdir -p ${{ github.workspace }}/hazkey-settings/build
# cd ${{ github.workspace }}/hazkey-settings/build
# sed -i "s/Qt::Orientation::/Qt::/g" ../mainwindow.ui
# cmake \
# -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_INSTALL_PREFIX=/usr \
# -DCMAKE_CXX_FLAGS=-I${{ github.workspace }}/local_deps/include \
# -DCMAKE_PREFIX_PATH=${{ github.workspace }}/local_deps \
# -DProtobuf_USE_STATIC_LIBS=${{ matrix.static_protobuf }} \
# -G Ninja ..
# ninja -j$(nproc)
# env DESTDIR=${{ github.workspace }}/workdir ninja install
# - name: Build fcitx5-hazkey
# run: |
# mkdir -p ${{ github.workspace }}/fcitx5-hazkey/build
# cd ${{ github.workspace }}/fcitx5-hazkey/build
# cmake -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_INSTALL_PREFIX=/usr \
# -DCMAKE_PREFIX_PATH=${{ github.workspace }}/local_deps \
# -DProtobuf_USE_STATIC_LIBS=${{ matrix.static_protobuf }} \
# -G Ninja ..
# ninja -j$(nproc)
# env DESTDIR=${{ github.workspace }}/workdir ninja install
# - name: Build hazkey-server
# run: |
# mkdir -p ${{ github.workspace }}/hazkey-server/build
# cd ${{ github.workspace }}/hazkey-server/build
# cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -G Ninja ..
# ninja -j$(nproc)
# env DESTDIR=${{ github.workspace }}/workdir ninja install
# - name: Create tar.gz archive
# run: |
# cd ${{ github.workspace }}/workdir
# tar -czvf ${{ github.workspace }}/packages/fcitx5-hazkey-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz ./usr
# - name: Upload Build Artifacts
# uses: actions/upload-artifact@v6
# with:
# name: fcitx5-hazkey-${{ matrix.label }}-${{ matrix.arch }}
# path: ${{ github.workspace }}/packages/*