diff options
Diffstat (limited to '.github/workflows/win32_release.yml')
| -rw-r--r-- | .github/workflows/win32_release.yml | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/.github/workflows/win32_release.yml b/.github/workflows/win32_release.yml new file mode 100644 index 0000000..a522d3c --- /dev/null +++ b/.github/workflows/win32_release.yml @@ -0,0 +1,264 @@ +env: + QT_VERSION: '5.15.2' + SQLITE_VERSION: '3410200' + SQLITE_RELEASE_YEAR: '2023' + QT_ARCH: 'win32_mingw81' + PYTHON_VERSION: '3.9' + ICU_VER: '72' + ICU_URL: https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-icu-72.1-1-any.pkg.tar.zst + QT_BIN_DIR: ../Qt/5.15.2/mingw81_32/bin + PORTABLE_DIR: output/portable/SQLiteStudio + INSTALLBUILDER_DIR: ../ib + MINGW_URL: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_mingw/qt.tools.win32_mingw810/8.1.0-1-202004170606i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z + INSTALLBUILDER_URL: https://releases.bitrock.com/installbuilder/installbuilder-enterprise-23.1.0-windows-installer.exe + +name: Windows 32-bit release build + +on: + workflow_dispatch: + inputs: + use_ccache: + description: 'Use ccache (for workflow debugging only!)' + required: false + type: boolean + schedule: + - cron: '30 2 * * 1' # run at 2 AM UTC every Monday + repository_dispatch: + types: [win32_release] + +jobs: + build: + runs-on: windows-2019 + + steps: + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + with: + platform: x86 + version: 8.1.0 + + - name: Cache Qt + id: cache-qt + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}\..\Qt + key: ${{ runner.os }}-${{ env.QT_VERSION }}-Qt-Cache + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + cache: true + version: ${{ env.QT_VERSION }} + host: 'windows' + arch: ${{ env.QT_ARCH }} + # jurplel/install-qt-action has a bug due to which we cannot use ${{ github.workspace }} for the "dir" property, because it will fail. + dir: 'D:/' + setup-python: 'false' + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + architecture: 'x86' + + - name: Clone repo + uses: actions/checkout@v3 + with: + ref: ${{ github.event.client_payload.branch }} + + - name: Install dependencies + shell: bash + run: | + 7z x -o".." win_deps/win32_deps.zip + echo "../lib" >> $GITHUB_PATH + + - name: Prepare ccache + if: inputs.use_ccache || false + uses: hendrikmuhs/ccache-action@v1.2.8 + with: + key: win32_release + max-size: "24M" + + - name: Configure ccache (or not ccache) + shell: bash + run: | + if [ ${{ inputs.use_ccache || false }} = false ]; then + printf 'GCC_COMMAND=gcc.exe\nGXX_COMMAND=g++.exe\n' + else + printf 'GCC_COMMAND=ccache.exe gcc.exe\nGXX_COMMAND=ccache.exe g++.exe\n' + fi >> $GITHUB_ENV + + - name: Install SQLite3 + shell: bash + run: | + cd .. + curl -L http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-amalgamation-$SQLITE_VERSION.zip --output sqlite-amalgamation-$SQLITE_VERSION.zip + 7z x sqlite-amalgamation-$SQLITE_VERSION.zip + cd sqlite-amalgamation-$SQLITE_VERSION + $GCC_COMMAND sqlite3.c -Os -fpic -DWIN32 -m32 -I. -shared -o sqlite3.dll \ + -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 + cp -f sqlite3.dll ../lib/ + cp -f sqlite3.h ../include/ + cp -f sqlite3ext.h ../include/ + + - name: Install extension dependencies + shell: bash + run: | + cd .. + curl -L "$ICU_URL" | tar -xf - --zstd + mv mingw32 icu + + - 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 + 7z x sqlite-src-$SQLITE_VERSION.zip + cd sqlite-src-$SQLITE_VERSION/ext + FLAGS="-shared -Os -fpic -DWIN32 -m32 -I../../include -L../../lib -lsqlite3" + #for f in compress sqlar; do + # echo "$GCC_COMMAND misc/$f.c -Imisc $FLAGS -lzlib1 -o ../../ext/$f.dll" + # $GCC_COMMAND misc/$f.c -Imisc $FLAGS -lzlib1 -o ../../ext/$f.dll + #done + for f in csv decimal eval ieee754 percentile rot13 series uint uuid zorder; do + echo "$GCC_COMMAND misc/$f.c -Imisc $FLAGS -o ../../ext/$f.dll" + $GCC_COMMAND misc/$f.c -Imisc $FLAGS -o ../../ext/$f.dll + done + for f in icu; do + echo "$GCC_COMMAND icu/$f.c -I../../icu/include -L../../icu/lib -licuio -licuin -licuuc -licudt $FLAGS -o ../../ext/$f.dll" + $GCC_COMMAND icu/$f.c -I../../icu/include -L../../icu/lib -licuio -licuin -licuuc -licudt $FLAGS -o ../../ext/$f.dll + done + ls -l ../../ext/ + + - name: Prepare output dir + shell: bash + run: mkdir output output/build output/build/Plugins + + - name: Compile SQLiteStudio3 + working-directory: output/build + run: | + qmake.exe ` + CONFIG+=portable ` + "QMAKE_CXX=${{ env.GXX_COMMAND }}" ` + "QMAKE_CXXFLAGS+=-m32" ` + ..\..\SQLiteStudio3 + mingw32-make.exe -j 2 + + - name: Compile Plugins + working-directory: output/build/Plugins + run: | + qmake.exe ` + "QMAKE_CXX=${{ env.GXX_COMMAND }}" ` + CONFIG+=portable ` + "INCLUDEPATH+=${{ env.pythonLocation }}/include" "LIBS += -L${{ env.pythonLocation }}" ` + "QMAKE_CXXFLAGS+=-m32" ` + ..\..\..\Plugins + mingw32-make.exe -j 1 + + - name: Copy SQLite extensions to output dir + shell: bash + run: | + cp -R ../ext output/SQLiteStudio/ + + - name: Prepare portable dir + shell: bash + working-directory: output + run: | + mkdir portable + cp -R SQLiteStudio portable/ + + - name: Clean-up portable dir + shell: bash + run: | + cd ${{ env.PORTABLE_DIR }} + rm -f *.a + rm -f plugins/*.a + rm -f styles/*.a + echo "ABSOLUTE_PORTABLE_DIR=`pwd`" >> $GITHUB_ENV + + - name: Prepare portable distro (Qt) + shell: bash + working-directory: ${{ env.Qt5_Dir }} + run: | + for f in Qt5Core Qt5Gui Qt5Network Qt5PrintSupport Qt5Qml Qt5Svg Qt5Widgets Qt5Xml libgcc_s_dw2-1 libstdc++-6 libwinpthread-1; do cp bin/$f.dll "$ABSOLUTE_PORTABLE_DIR"; done + cp bin/qt.conf "$ABSOLUTE_PORTABLE_DIR" + mkdir -p "$ABSOLUTE_PORTABLE_DIR/iconengines" + mkdir -p "$ABSOLUTE_PORTABLE_DIR/platforms" + mkdir -p "$ABSOLUTE_PORTABLE_DIR/printsupport" + mkdir -p "$ABSOLUTE_PORTABLE_DIR/styles" + mkdir -p "$ABSOLUTE_PORTABLE_DIR/imageformats" + cp plugins/iconengines/qsvgicon.dll "$ABSOLUTE_PORTABLE_DIR/iconengines" + cp plugins/platforms/qwindows.dll "$ABSOLUTE_PORTABLE_DIR/platforms" + cp plugins/styles/qwindowsvistastyle.dll "$ABSOLUTE_PORTABLE_DIR/styles" + cp plugins/printsupport/windowsprintersupport.dll "$ABSOLUTE_PORTABLE_DIR/printsupport" + for f in qgif qicns qico qjpeg qsvg qtga qtiff qwbmp; do cp plugins/imageformats/$f.dll "$ABSOLUTE_PORTABLE_DIR/imageformats"; done + + - name: Prepare portable distro (Deps) + shell: bash + run: | + cd ../lib + cp *.dll "$ABSOLUTE_PORTABLE_DIR" + cd ../icu/bin + cp libicuio$ICU_VER.dll libicuin$ICU_VER.dll libicuuc$ICU_VER.dll libicudt$ICU_VER.dll "$ABSOLUTE_PORTABLE_DIR" + + - name: Prepare portable distro (Resources) + shell: bash + run: | + cp SQLiteStudio3/guiSQLiteStudio/img/sqlitestudio.ico "$ABSOLUTE_PORTABLE_DIR"/appicon.ico + cp SQLiteStudio3/guiSQLiteStudio/img/sqlitestudio.svg "${{ env.PORTABLE_DIR }}"/appicon.svg + + - name: Determine SQLiteStudio version + shell: bash + run: | + cd $ABSOLUTE_PORTABLE_DIR + echo "SQLITESTUDIO_VERSION=$(./sqlitestudiocli.exe --version | cut -f 2 -d ' ')" >> $GITHUB_ENV + + - name: Assemble portable package + shell: bash + run: | + cd $ABSOLUTE_PORTABLE_DIR/.. + 7z a -r sqlitestudio-$SQLITESTUDIO_VERSION.zip SQLiteStudio + + - name: Install the InstalBuilder + shell: bash + env: + IB_LICENSE: ${{ secrets.INSTALLER_LICENSE }} + run: | + curl -L ${{ env.INSTALLBUILDER_URL }} --output ib.exe + ./ib.exe --mode unattended --prefix ${{ env.INSTALLBUILDER_DIR }} + ${{ env.INSTALLBUILDER_DIR }}/bin/builder-cli.exe --version + echo "$IB_LICENSE" > lic.xml + echo "INSTALLER_SRC_PREFIX=$(pwd)" >> $GITHUB_ENV + echo "INSTALLER_BIN_PREFIX=$ABSOLUTE_PORTABLE_DIR" >> $GITHUB_ENV + + - name: Create installer package + shell: bash + run: | + ${{ env.INSTALLBUILDER_DIR }}/bin/builder-cli.exe build SQLiteStudio-installer.xml \ + --license lic.xml \ + --setvars project.outputDirectory=$(pwd) \ + --setvars project.version=$SQLITESTUDIO_VERSION + ls -l + + - name: Upload package artifact + uses: actions/upload-artifact@v1 + with: + name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip + path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip + + - name: Upload installer artifact + uses: actions/upload-artifact@v1 + with: + name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-installer.exe + path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-installer.exe |
