Linux release build #407
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' | |
TCL_VERSION: '8.6.13' | |
SQLITE_VERSION: '3410200' | |
SQLITE_RELEASE_YEAR: '2023' | |
PYTHON_VERSION: '3.9' | |
ICU_VERSION: '74.1' | |
PORTABLE_DIR: ${{ github.workspace }}/output/portable/SQLiteStudio | |
INSTALLBUILDER_DIR: ../ib | |
INSTALLBUILDER_URL: https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-23.4.0-linux-x64-installer.run | |
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-latest | |
container: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
binary_compatibility: | |
- "glibc_2.23" # Ubuntu 16.04 | |
- "glibc_2.27" # Ubuntu 18.04 | |
#- "glibc_2.31" # Ubuntu 20.04, Debian 11 | |
qt_version: | |
- "5.15.2" | |
- "5.15.12" | |
exclude: | |
- binary_compatibility: glibc_2.23 | |
qt_version: "5.15.2" | |
- binary_compatibility: glibc_2.27 | |
qt_version: "5.15.12" | |
include: | |
- binary_compatibility: glibc_2.23 | |
container: ghcr.io/${{ github.repository }}/gha-build-runner-xenial | |
icu_version_short: 66 | |
- binary_compatibility: glibc_2.27 | |
container: ghcr.io/${{ github.repository }}/gha-build-runner-bionic | |
icu_version_short: 60 | |
#- binary_compatibility: glibc_2.31 | |
# container: ghcr.io/${{ github.repository }}/gha-build-runner-focal | |
# icu_version_short: 66 | |
steps: | |
- name: Configure environment | |
run: | | |
{ | |
case ${{ matrix.binary_compatibility }},${{ matrix.qt_version }} in | |
*,5.15.2) echo USE_PREBUILT_QT=0; echo ICU_VERSION_SHORT=56 ;; | |
*) echo USE_PREBUILT_QT=1; echo ICU_VERSION_SHORT=${ICU_VERSION%%.*} ;; | |
esac | |
echo TCL_VERSION_SHORT="${TCL_VERSION%.*}" | |
echo TARGET_ARCH=x86_64 | |
} >> $GITHUB_ENV | |
- name: Configure prebuilt python${{ env.PYTHON_VERSION }} | |
run: | | |
echo "pythonLocation=/usr/" >> $GITHUB_ENV | |
- name: Qt installation dir | |
if: env.USE_PREBUILT_QT == 0 | |
id: qt-installation-dir | |
run: echo "DIR=$(readlink -f ${{ github.workspace }}/..)" >> $GITHUB_OUTPUT | |
- name: Install Qt with aqtinstall | |
if: env.USE_PREBUILT_QT == 0 | |
uses: jurplel/install-qt-action@v3 | |
with: | |
cache: true | |
version: ${{ matrix.qt_version }} | |
host: 'linux' | |
dir: '${{ steps.qt-installation-dir.outputs.DIR }}' | |
aqtversion: '==3.0.*' | |
py7zrversion: '==0.20.*' | |
setup-python: 'false' | |
- name: Install apt dependencies for prebuilt Qt | |
if: env.USE_PREBUILT_QT == 1 | |
run: | | |
sudo apt-get -y install \ | |
libgl1-mesa-dev \ | |
libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ | |
libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 \ | |
libxkbcommon0 libxkbcommon-x11-0 | |
- name: Download prebuilt Qt | |
if: env.USE_PREBUILT_QT == 1 | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: lin_qt.yml | |
workflow_conclusion: success | |
name: qt5-${{ matrix.qt_version }}-${{ matrix.binary_compatibility }}.${{ env.TARGET_ARCH }}.tar.zst | |
- name: Install prebuilt Qt | |
if: env.USE_PREBUILT_QT == 1 | |
run: | | |
zstdcat qt5-*.tar.zst | tar -C / -xv | |
echo "Qt5_Dir=/usr/local" >> $GITHUB_ENV | |
- 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 | |
- name: Prepare ccache | |
if: inputs.use_ccache || false | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: lin_release-${{ matrix.binary_compatibility }} | |
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: | | |
sudo rm -f /usr/lib/libsqlite* /usr/local/lib/libsqlite* /usr/include/sqlite* /usr/local/include/sqlite* /usr/lib/$TARGET_ARCH-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 | |
sudo cp -P libsqlite3.so* /usr/local/lib/ | |
sudo cp *.h /usr/local/include/ | |
- name: Install extension dependencies | |
run: | | |
if [ "$USE_PREBUILT_QT" = 0 ]; then | |
sudo apt-get -y install libicu-dev libicu${{ matrix.icu_version_short }} | |
fi | |
sudo apt-get -y install zlib1g-dev | |
- name: Compile additional SQLite3 extensions | |
shell: bash | |
run: | | |
cd .. | |
mkdir ext | |
unzip sqlite-src-$SQLITE_VERSION.zip -x '*.test' | |
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 other tools/dependencies | |
run: | | |
sudo apt install -y libreadline-dev libncurses5-dev patchelf chrpath | |
if [ $USE_PREBUILT_QT = 0 ]; then | |
echo "${{ github.workspace }}/../Qt/${{ matrix.qt_version }}/gcc_64/bin" >> $GITHUB_PATH | |
fi | |
- 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 $(nproc) | |
- name: Compile Plugins | |
working-directory: output/build/Plugins | |
run: | | |
qmake \ | |
$([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ | |
CONFIG+=portable \ | |
PYTHON_VERSION=$PYTHON_VERSION "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ | |
../../../Plugins | |
make -j 1 # Parallel plugin build crashes randomly | |
- 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/ | |
# Update PORTABLE_DIR since we're in a container | |
echo "PORTABLE_DIR=$(cd portable/SQLiteStudio; pwd -P)" >> $GITHUB_ENV | |
- 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 prebuilt OpenSSL to portable dir | |
if: env.USE_PREBUILT_QT == 1 | |
working-directory: /usr/local/lib | |
run: | | |
cp libssl.so.1.1 libcrypto.so.1.1 $PORTABLE_DIR/lib/ | |
- name: Copy Qt's libcrypto and libssl to portable dir (#4577) | |
if: env.USE_PREBUILT_QT == 0 | |
run: | | |
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb | |
dpkg-deb -xv libssl1.1_1.1.1f-1ubuntu2.20_amd64.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.Qt5_Dir }}/lib/libQt5Core.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5DBus.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Concurrent.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Gui.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Network.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5PrintSupport.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Qml.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Widgets.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Xml.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5Svg.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libQt5XcbQpa.so* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libicui18n.so.$ICU_VERSION_SHORT* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libicuuc.so.$ICU_VERSION_SHORT* lib/ | |
cp -P ${{ env.Qt5_Dir }}/lib/libicudata.so.$ICU_VERSION_SHORT* lib/ | |
- name: Copy Qt plugins to portable dir | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
mkdir platforms imageformats iconengines printsupport platformthemes platforminputcontexts | |
cp -P ${{ env.Qt5_Dir }}/plugins/platforms/libqxcb.so platforms/libqxcb.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqgif.so imageformats/libqgif.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqicns.so imageformats/libqicns.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqico.so imageformats/libqico.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqjpeg.so imageformats/libqjpeg.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqsvg.so imageformats/libqsvg.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqtga.so imageformats/libqtga.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqtiff.so imageformats/libqtiff.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/iconengines/libqsvgicon.so iconengines/libqsvgicon.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/printsupport/libcupsprintersupport.so printsupport/libcupsprintersupport.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/platformthemes/libqgtk3.so platformthemes/libqgtk3.so | |
cp -P ${{ env.Qt5_Dir }}/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so platforminputcontexts/libcomposeplatforminputcontextplugin.so | |
- name: Copy extra Qt dependencies to portable dir | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
libdir=/usr/lib/$TARGET_ARCH-linux-gnu | |
if ldd lib/libQt5XcbQpa.so | grep -q libxcb-; then | |
# These are not installed by default on my Xubuntu 16.04: | |
cp -P $libdir/libxcb-icccm.so* lib/ | |
cp -P $libdir/libxcb-image.so* lib/ | |
cp -P $libdir/libxcb-keysyms.so* lib/ | |
cp -P $libdir/libxcb-randr.so* lib/ | |
cp -P $libdir/libxcb-render-util.so* lib/ | |
cp -P $libdir/libxcb-xinerama.so* lib/ | |
# These are not installed by default on my Xubuntu 22.04: | |
if [ "$USE_PREBUILT_QT" = 0 ]; then apt-get install -y libxkbcommon-x11-0; fi | |
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 | |
- name: Fix dependency paths | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
chrpath -k -r \$ORIGIN/../lib platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so 2>&1 >/dev/null | |
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/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 does not like binaries processed by patchelf, so strip first | |
strip lib/*.so sqlitestudio sqlitestudiocli platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so | |
patchelf --set-rpath '$ORIGIN' lib/libreadline* | |
- name: Determine SQLiteStudio version | |
working-directory: ${{ env.PORTABLE_DIR }} | |
run: | | |
SQLITESTUDIO_VERSION="$(./sqlitestudiocli --version | cut -f 2 -d ' ')" | |
[ -n "$SQLITESTUDIO_VERSION" ] || exit 1 | |
echo "SQLITESTUDIO_VERSION=$SQLITESTUDIO_VERSION" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=$SQLITESTUDIO_VERSION-qt${{ matrix.qt_version }}-linux_${{ matrix.binary_compatibility }}.$TARGET_ARCH" >> $GITHUB_ENV | |
- name: Assemble portable package | |
shell: bash | |
working-directory: ${{ env.PORTABLE_DIR }}/.. | |
run: | | |
tar cf - SQLiteStudio | xz > sqlitestudio-$PACKAGE_VERSION.tar.xz | |
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 | |
mv SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run \ | |
SQLiteStudio-$PACKAGE_VERSION-installer.run | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: sqlitestudio-${{ env.PACKAGE_VERSION }}.tar.xz | |
path: output/portable/sqlitestudio-${{ env.PACKAGE_VERSION }}.tar.xz | |
- name: Upload installer artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: SQLiteStudio-${{ env.PACKAGE_VERSION }}-installer.run | |
path: SQLiteStudio-${{ env.PACKAGE_VERSION }}-installer.run |