Linux release build #481
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
TARGET_ARCH: 'x86_64' | |
QT_VERSION: '6.5.3' | |
TCL_VERSION: '8.6' | |
SQLITE_VERSION: '3470100' | |
SQLITE_RELEASE_YEAR: '2024' | |
PYTHON_VERSION: '3.13' | |
PORTABLE_DIR: ${{ github.workspace }}/output/portable/SQLiteStudio | |
INSTALLBUILDER_DIR: ../ib | |
INSTALLBUILDER_URL: https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-24.3.0-linux-x64-installer.run | |
LIBSSL_DIR_URL: http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/ | |
LIBSSL_DEB: libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb | |
name: Linux release build | |
on: | |
workflow_dispatch: | |
inputs: | |
use_ccache: | |
description: 'Use ccache (for workflow debugging only!)' | |
required: false | |
type: boolean | |
schedule: | |
- cron: '30 3 * * 1' # run at 3:30 AM UTC every Monday | |
repository_dispatch: | |
types: [lin_release] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: 'x64' | |
- name: Qt installation dir | |
id: qt-installation-dir | |
run: echo "DIR=$(readlink -f ${{ github.workspace }}/..)" >> $GITHUB_OUTPUT | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
cache: true | |
version: ${{ env.QT_VERSION }} | |
host: 'linux' | |
dir: '${{ steps.qt-installation-dir.DIR }}' | |
setup-python: 'false' | |
extra: '--external 7z' | |
modules: 'qtimageformats' | |
- name: Install the InstalBuilder | |
shell: bash | |
run: | | |
curl -L ${{ env.INSTALLBUILDER_URL }} --output ib.run | |
chmod +x ib.run | |
./ib.run --mode unattended --prefix ${{ env.INSTALLBUILDER_DIR }} | |
${{ env.INSTALLBUILDER_DIR }}/bin/builder --version | |
echo "INSTALLER_SRC_PREFIX=$(pwd)" >> $GITHUB_ENV | |
echo "INSTALLER_BIN_PREFIX=${{ env.PORTABLE_DIR }}" >> $GITHUB_ENV | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.client_payload.branch }} | |
- name: Pre-download SQLite vanilla sourcecode | |
shell: bash | |
run: | | |
cd .. | |
curl -L http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-src-$SQLITE_VERSION.zip --output sqlite-src-$SQLITE_VERSION.zip | |
mkdir ext | |
unzip sqlite-src-$SQLITE_VERSION.zip | |
# Bugfix for #5145. The percentile extension was fixed, but the fix is not included in SQLite 3.47.1 source package. | |
cd sqlite-src-$SQLITE_VERSION/ext | |
rm -f misc/percentile.c | |
curl -L https://sqlite.org/src/raw/82531c62cd015b9cdca95ad6bb10c3a907ceb570d21ebd4fb7d634c809cfb089?at=percentile.c --output misc/percentile.c | |
- name: Prepare ccache | |
if: inputs.use_ccache || false | |
uses: hendrikmuhs/ccache-action@v1.2.8 | |
with: | |
key: lin_release | |
max-size: "24M" | |
- name: Configure ccache | |
if: inputs.use_ccache || false | |
run: | | |
echo "PATH=/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV | |
- name: Install SQLite3 | |
run: | | |
set -x | |
sudo rm -f /usr/lib/libsqlite* /usr/local/lib/libsqlite* /usr/include/sqlite* /usr/local/include/sqlite* /usr/lib/x86_64-linux-gnu/libsqlite* | |
wget http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-amalgamation-$SQLITE_VERSION.zip | |
unzip sqlite-amalgamation-$SQLITE_VERSION.zip | |
cd sqlite-amalgamation-$SQLITE_VERSION | |
gcc sqlite3.c -lpthread -ldl -lm -Os -fpic -shared -o libsqlite3.so \ | |
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \ | |
-DSQLITE_ENABLE_DBSTAT_VTAB \ | |
-DSQLITE_ENABLE_BYTECODE_VTAB \ | |
-DSQLITE_ENABLE_COLUMN_METADATA \ | |
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \ | |
-DSQLITE_ENABLE_FTS3 \ | |
-DSQLITE_ENABLE_FTS4 \ | |
-DSQLITE_ENABLE_FTS5 \ | |
-DSQLITE_ENABLE_GEOPOLY \ | |
-DSQLITE_ENABLE_JSON1 \ | |
-DSQLITE_ENABLE_RTREE \ | |
-DSQLITE_ENABLE_MATH_FUNCTIONS | |
strip libsqlite3.so | |
ls -l | |
sudo cp -P libsqlite3.so* /usr/local/lib/ | |
sudo cp *.h /usr/local/include/ | |
ls -l /usr/local/lib/libsqlite3* | |
ls -l /usr/local/include/sqlite* | |
- name: Compile additional SQLite3 extensions | |
shell: bash | |
run: | | |
cd ../sqlite-src-$SQLITE_VERSION/ext | |
FLAGS="-ldl -Os -fpic -shared -Imisc -I/usr/local/include -L/usr/local/lib -lsqlite3" | |
for f in compress; do | |
echo "gcc misc/$f.c $FLAGS -lz -o ../../ext/$f.so" | |
gcc misc/$f.c $FLAGS -lz -o ../../ext/$f.so | |
done | |
for f in csv decimal eval ieee754 percentile rot13 series sqlar uint uuid zorder; do | |
echo "gcc misc/$f.c $FLAGS -o ../../ext/$f.so" | |
gcc misc/$f.c $FLAGS -o ../../ext/$f.so | |
done | |
for f in icu; do | |
echo "gcc icu/$f.c $FLAGS $(pkg-config --libs --cflags icu-uc icu-io) -o ../../ext/$f.so" | |
gcc icu/$f.c $FLAGS `pkg-config --libs --cflags icu-uc icu-io` -o ../../ext/$f.so | |
done | |
ls -l ../../ext/ | |
- name: Install Tcl | |
run: sudo apt-get install -qq libtcl$TCL_VERSION tcl$TCL_VERSION-dev | |
- name: Install other tools/dependencies | |
run: | | |
sudo apt install libreadline-dev libncurses5-dev patchelf chrpath | |
echo "${{ github.workspace }}/../Qt/${{ env.QT_VERSION }}/gcc_64/bin" >> $GITHUB_PATH | |
- name: Prepare output dir | |
run: mkdir output output/build output/build/Plugins | |
- name: Compile SQLiteStudio3 | |
working-directory: output/build | |
run: | | |
qmake \ | |
$([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ | |
CONFIG+=portable \ | |
../../SQLiteStudio3 | |
make -j 4 | |
- name: Compile Plugins | |
working-directory: output/build/Plugins | |
run: | | |
qmake \ | |
$([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ | |
CONFIG+=portable \ | |
"INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ | |
../../../Plugins | |
make -j 1 | |
- name: Copy SQLite extensions to output dir | |
shell: bash | |
run: | | |
cp -R ../ext output/SQLiteStudio/extensions | |
- name: Prepare portable dir | |
working-directory: output | |
run: | | |
mkdir portable | |
cp -R SQLiteStudio portable/ | |
- name: Copy SQLite3 to portable dir | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: cp -P /usr/local/lib/libsqlite3.so* lib/ | |
- name: Copy SQLCipher's libcrypto to portable dir | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
LIBCRYPTO=$(ldd plugins/libDbSqliteCipher.so | grep crypto | awk '{print $3}') | |
REAL_LIBCRYPTO=$(readlink -e $LIBCRYPTO) | |
cp -P $REAL_LIBCRYPTO lib/$(basename -- $LIBCRYPTO) | |
- name: Copy Qt's libcrypto and libssl to portable dir (#4577) | |
run: | | |
wget ${{ env.LIBSSL_DIR_URL }}${{ env.LIBSSL_DEB }} | |
dpkg-deb -xv ${{ env.LIBSSL_DEB }} . | |
cp ./usr/lib/$TARGET_ARCH-linux-gnu/libssl.so.1.1 ${{ env.PORTABLE_DIR }}/lib/ | |
cp ./usr/lib/$TARGET_ARCH-linux-gnu/libcrypto.so.1.1 ${{ env.PORTABLE_DIR }}/lib/ | |
- name: Copy Qt to portable dir | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Core.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6DBus.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Concurrent.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Gui.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Network.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6PrintSupport.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Qml.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Wayland*Client*.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Widgets.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Xml.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6Svg.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6XcbQpa.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6OpenGL.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6OpenGLWidgets.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libQt6UiTools.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libicui18n.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libicuuc.so* lib/ | |
cp -P ${{ env.QT_ROOT_DIR }}/lib/libicudata.so* lib/ | |
- name: Copy Qt plugins to portable dir | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
mkdir platforms imageformats iconengines printsupport platformthemes platforminputcontexts wayland-decoration-client wayland-graphics-integration-client wayland-shell-integration tls | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/platforms/libqxcb.so platforms/libqxcb.so | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/platforms/libqwayland-*.so platforms/ | |
for f in qgif qicns qico qjpeg qsvg qtga qtiff qwbmp qwebp; do | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/imageformats/lib$f.so imageformats/lib$f.so | |
done | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/iconengines/libqsvgicon.so iconengines/libqsvgicon.so | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/printsupport/libcupsprintersupport.so printsupport/libcupsprintersupport.so | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/platformthemes/libqgtk3.so platformthemes/libqgtk3.so | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so platforminputcontexts/libcomposeplatforminputcontextplugin.so | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/wayland-decoration-client/*.so wayland-decoration-client/ | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/wayland-graphics-integration-client/*.so wayland-graphics-integration-client/ | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/wayland-shell-integration/*.so wayland-shell-integration/ | |
cp -P ${{ env.QT_ROOT_DIR }}/plugins/tls/libqopensslbackend.so tls/ | |
- name: Copy extra Qt dependencies to portable dir | |
shell: bash | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
libdir=/usr/lib/$TARGET_ARCH-linux-gnu | |
if ldd lib/libQt${QT_VERSION_MAJ}XcbQpa.so | grep -q libxcb-; then | |
# These are not installed by default on Xubuntu 22.04: | |
cp -P $libdir/libxcb-xkb.so* lib/ | |
cp -P $libdir/libxkbcommon.so* lib/ # libxkbcommon _is_ installed by default but must match the version of | |
cp -P $libdir/libxkbcommon-x11.so* lib/ # libxkbcommon-x11 which is not | |
fi | |
if ldd lib/libQt${QT_VERSION_MAJ}WaylandClient.so | grep -q libwayland-; then | |
# These must probably match the build system | |
cp -P $libdir/libwayland-client.so* lib/ | |
cp -P $libdir/libwayland-cursor.so* lib/ | |
cp -P $libdir/libffi.so* lib/ | |
fi | |
- name: Fix dependency paths | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
set -x | |
chrpath -k -r \$ORIGIN/../lib platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so wayland-*/*.so tls/*.so 2>&1 >/dev/null | |
chrpath -k -r \$ORIGIN lib/libicu*.*.* | |
chrpath -k -r \$ORIGIN lib/libcoreSQLiteStudio.so lib/libguiSQLiteStudio.so 2>&1 >/dev/null | |
chrpath -k -r \$ORIGIN/lib sqlitestudio 2>&1 >/dev/null | |
chrpath -k -r \$ORIGIN/lib sqlitestudiocli 2>&1 >/dev/null | |
chrpath -l platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so | |
chrpath -l lib/libicu*.*.* | |
chrpath -l lib/libcoreSQLiteStudio.so lib/libguiSQLiteStudio.so | |
chrpath -l sqlitestudio | |
chrpath -l sqlitestudiocli | |
- name: Final preparations for packaging | |
run: | | |
mkdir "${{ env.PORTABLE_DIR }}"/assets | |
cp SQLiteStudio3/guiSQLiteStudio/img/sqlitestudio_256.png "${{ env.PORTABLE_DIR }}"/assets/appicon.png | |
cp SQLiteStudio3/guiSQLiteStudio/img/sqlitestudio.svg "${{ env.PORTABLE_DIR }}"/assets/appicon.svg | |
- name: Final preparations for packaging | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
cp `ldd sqlitestudiocli | grep readline | awk '{print $3}'` lib/ | |
cp `ldd lib/libreadline* | grep tinfo | awk '{print $3}'` lib/ | |
strip lib/*.so sqlitestudio sqlitestudiocli platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so tls/*.so | |
# These may have no initial rpath/runpath so chrpath does not work on them | |
patchelf --set-rpath '$ORIGIN' \ | |
lib/libQt6Core.so.*.*.* \ | |
lib/libreadline* | |
- name: Determine SQLiteStudio version | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: echo "SQLITESTUDIO_VERSION=$(./sqlitestudiocli --version | cut -f 2 -d ' ')" >> $GITHUB_ENV | |
- name: Assemble portable package | |
shell: bash | |
working-directory: ${{ env.PORTABLE_DIR }}/.. | |
run: | | |
tar cf sqlitestudio-$SQLITESTUDIO_VERSION.tar SQLiteStudio | |
xz -z sqlitestudio-$SQLITESTUDIO_VERSION.tar | |
pwd | |
ls -l | |
- name: Create installer package | |
shell: bash | |
env: | |
IB_LICENSE: ${{ secrets.INSTALLER_LICENSE }} | |
run: | | |
echo "$IB_LICENSE" > lic.xml | |
${{ env.INSTALLBUILDER_DIR }}/bin/builder build SQLiteStudio-installer.xml \ | |
--license lic.xml \ | |
--setvars project.outputDirectory=$(pwd) \ | |
--setvars project.version=$SQLITESTUDIO_VERSION | |
ls -l | |
- name: SHA256 checksums | |
shell: bash | |
run: | | |
sha256sum output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz | |
sha256sum SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz | |
path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz | |
- name: Upload installer artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run | |
path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run |