Skip to content

CI for redis desktop manager #1476

CI for redis desktop manager

CI for redis desktop manager #1476

Workflow file for this run

# 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