-
-
Notifications
You must be signed in to change notification settings - Fork 610
309 lines (262 loc) · 12.4 KB
/
mac_release.yml
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
env:
QT_VERSION: '6.5.3'
TCL_VERSION: '8.6.16'
SQLITE_VERSION: '3490000'
PYTHON_VERSION: '3.9'
ICU_VERSION: '74.2'
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
jobs:
build:
runs-on: macos-13
steps:
#- name: Debug
#shell: bash
#run: |
# brew search tcl-tk
# ls -l /usr/local/
# ls -l /usr/local/include
# ls -l /usr/local/opt/
# ls -l /usr/local/opt/openssl/include/
# ls -l /usr/local/opt/expat/include
- 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 10.14/' "$MACPORTS_CONF"
if ! grep -q "^macosx_deployment_target" "$MACPORTS_CONF"; then
echo "macosx_deployment_target 10.14" | sudo tee -a "$MACPORTS_CONF"
fi
sudo port selfupdate
- name: Install coreutils
run: |
brew install coreutils
- name: Install ICU
run: |
sudo port install icu +universal
- 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@v3
with:
cache: true
version: ${{ env.QT_VERSION }}
host: 'mac'
dir: '${{ steps.qt-installation-dir.DIR }}'
aqtversion: '==3.0.*'
py7zrversion: '==0.20.*'
setup-python: 'false'
extra: '--external 7z'
- 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: 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
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: 'arm64'
# - name: Verify Python arch
# shell: bash
# run: |
# echo "python arch:"
# lipo -archs $(which python)
- 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: |
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-universal-$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*
- name: Configure universal binaries compilation flags
shell: bash
run: |
echo "CFLAGS=$CFLAGS -arch arm64 -arch x86_64 -mmacosx-version-min=10.14" >> $GITHUB_ENV
- 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="$CFLAGS -ldl -Os -fpic -shared -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
ICU_FLAGS="-I/opt/local/include -L/opt/local/lib -licuio -licui18n -licuuc -licudata"
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 ${{ matrix.qmake_flags }} \
$([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \
QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64" \
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_APPLE_DEVICE_ARCHS="x86_64 arm64" \
CONFIG+=portable \
"INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" \
"LIBS += -L$pythonLocation/lib" \
"TCL_CONFIG=$TCL_CONFIG" \
../../../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_verbose
- name: Determine SQLiteStudio version
working-directory: output/SQLiteStudio
run: |
echo "All files in boundle:"
find SQLiteStudio.app
echo "Listing architecture for files."
find SQLiteStudio.app -type f -name "*.dylib" -print0 | while IFS= read -r -d '' FILE; do
echo "Arch for: $FILE"
lipo -archs "$FILE"
done
echo "Arch for: SQLiteStudio.app/Contents/MacOS/sqlitestudiocli"
lipo -archs SQLiteStudio.app/Contents/MacOS/sqlitestudiocli
SQLITESTUDIO_VERSION=$(SQLiteStudio.app/Contents/MacOS/sqlitestudiocli -v | awk '{print $2}')
echo "SQLITESTUDIO_VERSION=$SQLITESTUDIO_VERSION" >> $GITHUB_ENV
echo "PACKAGE_VERSION=${SQLITESTUDIO_VERSION}-macos-universal" >> $GITHUB_ENV
echo "INSTALLER_BIN_PREFIX=/Volumes/SQLiteStudio-${SQLITESTUDIO_VERSION}" >> $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
echo "Volumes:"
ls -l /Volumes
${{ env.INSTALLBUILDER_DIR }}/bin/builder build SQLiteStudio-installer.xml \
--license lic.xml \
--setvars project.outputDirectory=$(pwd) \
--setvars project.version=${{ env.SQLITESTUDIO_VERSION }}
echo "Installer file before renaming:"
ls -l *.dmg
mv SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer.dmg SQLiteStudio-${{ env.PACKAGE_VERSION }}-installer.dmg
echo "Installer file after renaming:"
ls -l *.dmg
- name: SHA256 checksums
shell: bash
run: |
sha256sum output/SQLiteStudio/sqlitestudio-${{ env.PACKAGE_VERSION }}.dmg
sha256sum SQLiteStudio-${{ env.PACKAGE_VERSION }}-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.PACKAGE_VERSION }}-installer.dmg
path: SQLiteStudio-${{ env.PACKAGE_VERSION }}-installer.dmg