MacOSX release build #663
This file contains hidden or 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.16' | |
| SQLITE_VERSION: '3510100' | |
| PYTHON_VERSION: '3.11' | |
| PORTABLE_DIR: ${{ github.workspace }}/output/portable/SQLiteStudio | |
| INSTALLBUILDER_DIR: ../ib | |
| INSTALLBUILDER_URL: https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-24.11.1-osx-installer.dmg | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| name: MacOSX release build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| use_ccache: | |
| description: 'Use ccache (for workflow debugging only!)' | |
| required: false | |
| type: boolean | |
| DEBUG: | |
| description: 'Enable workflow debug messages' | |
| required: false | |
| type: boolean | |
| default: false | |
| schedule: | |
| - cron: '0 3 * * 1' # run at 3 AM UTC every Monday | |
| repository_dispatch: | |
| types: [mac_release] | |
| jobs: | |
| build: | |
| runs-on: macos-15-intel | |
| steps: | |
| - name: Install MacPorts | |
| uses: melusina-org/setup-macports@v1 | |
| - name: Reconfigure MacPorts | |
| run: | | |
| MACPORTS_CONF="/opt/local/etc/macports/macports.conf" | |
| sudo sed -i '' 's/^macosx_deployment_target.*/macosx_deployment_target 11.0/' "$MACPORTS_CONF" | |
| if ! grep -q "^macosx_deployment_target" "$MACPORTS_CONF"; then | |
| echo "macosx_deployment_target 11.0" | sudo tee -a "$MACPORTS_CONF" | |
| fi | |
| sudo port selfupdate | |
| - name: Install coreutils | |
| run: | | |
| brew install coreutils | |
| - name: Initial config | |
| run: | | |
| echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV | |
| echo "CFLAGS=-arch x86_64" >> $GITHUB_ENV | |
| echo "CXXFLAGS=-arch x86_64" >> $GITHUB_ENV | |
| echo "LDFLAGS=-arch x86_64" >> $GITHUB_ENV | |
| - name: Install Tcl | |
| run: | | |
| if brew list tcl-tk 2>/dev/null; then | |
| brew uninstall tcl-tk r | |
| fi | |
| sudo port install tcl +universal | |
| echo "PATH=/opt/local/bin:$PATH" >> $GITHUB_ENV | |
| echo "TCL_CONFIG=/opt/local/lib/tclConfig.sh" >> $GITHUB_ENV | |
| echo "TCL_VERSION_MAJ=$(echo 'puts $tcl_version' | /opt/local/bin/tclsh)" >> $GITHUB_ENV | |
| echo "Tcl arch 1:" | |
| ls -l /opt/local/lib/libtcl8.6.dylib | |
| lipo -archs /opt/local/lib/libtcl8.6.dylib | |
| echo "Tcl bin arch:" | |
| ls -l /opt/local/bin/tclsh | |
| lipo -archs /opt/local/bin/tclsh | |
| echo "tclConfig:" | |
| ls -l /opt/local/lib/tclConfig.sh | |
| cat /opt/local/lib/tclConfig.sh | |
| - 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: 'mac' | |
| dir: '${{ steps.qt-installation-dir.DIR }}' | |
| extra: '--external 7z' | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| architecture: 'x64' | |
| - name: Clone GH scripts | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: pawelsalawa/gh-action-scripts | |
| ref: main | |
| path: gh-scripts | |
| - name: Setup GH scripts path | |
| shell: bash | |
| run: | | |
| mv gh-scripts .. | |
| cd .. | |
| chmod +x gh-scripts/scripts/*.sh | |
| echo "GH_SCRIPTS=$(pwd)/gh-scripts/scripts" >> $GITHUB_ENV | |
| echo "DEBUG=${{ inputs.DEBUG }}" >> $GITHUB_ENV | |
| # - name: Fix Qt for MacOS 14 | |
| # shell: bash | |
| # run: | | |
| # TCFILE=$(find $Qt5_DIR/mkspecs/features -name toolchain.prf -type f -maxdepth 1) | |
| # echo "Updating file: $TCFILE" | |
| # sed -i '' 's/if(!darwin:clang)|intel_icc/if(!darwin:clang)|intel_icc|darwin/' $TCFILE | |
| - name: Install the InstalBuilder | |
| 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: ${{ env.BRANCH_NAME }} | |
| - name: Prepare ccache | |
| if: inputs.use_ccache || false | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| key: mac_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: | | |
| SQLITE_DOT_VERSION=$($GH_SCRIPTS/convert_int_ver.sh $SQLITE_VERSION) | |
| echo "SQLITE_DOT_VERSION=$SQLITE_DOT_VERSION" >> $GITHUB_ENV | |
| cd .. | |
| SQLITE3_ZIP=sqlite3-macos-x64-$SQLITE_VERSION.zip | |
| curl -L https://github.com/pawelsalawa/sqlite3-sqls/releases/download/v$SQLITE_DOT_VERSION/$SQLITE3_ZIP --output $SQLITE3_ZIP | |
| sudo unzip $SQLITE3_ZIP libsqlite3.0.dylib -d /usr/local/lib | |
| sudo unzip $SQLITE3_ZIP sqlite3.h sqlite3ext.h -d /usr/local/include | |
| sudo ln -f -s /usr/local/lib/libsqlite3.0.dylib /usr/local/lib/libsqlite3.dylib | |
| echo "DYLD_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV | |
| ls -l /usr/local/lib/libsqlite3* | |
| ls -l /usr/local/include/sqlite* | |
| lipo -archs /usr/local/lib/libsqlite3.0.dylib | |
| - name: Compile additional SQLite3 extensions | |
| shell: bash | |
| run: | | |
| cd .. | |
| mkdir ext | |
| curl -L https://github.com/pawelsalawa/sqlite3-sqls/releases/download/v$SQLITE_DOT_VERSION/sqlite3-extensions-src-$SQLITE_VERSION.zip --output sqlite3-extensions-src-$SQLITE_VERSION.zip | |
| ls -l | |
| mkdir ext-src | |
| unzip sqlite3-extensions-src-$SQLITE_VERSION.zip -d ext-src | |
| cd ext-src | |
| ls -l | |
| FLAGS="-arch x86_64 -ldl -Os -fpic -shared -Wl,-undefined,dynamic_lookup -I/usr/local/include -L/usr/local/lib -lsqlite3" | |
| set -x | |
| for f in compress sqlar; do | |
| 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 | |
| gcc misc/$f.c -Imisc $FLAGS -o ../ext/$f.dylib | |
| done | |
| # for f in icu; do | |
| # gcc icu/$f.c -Iicu $ICU_FLAGS $FLAGS -o ../ext/$f.dylib | |
| # done | |
| set +x | |
| 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 \ | |
| $([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ | |
| CONFIG+=portable \ | |
| ../../SQLiteStudio3 | |
| make -j 2 | |
| - 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" \ | |
| "TCL_CONFIG=${{ env.TCL_CONFIG }}" \ | |
| "PYTHON_VERSION=${{ env.PYTHON_VERSION }}" \ | |
| ../../../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: | | |
| SQLITESTUDIO_VERSION=$(SQLiteStudio.app/Contents/MacOS/sqlitestudiocli -v | awk '{print $2}') | |
| echo "SQLITESTUDIO_VERSION=$SQLITESTUDIO_VERSION" >> $GITHUB_ENV | |
| echo "PACKAGE_VERSION=${SQLITESTUDIO_VERSION}-macos-x64" >> $GITHUB_ENV | |
| - name: Rename portable package | |
| working-directory: output/SQLiteStudio | |
| run: | | |
| mv sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg sqlitestudio-${{ env.PACKAGE_VERSION }}.dmg | |
| - name: Create installer package | |
| shell: bash | |
| env: | |
| IB_LICENSE: ${{ secrets.INSTALLER_LICENSE }} | |
| run: | | |
| echo "$IB_LICENSE" > lic.xml | |
| hdiutil attach output/SQLiteStudio/sqlitestudio-${{ env.PACKAGE_VERSION }}.dmg | |
| ${{ env.INSTALLBUILDER_DIR }}/bin/builder build SQLiteStudio-installer.xml \ | |
| --license lic.xml \ | |
| --setvars project.outputDirectory=$(pwd) \ | |
| --setvars project.version=${{ env.SQLITESTUDIO_VERSION }} | |
| mv SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer.dmg SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-macos-x64-installer.dmg | |
| ls -l | |
| - name: SHA256 checksums | |
| shell: bash | |
| run: | | |
| sha256sum output/SQLiteStudio/sqlitestudio-${{ env.PACKAGE_VERSION }}.dmg | |
| sha256sum SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-macos-x64-installer.dmg | |
| - name: Upload package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sqlitestudio-${{ env.PACKAGE_VERSION }}.dmg | |
| path: output/SQLiteStudio/sqlitestudio-${{ env.PACKAGE_VERSION }}.dmg | |
| - name: Upload installer artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-macos-x64-installer.dmg | |
| path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-macos-x64-installer.dmg |