MacOSX release build #396
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: | |
QT_VERSION: '5.15.2' | |
TCL_VERSION: '8.6' | |
SQLITE_VERSION: '3410200' | |
SQLITE_RELEASE_YEAR: '2023' | |
PYTHON_VERSION: '3.9' | |
ICU_VERSION: '73.1' | |
PORTABLE_DIR: ${{ github.workspace }}/output/portable/SQLiteStudio | |
INSTALLBUILDER_DIR: ../ib | |
INSTALLBUILDER_URL: https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-23.4.0-osx-installer.dmg | |
name: MacOSX release build | |
on: | |
workflow_dispatch: | |
inputs: | |
use_ccache: | |
description: 'Use ccache (for workflow debugging only!)' | |
required: false | |
type: boolean | |
schedule: | |
- cron: '0 3 * * 1' # run at 3 AM UTC every Monday | |
repository_dispatch: | |
types: [mac_release] | |
jobs: | |
build: | |
runs-on: macos-11 | |
strategy: | |
fail-fast: false | |
matrix: | |
binary_compatibility: | |
- "darwin_16.x86_64" # macOS 10.12, the earliest version supported by QT 5.13 | |
- "darwin_17.x86_64" # macOS 10.13, the earliest version supported by QT 5.15 | |
#- "darwin_18.x86_64" # macOS 10.14, the earliest version supported by QT 6.4 | |
#- "darwin_20.x86_64" # macOS 11, the earliest version supported by QT 6.5 | |
- "darwin_20.arm64-x86_64" # macOS 11, the earliest ARM64 version | |
include: | |
# this list is meant to be synchronized with mac_universal_deps.yml | |
- common_pkgs: | |
- brotli 1.0.9_2 | |
- dbus 1.14.6_0 | |
- double-conversion 3.3.0_0 | |
- freetype 2.12.1_0 | |
- gettext-runtime 0.21.1_0 | |
- giflib 4.2.3_0 | |
- glib2 2.76.3_0+x11 | |
- graphite2 1.3.14_0 | |
- harfbuzz 6.0.0_1 | |
- icu 73.1_1 | |
- jasper 4.0.0_1 | |
- lcms2 2.15_0 | |
- lerc 4.0.0_1 | |
- libdeflate 1.18_0 | |
- libedit 20221030-3.1_0 | |
- libffi 3.4.4_0 | |
- libiconv 1.17_0 | |
- libjpeg-turbo 2.1.5.1_0 | |
- libmng 2.0.3_1 | |
- libpng 1.6.39_0 | |
- ncurses 6.4_0 | |
- openssl3 3.1.1_0 | |
- pcre 8.45_0 | |
- pcre2 10.42_0 | |
- python39 3.9.17_0+lto+optimizations | |
- tcl 8.6.13_0+corefoundation+threads | |
- tiff 4.5.1_1 | |
- webp 1.3.0_1 | |
- xz 5.4.3_0 | |
- zstd 1.5.5_0 | |
- binary_compatibility: darwin_20.arm64-x86_64 | |
cflags: -arch arm64 -arch x86_64 | |
add_variants: "+universal" | |
dmg_postfix: "-macos11.universal" | |
qmake_flags: "QMAKE_APPLE_DEVICE_ARCHS=\"arm64 x86_64\"" | |
pkgs: | |
- qt5-qtbase 5.15.10_0+openssl | |
- qt5-qtdeclarative 5.15.10_0 | |
- qt5-qtimageformats 5.15.10_0 | |
- qt5-qtscript 5.15.10_0 | |
- qt5-qtsvg 5.15.10_0 | |
- qt5-qttools 5.15.10_0 | |
- binary_compatibility: darwin_17.x86_64 | |
cflags: -arch x86_64 | |
add_variants: "" | |
dmg_postfix: "" | |
qmake_flags: "" | |
pkgs: | |
- qt5-qtbase 5.15.10_0+openssl | |
- qt5-qtdeclarative 5.15.10_0 | |
- qt5-qtimageformats 5.15.10_0 | |
- qt5-qtscript 5.15.10_0 | |
- qt5-qtsvg 5.15.10_0 | |
- qt5-qttools 5.15.10_0 | |
- binary_compatibility: darwin_16.x86_64 | |
cflags: -arch x86_64 | |
add_variants: "" | |
dmg_postfix: "-macos10.12" | |
qmake_flags: "" | |
pkgs: | |
- legacy-support 1.0.10_0 | |
- qt513-qtbase 5.13.2_9+openssl | |
- qt513-qtdeclarative 5.13.2_0 | |
- qt513-qtimageformats 5.13.2_2 | |
- qt513-qtscript 5.13.2_0 | |
- qt513-qtsvg 5.13.2_0 | |
- qt513-qttools 5.13.2_0 | |
steps: | |
- name: Install the InstallBuilder | |
shell: bash | |
run: | | |
curl -L ${{ env.INSTALLBUILDER_URL }} --output ib.dmg | |
hdiutil attach ib.dmg | |
/Volumes/InstallBuilder\ Enterprise/*.app/Contents/MacOS/installbuilder.sh --mode unattended --prefix ${{ env.INSTALLBUILDER_DIR }} | |
${{ env.INSTALLBUILDER_DIR }}/bin/builder --version | |
echo "INSTALLER_SRC_PREFIX=$(pwd)" >> $GITHUB_ENV | |
echo "INSTALLER_BIN_PREFIX=/Volumes/SQLiteStudio" >> $GITHUB_ENV | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.client_payload.branch }} | |
- name: Prepare ccache | |
if: inputs.use_ccache || false | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ matrix.binary_compatibility }} | |
max-size: "32M" | |
- 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: | | |
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 ${{ matrix.cflags }} -lpthread -ldl -lm -Os -fpic -shared -o libsqlite3.0.dylib \ | |
-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 | |
sudo cp libsqlite3.0.dylib /usr/local/lib/ | |
sudo ln -f -s /usr/local/lib/libsqlite3.0.dylib /usr/local/lib/libsqlite3.dylib | |
sudo cp *.h /usr/local/include/ | |
echo "DYLD_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV | |
- name: Restore distfiles packages cache | |
id: cache-distfiles | |
uses: actions/cache/restore@v3 | |
with: | |
path: distfiles | |
key: distfiles-${{ matrix.binary_compatibility }}-${{ github.sha }} | |
restore-keys: distfiles-${{ matrix.binary_compatibility }}- | |
- name: Fetch distfiles | |
run: | | |
mkdir -p distfiles | |
fetch_binpkg() { | |
local _compat="$1"; shift | |
while [ -n "$1" ]; do | |
local _name="$1" | |
local _postfix="$(echo "$2${{ matrix.add_variants}}" | sed 's/+x11+universal/+universal+x11/')" | |
local _url="https://packages.macports.org/$_name/$_name-$_postfix.$_compat.tbz2" | |
shift 2 | |
case " $*" in *" $_name "*_) echo "$_name: Skipping as an override follows" 1>&2; continue ;; esac | |
_file="distfiles/$(basename "$_url")" | |
if [ ! -e "$_file" ]; then | |
echo "Fetching $_url" 1>&2 | |
if ! curl -fsL -o "$_file" "$_url"; then | |
echo "Fetching $_url failed, skipping" 1>&2 | |
rm -f "$_file" | |
printf '%s @%s\n' "$_name" "$_postfix" | |
fi | |
fi | |
done | |
} | |
_distfiles_count="$(ls distfiles | wc -l)" | |
_any="no" | |
_missing="$(fetch_binpkg ${{ matrix.binary_compatibility }} ${{ join(matrix.common_pkgs, ' ') }} ${{ join(matrix.pkgs, ' ') }})" | |
[ "$(ls distfiles | wc -l)" -eq "$_distfiles_count" ] || _any=yes | |
tee -a $GITHUB_ENV <<EOF_ENV | |
UPDATE_DISTFILES_CACHE=$_any | |
MISSING_PACKAGES<<EOF_VAR | |
${_missing} | |
EOF_VAR | |
EOF_ENV | |
- name: Save distfiles cache | |
if: always() && env.UPDATE_DISTFILES_CACHE == 'yes' | |
uses: actions/cache/save@v3 | |
with: | |
path: distfiles | |
key: ${{ steps.cache-distfiles.outputs.cache-primary-key }} | |
- name: Install MacPorts packages | |
run: | | |
mkdir macports | |
install_binpkg() { | |
_compat="$1"; shift | |
while [ -n "$1" ]; do | |
local _postfix="$(echo "$2${{ matrix.add_variants}}" | sed 's/+x11+universal/+universal+x11/')" | |
_pkg="distfiles/$1-$_postfix.$_compat.tbz2" | |
echo "Installing $_pkg" | |
tar -C macports -xjf "$_pkg" | |
shift 2 | |
done | |
} | |
install_binpkg ${{ matrix.binary_compatibility }} ${{ join(matrix.common_pkgs, ' ') }} ${{ join(matrix.pkgs, ' ') }} | |
- name: Configure MacPorts packages | |
run: | | |
sudo ln -s $(pwd)/macports/opt/local /opt/ | |
echo "PATH=/opt/local/libexec/qt5/bin:/opt/local/bin:$PATH" >> $GITHUB_ENV | |
echo "pythonLocation=/opt/local/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION" >> $GITHUB_ENV | |
if [ ${{ matrix.binary_compatibility }} = "darwin_16.x86_64" ]; then | |
# QtImageFormats 5.13 binary is linked to an older version of libtiff | |
sudo install_name_tool -change /opt/local/lib/libtiff.5.dylib /opt/local/lib/libtiff.6.dylib \ | |
/opt/local/libexec/qt5/plugins/imageformats/libqtiff.dylib | |
fi | |
- name: Compile additional SQLite3 extensions | |
shell: bash | |
run: | | |
cd .. | |
mkdir ext | |
curl -L http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-src-$SQLITE_VERSION.zip --output sqlite-src-$SQLITE_VERSION.zip | |
ls -l | |
unzip sqlite-src-$SQLITE_VERSION.zip -x '*.test' | |
ls -l | |
cd sqlite-src-$SQLITE_VERSION/ext | |
ls -l | |
FLAGS="${{ matrix.cflags }} -ldl -Os -fpic -shared -I/usr/local/include -L/usr/local/lib -lsqlite3" | |
for f in compress sqlar; do | |
echo "gcc misc/$f.c -Imisc $FLAGS -lz -o ../../ext/$f.dylib" | |
gcc misc/$f.c -Imisc $FLAGS -lz -o ../../ext/$f.dylib | |
done | |
for f in csv decimal eval ieee754 percentile rot13 series uint uuid zorder; do | |
echo "gcc misc/$f.c -Imisc $FLAGS -o ../../ext/$f.dylib" | |
gcc misc/$f.c -Imisc $FLAGS -o ../../ext/$f.dylib | |
done | |
for f in icu; do | |
ICU_FLAGS="-I/opt/local/include -L/opt/local/lib -licuio -licui18n -licuuc -licudata" | |
echo "gcc icu/$f.c -Iicu $ICU_FLAGS $FLAGS -o ../../ext/$f.dylib" | |
gcc icu/$f.c -Iicu $ICU_FLAGS $FLAGS -o ../../ext/$f.dylib | |
done | |
ls -l ../../ext/ | |
- name: Prepare deps | |
run: | | |
mkdir ../lib ../include | |
cp /usr/local/lib/libsqlite3* ../lib | |
cp /usr/local/include/sqlite3* ../include | |
- name: Prepare output dir | |
run: mkdir output output/build output/build/Plugins | |
- name: Compile SQLiteStudio3 | |
working-directory: output/build | |
run: | | |
qmake ${{ matrix.qmake_flags }} \ | |
$([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ | |
QMAKE_CXXFLAGS+="${{ matrix.cflags }}" \ | |
CONFIG+=portable \ | |
../../SQLiteStudio3 | |
make -j 2 | |
- name: Compile Plugins | |
working-directory: output/build/Plugins | |
run: | | |
qmake ${{ matrix.qmake_flags }} \ | |
$([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ | |
QMAKE_CXXFLAGS+="${{ matrix.cflags }}" \ | |
CONFIG+=portable \ | |
PYTHON_VERSION=$PYTHON_VERSION "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/SQLiteStudio.app/Contents/extensions | |
- name: Build packages | |
working-directory: output/build | |
run: | | |
make pkg | |
- name: Determine SQLiteStudio version | |
working-directory: output/SQLiteStudio | |
run: | | |
echo "SQLITESTUDIO_VERSION=$(SQLiteStudio.app/Contents/MacOS/sqlitestudiocli -v | awk '{print $2}')" >> $GITHUB_ENV | |
- name: Create installer package | |
shell: bash | |
env: | |
IB_LICENSE: ${{ secrets.INSTALLER_LICENSE }} | |
run: | | |
echo "$IB_LICENSE" > lic.xml | |
hdiutil attach output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg \ | |
-mountpoint /Volumes/SQLiteStudio | |
${{ env.INSTALLBUILDER_DIR }}/bin/builder build SQLiteStudio-installer.xml \ | |
--license lic.xml \ | |
--setvars project.outputDirectory=$(pwd) \ | |
--setvars project.version=${{ env.SQLITESTUDIO_VERSION }} | |
ls -l | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}${{ matrix.dmg_postfix }}.dmg | |
path: output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg | |
- name: Upload package artifact with Python | |
uses: actions/upload-artifact@v1 | |
with: | |
name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-py${{ env.PYTHON_VERSION }}${{ matrix.dmg_postfix }}.dmg | |
path: output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-py${{ env.PYTHON_VERSION }}.dmg | |
- name: Upload installer artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer${{ matrix.dmg_postfix }}.dmg | |
path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer.dmg | |
- name: Upload ARM64-only package artifact | |
if: matrix.binary_compatibility == 'darwin_20.arm64-x86_64' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-macos11.arm64.dmg | |
path: output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-arm64.dmg | |
- name: Upload ARM64-only package artifact with Python | |
if: matrix.binary_compatibility == 'darwin_20.arm64-x86_64' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-py${{ env.PYTHON_VERSION }}-macos11.arm64.dmg | |
path: output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-py${{ env.PYTHON_VERSION }}-arm64.dmg |