Skip to content

Commit f88986a

Browse files
committed
Merge remote-tracking branch 'origin/dev'
2 parents 2f4ec4b + 7084aaa commit f88986a

94 files changed

Lines changed: 3918 additions & 831 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: Build Debian package (Ubuntu x64, Qt5)
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build-omodsim:
10+
name: Build OpenModSim deb package version '${{ github.ref_name }}' with Qt5
11+
runs-on: ubuntu-latest
12+
container:
13+
image: ubuntu:20.04
14+
15+
env:
16+
QT_VERSION: "5.15.2"
17+
QT_HOST: "linux"
18+
QT_TARGET: "desktop"
19+
QT_ARCH: "gcc_64"
20+
QT_INSTALL_DIR: "/opt/Qt"
21+
CMAKE_COMPILER: "gcc_64"
22+
CMAKE_GENERATOR: "Ninja"
23+
BUILD_TYPE: "Release"
24+
DEB_REVISION: "1"
25+
DEB_ARCH: "amd64"
26+
DEB_PACKAGE_NAME: "qt5-omodsim"
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
ref: ${{ github.ref_name }}
33+
34+
- name: Extract version from CMakeLists.txt
35+
id: extract_version
36+
run: |
37+
FULL_VERSION=$(grep -oP 'VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' omodsim/CMakeLists.txt)
38+
39+
if [ "${GITHUB_REF_NAME}" = "dev" ]; then
40+
MAJOR_MINOR=$(echo "$FULL_VERSION" | cut -d. -f1,2)
41+
APP_VERSION="${MAJOR_MINOR}~dev"
42+
else
43+
APP_VERSION="$FULL_VERSION"
44+
fi
45+
46+
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
47+
echo "Extracted version: $APP_VERSION"
48+
49+
- name: Install dependencies
50+
run: |
51+
export DEBIAN_FRONTEND=noninteractive
52+
apt-get update
53+
apt-get install -y \
54+
git build-essential ninja-build cmake python3-pip patchelf rsync \
55+
dh-make debhelper debhelper-compat lintian fakeroot \
56+
libglu1-mesa libgl1-mesa-dev libxkbcommon0 libxkbcommon-x11-0 \
57+
libxcb1 libxcb-xinerama0 libxcb-cursor0 libxcb-keysyms1 libxcb-xfixes0 \
58+
libxcb-shape0 libxcb-render-util0 libxcb-icccm4 libxcb-image0 \
59+
libfontconfig1 libfreetype6 libx11-6 libxext6 libxrender1 \
60+
zlib1g-dev libpng-dev libjpeg-dev libdbus-1-3 \
61+
libwayland-cursor0 libwayland-egl1-mesa \
62+
libgtk-3-0 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpango-1.0-0 libatk1.0-0 libcairo2 libcairo-gobject2 \
63+
libcups2 \
64+
odbcinst libodbc1 \
65+
libpq5 libmysqlclient21
66+
67+
- name: Upgrade pip
68+
run: python3 -m pip install --upgrade pip
69+
70+
- name: Install aqtinstall
71+
run: python3 -m pip install aqtinstall
72+
73+
- name: Download Qt
74+
run: |
75+
mkdir -p ${{ env.QT_INSTALL_DIR }}
76+
aqt install-qt \
77+
${{ env.QT_HOST }} \
78+
${{ env.QT_TARGET }} \
79+
${{ env.QT_VERSION }} \
80+
${{ env.QT_ARCH }} \
81+
-O ${{ env.QT_INSTALL_DIR }}
82+
83+
- name: Add Qt to PATH
84+
run: echo "${{ env.QT_INSTALL_DIR }}/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}/bin" >> $GITHUB_PATH
85+
86+
- name: Install cmake 3.26
87+
run: |
88+
apt-get remove -y cmake
89+
apt-get install -y wget
90+
wget https://github.com/Kitware/CMake/releases/download/v3.26.5/cmake-3.26.5-linux-x86_64.sh
91+
sh cmake-3.26.5-linux-x86_64.sh --skip-license --prefix=/usr/local
92+
cmake --version
93+
94+
- name: Set BUILD_DIR
95+
run: echo "BUILD_DIR=build-omodsim-Qt_${{ env.QT_VERSION }}_${{ env.CMAKE_COMPILER }}bit-${{ env.BUILD_TYPE }}" >> $GITHUB_ENV
96+
97+
- name: Configure project
98+
run: |
99+
cmake omodsim -B ${{ env.BUILD_DIR }} \
100+
-G "${{ env.CMAKE_GENERATOR }}" \
101+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
102+
-DCMAKE_PREFIX_PATH=${{ env.QT_INSTALL_DIR }}/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}
103+
104+
- name: Build
105+
run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel
106+
107+
- name: Set BUILD_DEB_DIR
108+
run: echo "BUILD_DEB_DIR=build-deb-package-Qt_${{ env.QT_VERSION }}_${{ env.CMAKE_COMPILER }}bit" >> $GITHUB_ENV
109+
110+
- name: Set DEB_SRC_DIR
111+
run: echo "DEB_SRC_DIR=${{ env.BUILD_DEB_DIR }}/${{ env.DEB_PACKAGE_NAME }}-${{ env.APP_VERSION }}-${{ env.DEB_REVISION }}_${{ env.DEB_ARCH }}" >> $GITHUB_ENV
112+
113+
- name: Create DEB build directories
114+
run: |
115+
mkdir -p ${{ env.DEB_SRC_DIR }}/debian
116+
mkdir -p ${{ env.DEB_SRC_DIR }}/usr
117+
118+
- name: Copy files to DEB_SRC_DIR
119+
run: |
120+
cp -r .pkg/deb/* ${{ env.DEB_SRC_DIR }}/debian
121+
cp -r .pkg/usr/* ${{ env.DEB_SRC_DIR }}/usr
122+
123+
- name: Install cqtdeployer from sources
124+
run: |
125+
git clone https://github.com/QuasarApp/CQtDeployer.git
126+
cd CQtDeployer
127+
git checkout v1.6.2365
128+
git submodule update --init --recursive
129+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
130+
-DCMAKE_PREFIX_PATH=${{ env.QT_INSTALL_DIR }}/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }} \
131+
-DBUILD_SHARED_LIBS=OFF \
132+
-DCQT_DEPLOYER_TESTS=OFF \
133+
-DCMAKE_INSTALL_PREFIX=/usr/local \
134+
-DCMAKE_INSTALL_RPATH=${{ env.QT_INSTALL_DIR }}/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}/lib \
135+
-Wno-dev
136+
cmake --build build --parallel
137+
cmake --install build
138+
139+
- name: Bundle Qt libraries and plugins throught cqtdeployer
140+
run: |
141+
CQtDeployer -bin ${{ env.BUILD_DIR }}/omodsim \
142+
-targetDir ${{ env.DEB_SRC_DIR }}/opt/OpenModSim \
143+
-libDir ${{ env.QT_INSTALL_DIR }}/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}/lib \
144+
-ignore libcrypto.so.3,libmysqlclient.so.21,libpq.so.5,libssl.so.3,libqsqlmimer.so,libqsqlmysql.so,libqsqlodbc.so,libqsqlpsql.so \
145+
-extraLibs icudata,icui18n,icuuc,libxcb-util
146+
147+
- name: Copy OpenModsim docs
148+
run: rsync -a "${{ env.BUILD_DIR }}/docs/" "${{ env.DEB_SRC_DIR }}/opt/OpenModSim/docs/"
149+
150+
- name: Create Debian control file
151+
run: |
152+
sed -e "s|@PACKAGE_NAME@|${{ env.DEB_PACKAGE_NAME }}|g" \
153+
-e "s|@PACKAGE_SOURCE@|${{ env.DEB_PACKAGE_NAME }}|g" \
154+
${{ env.DEB_SRC_DIR }}/debian/control.in > ${{ env.DEB_SRC_DIR }}/debian/control
155+
rm ${{ env.DEB_SRC_DIR }}/debian/control.in
156+
cat -n ${{ env.DEB_SRC_DIR }}/debian/control
157+
158+
- name: Create Debian changelog file
159+
run: |
160+
sed -e "s|@PACKAGE_NAME@|${{ env.DEB_PACKAGE_NAME }}|g" \
161+
-e "s|@APP_VERSION@|${{ env.APP_VERSION }}|g" \
162+
-e "s|@DEB_REVISION@|${{ env.DEB_REVISION }}|g" \
163+
-e "s|@RELEASE_DATE@|$(date -R)|g" \
164+
${{ env.DEB_SRC_DIR }}/debian/changelog.in > ${{ env.DEB_SRC_DIR }}/debian/changelog
165+
rm ${{ env.DEB_SRC_DIR }}/debian/changelog.in
166+
cat -n ${{ env.DEB_SRC_DIR }}/debian/changelog
167+
168+
- name: Create Debian copyrigth file
169+
run: |
170+
sed -e "s|@PACKAGE_NAME@|${{ env.DEB_PACKAGE_NAME }}|g" \
171+
-e "s|@RELEASE_YEAR@|$(date +%Y)|g" \
172+
${{ env.DEB_SRC_DIR }}/debian/copyrigth.in > ${{ env.DEB_SRC_DIR }}/debian/copyrigth
173+
rm ${{ env.DEB_SRC_DIR }}/debian/copyrigth.in
174+
cat -n ${{ env.DEB_SRC_DIR }}/debian/copyrigth
175+
176+
- name: Create Debian rules file
177+
run: |
178+
sed -e "s|@QT_LIB_PATH@|${{ env.QT_INSTALL_DIR }}/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}/lib|g" \
179+
${{ env.DEB_SRC_DIR }}/debian/rules.in > ${{ env.DEB_SRC_DIR }}/debian/rules
180+
rm ${{ env.DEB_SRC_DIR }}/debian/rules.in
181+
cat -n ${{ env.DEB_SRC_DIR }}/debian/rules
182+
183+
- name: Patch binary file
184+
run: patchelf --set-rpath /opt/OpenModSim/lib "${{ env.DEB_SRC_DIR }}/opt/OpenModSim/bin/omodsim"
185+
186+
- name: Build DEB package
187+
working-directory: ${{ env.DEB_SRC_DIR }}
188+
run: dpkg-buildpackage -us -uc -tc -b
189+
190+
- name: Upload DEB package
191+
uses: actions/upload-artifact@v4
192+
if: success()
193+
with:
194+
name: ${{ env.DEB_PACKAGE_NAME }}_${{ env.APP_VERSION }}-${{ env.DEB_REVISION }}_${{ env.DEB_ARCH }}
195+
path: ${{ env.BUILD_DEB_DIR }}/${{ env.DEB_PACKAGE_NAME }}_${{ env.APP_VERSION }}-${{ env.DEB_REVISION }}_${{ env.DEB_ARCH }}.deb

0 commit comments

Comments
 (0)