Skip to content

Commit

Permalink
Script: Add build_depend.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Feb 13, 2025
1 parent 2f24d0f commit 5bc2a41
Show file tree
Hide file tree
Showing 6 changed files with 456 additions and 172 deletions.
124 changes: 44 additions & 80 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Author: Kang Lin <[email protected]>

name: appimage

on:
Expand All @@ -16,19 +18,27 @@ jobs:
matrix:
BUILD_TYPE: [Release]
qt_version: [6.8.2]
qt_arch: [linux_gcc_64]

# See: https://docs.github.com/zh/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
os: [ubuntu-24.04, ubuntu-24.04-arm]
include:
- os: ubuntu-24.04
qt_arch: "linux_gcc_64"
- os: ubuntu-24.04-arm
qt_arch: "linux_gcc_arm64"

# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
# See: https://github.com/actions/runner-images/
runs-on: ubuntu-24.04
runs-on: ${{matrix.os}}

env:
BUILD_TYPE: ${{matrix.BUILD_TYPE}}
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install
TOOLS_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.os}}_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}}
artifact_name: build_appimage_${{matrix.os}}
qt_modules: 'qtscxml'
SerialPortAssistant_VERSION: v0.5.29
artifact_name: build_appimage

# Map the job outputs to step outputs
outputs:
Expand All @@ -38,118 +48,72 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
submodules: recursive

- name: Make directories
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{env.BUILD_DIR}}
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
${{env.TOOLS_DIR}}/linuxdeploy-*
key: install_appimage

- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: Install apt packages
- name: Install base dependency libraries
run: |
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt install -y -q cmake build-essential xvfb xpra \
libgl1-mesa-dev libglx-dev libglu1-mesa-dev libvulkan-dev \
cmake debhelper fakeroot graphviz \
libxkbcommon-dev libxkbcommon-x11-dev xorg-dev libx11-xcb-dev \
libx11-dev libxfixes-dev libxcb-randr0-dev libxcb-shm0-dev \
libxcb-xinerama0-dev libxcb-composite0-dev libxcomposite-dev \
libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev \
libxcb-cursor-dev libxcb-xkb-dev libxcb-keysyms1-dev \
libxcb-* libxcb-cursor0 \
libwayland-dev libwayland-egl-backend-dev waylandpp-dev \
libxkbcommon-dev mesa-common-dev \
libcmark-dev cmark libfuse-dev libfuse3-dev
sudo ./Script/build_depend.sh --apt_update --base --default \
--install ${{env.INSTALL_DIR}} \
--source ${{env.SOURCE_DIR}} \
--tools ${{env.TOOLS_DIR}} \
--build ${{env.BUILD_DIR}}
- name: Install Qt
uses: jurplel/install-qt-action@v3
if: false
with:
dir: '${{env.TOOSL_DIR}}/qt'
aqtversion: '==3.1.*'
dir: '${{env.TOOLS_DIR}}/qt'
version: ${{matrix.qt_version}}
host: 'linux'
target: 'desktop'
arch: ${{matrix.qt_arch}}
# See: https://ddalcino.github.io/aqt-list-server/
modules: 'qtscxml qtmultimedia qtimageformats qtserialport qt5compat'
modules: ${{env.qt_modules}}
cache: true
cache-key-prefix: cached-qt

- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
${{env.TOOSL_DIR}}
key: install_ubuntu_${{matrix.BUILD_TYPE}}

- name: linuxdeploy
run: |
cd ${{env.TOOSL_DIR}}
if [ ! -f linuxdeploy-`uname -m`.AppImage ]; then
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/2.0.0-alpha-1-20241106/linuxdeploy-`uname -m`.AppImage
chmod u+x linuxdeploy-`uname -m`.AppImage
fi
if [ ! -f linuxdeploy-plugin-qt-`uname -m`.AppImage ]; then
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/2.0.0-alpha-1-20241106/linuxdeploy-plugin-qt-`uname -m`.AppImage
chmod u+x linuxdeploy-plugin-qt-`uname -m`.AppImage
fi
cache-key-prefix: cached-qt_${{matrix.qt_arch}}

- name: build appimage
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
cmake ${{github.workspace}} \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=/usr
cmake --build . --parallel $(nproc)
cmake --install . --config Release --component DependLibraries --prefix AppDir/usr
cmake --install . --config Release --component Runtime --prefix AppDir/usr
cmake --install . --config Release --component Application --prefix AppDir/usr
# See: https://github.com/linuxdeploy/linuxdeploy-plugin-qt
export QMAKE=$Qt6_DIR/bin/qmake
export EXTRA_PLATFORM_PLUGINS="libqxcb.so"
# Icons from theme are not displayed in QtWidgets Application: https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/17
export EXTRA_QT_MODULES="svg"
${{env.TOOSL_DIR}}/linuxdeploy-`uname -m`.AppImage --appdir=AppDir -v0 \
--deploy-deps-only=AppDir/usr/lib/`uname -m`-linux-gnu \
--plugin qt \
--output appimage
mv Serial_Port_Assistant-`uname -m`.AppImage ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage
chmod a+x ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage
md5sum ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage > ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage.md5sum
export QMAKE=/usr/bin/qmake
${{github.workspace}}/Script/build_appimage.sh
md5sum SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage > ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage.md5sum
- name: update configure file
if: ${{ matrix.BUILD_TYPE == 'Release'}}
#continue-on-error: true
run: |
#sudo apt update -y -qq
#sudo apt-get install -y -qq xvfb xpra
sudo Xvfb :99 -ac &
export DISPLAY=:99.0
sudo Xvfb :96 -ac -screen 0 1200x900x24 &
export DISPLAY=:96.0
echo "Update update_linux.json ......"
export QT_XCB_GL_INTEGRATION=none
export QT_DEBUG_PLUGINS=1
#export QT_DEBUG_PLUGINS=1
ARCH=`uname -m`
MD5SUM=`cat SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_$ARCH.AppImage.md5sum|awk '{print $1}'`
echo "MD5SUM SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_$ARCH.AppImage: ${MD5SUM}"
#echo "Enable core dump ......"
#ulimit -c unlimited
#echo "# sudo sysctl -w kernel.core_pattern=core"
#sudo sysctl -w kernel.core_pattern=${{github.workspace}}/core
echo "Generate update configure file ......"
./SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_$ARCH.AppImage \
-f "${{github.workspace}}/update_appimage_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.json" \
Expand Down
94 changes: 43 additions & 51 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ jobs:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
os: [ubuntu-24.04, ubuntu-24.04-arm, ubuntu-22.04-arm]

