Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template for GitHub Actions #9

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
#os: ['ubuntu-24.04', 'ubuntu-22.04', 'ubuntu-20.04']
os: ['ubuntu-22.04', 'ubuntu-20.04']
custom_layout: ['ON', 'OFF']
experimental: [false]
include:
- os: 'ubuntu-24.04'
experimental: true
env:
PKG_CONFIG_PATH: /opt/fcitx508/lib/pkgconfig
name: build on ${{ matrix.os }} custom ${{ matrix.custom_layout }}
steps:
- uses: actions/checkout@v4
- name: Enable deb822 source repository
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: |
sudo sed -i"" -e "s/Types: deb/Types: deb deb-src/" /etc/apt/sources.list.d/ubuntu.sources
sudo apt update
- name: Enable source repository
if: ${{ matrix.os != 'ubuntu-24.04' }}
run: |
cat /etc/apt/sources.list
sudo sed -i"" -e "s/# deb-src/deb-src/" /etc/apt/sources.list
sudo apt update
- name: Install addons
run: |
sudo apt-get build-dep -y fcitx5
sudo apt-get install -y liblua5.3-dev
- name: Purge old imdkit
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt-get purge -y libxcb-imdkit*
- name: Install components
run: |
pwd
find .
./test/setup.sh 5.0.8
- name: Build fcitx5-virtualkeyboard-ui with ENABLE_CUSTOM_LAYOUT
if: ${{ matrix.custom_layout == 'ON' }}
run: |
pwd
git branch -a
git checkout -b fcitx-5.0.8
cmake -B build -DCMAKE_INSTALL_PREFIX=/opt/fcitx508 -DENABLE_CUSTOM_LAYOUT=ON -DENABLE_WAYLAND=ON
make -C build -j$(nproc);
- name: Build fcitx5-virtualkeyboard-ui without ENABLE_CUSTOM_LAYOUT
if: ${{ matrix.custom_layout == 'OFF' }}
run: |
pwd
git branch -a
git checkout -b fcitx-5.0.8
cmake -B build -DCMAKE_INSTALL_PREFIX=/opt/fcitx508 -DENABLE_CUSTOM_LAYOUT=OFF -DENABLE_WAYLAND=ON
make -C build -j$(nproc);
- name: Running ctest
run: |
cd build; \
ctest -V
137 changes: 137 additions & 0 deletions test/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#!/bin/bash

set -xe

run() {
"$@"
result=$?
if [ $result -ne 0 ]
then
echo "Failed: $@ [$PWD]" >&2
exit $result
fi
return 0
}

build_with_autogen() {
TARGET=$1
cd $TARGET
run ./autogen.sh --prefix=/opt/fcitx508
run make -j$(nproc)
run sudo make install
cd -
}

build_with_cmake() {
TARGET=$1
cd $TARGET
OPTIONS=" -DCMAKE_INSTALL_PREFIX=/opt/fcitx508"
case $TARGET in
xcb-imdkit|fcitx5)
# use master
:
;;
libime)
# newer version can't build with fcitx-5.0.8
git submodule update --init
run git checkout 1.1.1
;;
fcitx5-chinese-addons)
OPTIONS="$OPTIONS -DCMAKE_PREFIX_PATH=/opt/fcitx508 -DENABLE_GUI=off"
run git checkout $FCITX_TARGET_VERSION
;;
*)
run git checkout $FCITX_TARGET_VERSION
;;
esac
run git branch -a
run cmake -B build $OPTIONS
run make -C build -j$(nproc)
run sudo make -C build install
cd -
}

MODULES="
xcb-imdkit
anthy-unicode
fcitx5
libime
fcitx5-lua
fcitx5-anthy
fcitx5-chewing
fcitx5-hangul
fcitx5-chinese-addons
"

FCITX_TARGET_VERSION=$1

case $FCITX_TARGET_VERSION in
5.0.8)
echo "::group::Install dependency packages"
sudo apt-get build-dep -y fcitx5
sudo apt-get purge -y libxcb-imdkit*
sudo apt-get install -y unicode-cldr-core itstool appstream # for fcitx5
sudo apt-get install -y libboost-program-options-dev libboost-dev libboost-iostreams-dev libboost-filesystem-dev \
liblua5.3-dev libopencc-dev # for libime
sudo apt-get install -y libchewing3-dev # for chewing
sudo apt-get install -y libhangul-dev # for hangul
sudo apt-get install -y libcurl4-openssl-dev # for chinese-addons
echo "::endgroup::"
for d in $MODULES; do
echo "BUILD: $d..."
export PKG_CONFIG_PATH=/opt/fcitx508/lib/pkgconfig
case $d in
anthy-unicode)
if [ ! -d $d ]; then
git clone https://github.com/fujiwarat/anthy-unicode.git
fi
echo "::group::Install anthy-unicode"
build_with_autogen $d
echo "::endgroup::"
;;
fcitx5-chinese-addons)
if [ ! -d $d ]; then
git clone https://github.com/fcitx/$d.git
fi
echo "::group::Install fcitx5-chinese-addons"
build_with_cmake $d
echo "::endgroup::"
;;
fcitx5)
if [ ! -d $d ]; then
git clone https://github.com/clear-code/fcitx5.git $d
fi
if [ ! -f /usr/share/ECM/find-modules/FindWaylandProtocols.cmake ] ; then
# curl -o FindWaylandProtocols.cmake https://raw.githubusercontent.com/KDE/extra-cmake-modules/master/find-modules/FindWaylandProtocols.cmake
sudo curl -o /usr/share/ECM/find-modules/FindWaylandProtocols.cmake \
https://raw.githubusercontent.com/KDE/extra-cmake-modules/master/find-modules/FindWaylandProtocols.cmake
fi
(cd $d && git checkout 5.0.8+virtual-keyboard-prerequisites)
echo "::group::Install fcitx5"
build_with_cmake $d
echo "::endgroup::"
;;
fcitx-anthy|fcitx-chewing|fcitx-hangul|fcitx-lua)
if [ ! -d $d ]; then
git clone https://github.com/fcitx/$d.git
fi
echo "::group::Install $d"
build_with_cmake $d
echo "::endgroup::"
;;
*)
if [ ! -d $d ]; then
git clone https://github.com/fcitx/$d.git
fi
echo "::group::Install $d"
build_with_cmake $d
echo "::endgroup::"
;;
esac
done
;;
*)
echo "Currently only fcitx-5.0.8 is supported."
exit 1
;;
esac
Loading