-
Notifications
You must be signed in to change notification settings - Fork 199
353 lines (313 loc) · 12.4 KB
/
main.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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# http://docs.redisdesktop.com/en/latest/install/
# https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
# This is a basic workflow to help you get started with Actions
name: CI for redis desktop manager
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ pre-release ]
paths-ignore:
- 'README.md'
- 'LICENSE'
pull_request:
branches: [ pre-release ]
paths-ignore:
- 'README.md'
- 'LICENSE'
schedule:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# - cron: '0 22 * * *' # Runs at 22:00 UTC every day
- cron: '0 22 * * 6' # Runs at 22:00 UTC every saturday
env:
RDM_REF: 2022
VERSION: 2022.99.0
PY_LIB_VERSION: 38
PYTHON_EMBEDDED_VERSION: 3.8.10
CMAKE_VS: Visual Studio 16 2019
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
create_release:
runs-on: windows-2019
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjobs_idoutputs
# Map a step output to a job output
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
# - name: checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# delete old release
- uses: dev-drprasad/delete-tag-and-release@v0.2.1
with:
delete_release: true # default: false
tag_name: ${{ env.RDM_REF }}-weekly # tag name to delete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.RDM_REF }}-weekly
release_name: v${{ env.RDM_REF }}-weekly
body: |
${{ env.RDM_REF }}-weekly
draft: false
prerelease: true
build_on_windows:
needs: create_release
runs-on: windows-2019
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
repository: uglide/RedisDesktopManager
path: rdm
submodules: 'recursive'
ref: ${{ env.RDM_REF }}
# install QT
- name: install QT
uses: jurplel/install-qt-action@v2
with:
version: '5.15.1'
modules: 'qtcharts'
# - name : fix compilation
# run: |
# cd rdm/3rdparty/qredisclient/3rdparty/hiredis
# git apply ../hiredis-win.patch
- name: install zlib
run: |
cd rdm/3rdparty
nuget install zlib-msvc14-x64 -Version 1.2.11.7795
# from https://github.com/lework/RedisDesktopManager-Windows
- name: build lz4
run: |
cd rdm/3rdparty/lz4/build/cmake
cmake -G "${{ env.CMAKE_VS }}" -A x64 -DLZ4_BUNDLED_MODE=ON -DBUILD_SHARED_LIBS=ON -B .
cmake --build . --config Release
- name: build zstd
run: |
cd rdm/3rdparty/zstd/build/cmake
cmake -G "${{ env.CMAKE_VS }}" -A x64 -B .
cmake --build . --config Release
- name: build snappy
run: |
cd rdm/3rdparty/snappy
cmake -G "${{ env.CMAKE_VS }}" -A x64 -B .
cmake --build . --config Release
- name: build brotli
run: |
cd rdm/3rdparty/brotli
cmake -G "${{ env.CMAKE_VS }}" -A x64 -B .
cmake -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
# # install python3
# - name: install Python3
# uses: actions/setup-python@v2
# with:
# python-version: '3.7'
# architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
# install python3
- name: install python3
shell: cmd
run: mklink /d C:\Python${{ env.PY_LIB_VERSION }}-x64 C:\hostedtoolcache\windows\python\${{ env.PYTHON_EMBEDDED_VERSION }}\x64
# pip install
- name: pip install
shell: cmd
run: |
cd rdm\build\windows\installer\resources
xcopy %GITHUB_WORKSPACE%\rdm\src\py . /s /i
mkdir Lib\site-packages
pip3 install -t Lib\site-packages -r requirements.txt
python -m compileall -b .
del /s /q *.py
forfiles /p "." /s /m __pycache__ /c "cmd /c if @isdir==TRUE rd /s /q @file 2>nul" 2>nul | exit /b 0
forfiles /p "." /s /m *.dist-info /c "cmd /c if @isdir==TRUE rd /s /q @file 2>nul" 2>nul | exit /b 0
forfiles /p "." /s /m *.egg-info /c "cmd /c if @isdir==TRUE rd /s /q @file 2>nul" 2>nul | exit /b 0
# https://doc.qt.io/qt-5/linguist-manager.html
# lupdate resp.pro
- name: translations
shell: cmd
run: |
cd rdm\src
lupdate resp.pro
lrelease -verbose resp.pro
xcopy resources\translations\*.qm ..\build\windows\installer\resources\translations /s /i
# Runs a single command using the runners shell
- name: build
shell: cmd
env:
vc_arch: x64
run: |
python rdm\build\utils\set_version.py ${{ env.VERSION }} > rdm\src\version.h
cd rdm\src
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%
qmake resp.pro CONFIG-=debug "VERSION=${{ env.VERSION }}"
nmake
# 缺少python3.dll
# fix formatter error, unicodedata _bz2
- name: add python3.dll
shell: powershell
# env:
# PYTHON_EMBEDDED_VERSION: ${{ env.PYTHON_EMBEDDED_VERSION }}
run: |
cd rdm\build\windows\installer\resources
wget "https://www.python.org/ftp/python/${{ env.PYTHON_EMBEDDED_VERSION }}/python-${{ env.PYTHON_EMBEDDED_VERSION }}-embed-amd64.zip" -outfile "python-embed.zip"
7z.exe x python-embed.zip python${{ env.PY_LIB_VERSION }}.zip python3.dll python${{ env.PY_LIB_VERSION }}.dll unicodedata.pyd _bz2.pyd
del python-embed.zip
# windeployqt
# https://doc.qt.io/qt-5/windows-deployment.html
# windeployqt.exe --force --qmldir ${{ env.QML2_IMPORT_PATH }} resp.exe
- name: package
id: package
shell: cmd
run: |
cd rdm
copy /y bin\windows\release\resp.exe build\windows\installer\resources\resp.exe
copy /y bin\windows\release\resp.exp build\windows\installer\resources\resp.exp
copy /y bin\windows\release\resp.lib build\windows\installer\resources\resp.lib
cd build\windows\installer\resources
windeployqt.exe --no-angle --no-opengl-sw --no-compiler-runtime --no-translations --release --force --qmldir ../../../../src/qml resp.exe
makensis.exe /V1 /DVERSION=${{ env.VERSION }} ../installer.nsi
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: rdm/build/windows/installer/resp-${{ env.VERSION }}.exe
asset_name: resp-${{ env.VERSION }}.exe
asset_content_type: application/vnd.microsoft.portable-executable
build_on_osx:
needs: create_release
# runs-on: macos-latest
runs-on: macos-12
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
repository: uglide/RedisDesktopManager
path: rdm
submodules: 'recursive'
ref: ${{ env.RDM_REF }}
# - name: update submodules
# run: |
# cd rdm
# git submodule update --remote
- name: build lz4
run: |
cd rdm/3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON -DBUILD_SHARED_LIBS=ON
ls
make -s -j 8
- name: build zstd
run: |
cd rdm/3rdparty/zstd/build/cmake
cmake . && make
- name: build snappy
run: |
cd rdm/3rdparty/snappy
git submodule update --remote
cmake . && make
- name: build brotli
run: |
cd rdm/3rdparty/brotli
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
sudo cmake --build . --config Release --target install
# - name: setup python
# run: |
# brew unlink python@3.11
# brew unlink python@3.10
# brew reinstall python@3.9
# brew link --overwrite python@3.9
# brew link python3
# install QT
- name: install QT
uses: jurplel/install-qt-action@v3
with:
version: '5.15.1'
modules: 'qtcharts'
setup-python: 'false'
- name: copy info.plist
run: |
cd rdm
cd ./src && cp ./resources/Info.plist.sample ./resources/Info.plist
# - name: setup python
# run: |
# brew unlink python@3.10
# brew install python@3.9
# brew link --overwrite python@3.9
# 使用私有库,egg-links时-t不能同时使用,--user解决权限问题
# https://github.com/UnitedIncome/serverless-python-requirements/issues/240
# https://github.com/pypa/pip/issues/4390
# https://github.com/pypa/pip/issues/4139
# https://github.com/pypa/pip/issues/562
# sudo pip3 install --prefix . -r $GITHUB_WORKSPACE/rdm/src/py/requirements.txt
# sudo pip3 install -t . -r $GITHUB_WORKSPACE/rdm/src/py/requirements.txt
- name: pip install
run: |
cd rdm
mkdir -p bin/osx/release && cd bin/osx/release
cp -Rf $GITHUB_WORKSPACE/rdm/src/py .
cd py
echo six >> requirements.txt
sudo pip3 install -t . -r requirements.txt
sudo python3 -m compileall -b .
sudo find . -name "*.py" | sudo xargs rm -rf
sudo find . -name "__pycache__" | sudo xargs rm -rf
sudo find . -name "*.dist-info" | sudo xargs rm -rf
sudo find . -name "*.egg-info" | sudo xargs rm -rf
- name: release translations
run: |
cd rdm/src
lupdate resp.pro
lrelease -verbose resp.pro
# brew install tree && tree -a
# 去掉initUpdater不然报Please download new version of Redis Desktop Manager,不能使用
# sed -i '.back' 's/initUpdater();/\/\/initUpdater();/g' ./app/app.cpp
# macdeployqt
# https://doc.qt.io/qt-5/macos-deployment.html
# Qt Translations are not being copied
# https://github.com/probonopd/linuxdeployqt/issues/115
- name: build
id: build
run: |
cd rdm/src
qmake resp.pro CONFIG-=debug "VERSION=${{ env.VERSION }}"
make -s -j 8
- name: copy translations
run: |
cd rdm/src
mkdir ../bin/osx/release/RESP.app/Contents/translations
cp -f ./resources/translations/*.qm ../bin/osx/release/RESP.app/Contents/translations
- name: package
id: package
run: |
cd rdm/bin/osx/release
zip -q -r release.zip .
cp -Rf py ./RESP.app/Contents/Resources/
python_version=$(python3 -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
echo ${python_version}
brew install python@${python_version}
cp -Rf /usr/local/Cellar/python@${python_version}/*/Frameworks/ ./RESP.app/Contents/Frameworks/
install_name_tool -change /Library/Frameworks/Python.framework/Versions/${python_version}/Python @rpath/Python.framework/Versions/${python_version}/Python ./RESP.app/Contents/MacOS/RESP
otool -L ./RESP.app/Contents/MacOS/RESP
macdeployqt ./RESP.app -qmldir=../../../src/qml -always-overwrite -dmg
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: rdm/bin/osx/release/RESP.dmg
asset_name: RESP.dmg
asset_content_type: application/dmg