# See: https://docs.github.com/zh/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
# See: https://github.com/actions/runner-images/
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}

env:
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_ubuntu_${{matrix.BUILD_TYPE}}
TOOLS_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.os}}_${{matrix.BUILD_TYPE}}
artifact_name: build_${{matrix.os}}
SerialPortAssistant_VERSION: 0.5.29
artifact_name: build_ubuntu

# Map the job outputs to step outputs
outputs:
Expand All @@ -37,61 +40,67 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
submodules: recursive

- name: Make directories
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{env.BUILD_DIR}}
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Install apt packages
- name: Install dependency libraries
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y -q cmake build-essential xvfb xpra \
libglu1-mesa-dev libpulse-mainloop-glib0 \
cmake debhelper fakeroot \
qt6-tools-dev qt6-tools-dev-tools qt6-base-dev qt6-base-dev-tools \
qt6-l10n-tools qt6-translations-l10n qt6-scxml-dev libqt6svg6-dev \
libqt6serialport6-dev \
libxkbcommon-dev libxkbcommon-x11-dev xorg-dev libx11-xcb-dev \
libx11-dev libxfixes-dev \
libcmark-dev cmark
sudo ./Script/build_depend.sh --apt_update --base --default \
--install ${{env.INSTALL_DIR}} \
--source ${{env.SOURCE_DIR}} \
--tools ${{env.TOOLS_DIR}} \
--build ${{env.BUILD_DIR}}
if [ "ubuntu-22.04-arm" != ${{matrix.os}} ]; then
sudo apt install -y -q qt6-5compat-dev
fi
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-ubuntu
key: install_ubuntu_${{matrix.os}}_${{matrix.BUILD_TYPE}}

- name: build_debpackage.sh
working-directory: ${{github.workspace}}
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
./Script/build_debpackage.sh
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: build SerialPortAssistant
- name: build_debpackage.sh
working-directory: ${{github.workspace}}
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
cd ${{github.workspace}}
./build_debpackage.sh
cp ../serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb
./Script/build_debpackage.sh
- name: update configure file
working-directory: ${{github.workspace}}
if: ${{ matrix.BUILD_TYPE == 'Release' }}
run: |
sudo Xvfb :99 -ac &
export DISPLAY=:99.0
sudo apt install ./serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb
sudo Xvfb :97 -ac -screen 0 1200x900x24 &
export DISPLAY=:97.0
export ARCH=`dpkg --print-architecture`
export OS_NAME="ubuntu-`lsb_release -s -r`"
cp ../serialportassistant_${{env.SerialPortAssistant_VERSION}}_${ARCH}.deb serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb
sudo apt install ./serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb
echo "test ......"
./test/test_linux.sh
echo "Update configure file ......"
MD5=`md5sum serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb | awk '{print $1}'`
MD5=`md5sum serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb | awk '{print $1}'`
export QT_XCB_GL_INTEGRATION=none
ulimit -c unlimited
echo "# sudo sysctl -w kernel.core_pattern=core"
Expand All @@ -101,43 +110,26 @@ jobs:
--foc 1 \
--md5 ${MD5} \
-m "${{env.SerialPortAssistant_VERSION}}" \
-p serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb \
-u "https://github.com/KangLin/SerialPortAssistant/releases/download/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb;https://sourceforge.net/projects/SerialPortAssistant/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb?viasf=1"
-p serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb \
-u "https://github.com/KangLin/SerialPortAssistant/releases/download/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb;https://sourceforge.net/projects/SerialPortAssistant/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb?viasf=1"
- name: Update version configure file
if: ${{ matrix.BUILD_TYPE == 'Release'}}
working-directory: ${{github.workspace}}
run: |
sudo Xvfb :99 -ac &
export DISPLAY=:99.0
sudo Xvfb :98 -ac &
export DISPLAY=:98.0
/opt/SerialPortAssistant/bin/SerialPortAssistant.sh \
-f "${{github.workspace}}/version.json" \
--foc 0 \
--pv ${{env.SerialPortAssistant_VERSION}}
- name: dump core
if: false
working-directory: ${{github.workspace}}
run: |
gdb /opt/SerialPortAssistant/bin/SerialPortAssistant core
#- name: Generate appimage
# run: |
# cd debian/serialportassistant/opt
# URL_LINUXDEPLOYQT=https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
# wget -c -nv ${URL_LINUXDEPLOYQT} -O linuxdeployqt.AppImage
# chmod a+x linuxdeployqt.AppImage
# cd SerialPortAssistant
# ../linuxdeployqt.AppImage share/applications/*.desktop \
# -qmake=qmake -appimage -verbose
# cp SerialPort_Assistant-${VERSION}-x86_64.AppImage ${{github.workspace}}/.

- name: update
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_amd64.deb
${{github.workspace}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb
${{github.workspace}}/update_ubuntu.json
${{github.workspace}}/version.json
Loading

0 comments on commit 5bc2a41

Please sign in to comment.