aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/win_release.yml
blob: 1a5307d9f373df42068c7f85bf74c0a13a0c7a04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
env:
    QT_VERSION: '5.15.2'
    SQLITE_VERSION: '3350400'
    SQLITE_RELEASE_YEAR: '2021'
    QT_ARCH: 'win64_mingw81'
    MINGW_DIR: ../Qt/Tools/mingw810_64
    QT_BIN_DIR: ../Qt/5.15.2/mingw81_64/bin
    PORTABLE_DIR: output/portable/SQLiteStudio
    MINGW_URL: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_mingw/qt.tools.win64_mingw810/8.1.0-1-202004170606x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z
    DEPS_URL: https://www.dropbox.com/s/2dpem7vy0ee19tu/win64_deps.zip?dl=1

name: Windows release build

on:
    repository_dispatch:
        types: [win_release]

jobs:
    build:
        runs-on: windows-2019

        steps:
            - name: Cache Qt
              id: cache-qt
              uses: actions/cache@v1
              with:
                path: ${{ github.workspace }}\..\Qt
                key: ${{ runner.os }}-${{ env.QT_VERSION }}-Qt-Cache
                
            - name: Install Qt
              uses: jurplel/install-qt-action@v2
              with:
                cached: ${{ steps.cache-qt.outputs.cache-hit }}
                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:/'
                modules: 'qtscript'
                setup-python: 'false'
                
            - name: Install mingw
              if: steps.cache-qt.outputs.cache-hit != 'true'
              shell: bash
              run: |
                curl -L ${{ env.MINGW_URL }} --output ../mingw.7z
                7z x -o"../Qt" ../mingw.7z
                echo "${{ env.MINGW_DIR }}/bin" >> $GITHUB_PATH
 
            - name: Clone repo
              uses: actions/checkout@v2
              with:
                ref: ${{ github.event.client_payload.branch }}

            - name: Install dependencies
              shell: bash
              run: |
                curl -L ${{ env.DEPS_URL }} --output ../win64_deps.zip
                7z x -o".." ../win64_deps.zip
                echo "../lib" >> $GITHUB_PATH
 
            - 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.exe sqlite3.c -Os -fpic -DWIN64 -m64 -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: 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 ..\..\SQLiteStudio3
                mingw32-make.exe -j 2
            
            - name: Compile Plugins
              working-directory: output/build/Plugins
              run: |
                qmake.exe CONFIG+=portable ..\..\..\Plugins
                mingw32-make.exe -j 2
              
            - 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 Qt5Script Qt5Svg Qt5Widgets Qt5Xml libgcc_s_seh-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"

            - 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: Upload package artifact
              uses: actions/upload-artifact@v1
              with:
                name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip
                path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip