mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
175 lines
5.8 KiB
YAML
175 lines
5.8 KiB
YAML
name: CI-MacOS
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab.
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
VNOTE_VER: 3.15.1
|
|
|
|
jobs:
|
|
build:
|
|
name: Build On MacOS
|
|
runs-on: macos-latest
|
|
timeout-minutes: 120
|
|
|
|
strategy:
|
|
matrix:
|
|
config:
|
|
# - {
|
|
# name: "Build Qt 5.12",
|
|
# qt: 5.12.12
|
|
# }
|
|
- {
|
|
name: "Build Qt 5.15",
|
|
qt: 5.15.2
|
|
}
|
|
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE.
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Init Submodules
|
|
run: |
|
|
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
|
|
git submodule sync --recursive
|
|
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
brew install tree
|
|
|
|
- name: Install macdeployqtfix
|
|
run: |
|
|
git clone https://github.com/tamlok/macdeployqtfix.git macdeployqtfix --depth=1
|
|
working-directory: ${{runner.workspace}}
|
|
|
|
- name: Cache Qt
|
|
id: cache-qt
|
|
uses: actions/cache@v1 # not v2!
|
|
with:
|
|
path: ../Qt
|
|
key: ${{ runner.os }}-QtCache-${{ matrix.config.qt }}
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v3
|
|
with:
|
|
version: ${{ matrix.config.qt }}
|
|
target: desktop
|
|
modules: qtwebengine
|
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
|
setup-python: 'false'
|
|
|
|
|
|
- name: Create Build Dir
|
|
run: mkdir build
|
|
working-directory: ${{runner.workspace}}
|
|
|
|
- name: Configure Project
|
|
run: |
|
|
qmake -v
|
|
qmake CONFIG+=release ${GITHUB_WORKSPACE}/vnote.pro
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Build Project
|
|
run: make -j4
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Deploy VSyntaxHighlighting Framework
|
|
run: |
|
|
my_lib_name=VSyntaxHighlighting
|
|
my_lib_framework=${my_lib_name}.framework
|
|
my_lib_dir=./libs/vtextedit/src/libs/syntax-highlighting
|
|
frameworks_dir=./src/vnote.app/Contents/Frameworks
|
|
mkdir -p ${frameworks_dir}
|
|
cp -R ${my_lib_dir}/${my_lib_framework} ${frameworks_dir}
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Deploy VTextEdit Framework
|
|
run: |
|
|
my_lib_name=VTextEdit
|
|
my_lib_framework=${my_lib_name}.framework
|
|
my_lib_dir=./libs/vtextedit/src/editor
|
|
frameworks_dir=./src/vnote.app/Contents/Frameworks
|
|
mkdir -p ${frameworks_dir}
|
|
cp -R ${my_lib_dir}/${my_lib_framework} ${frameworks_dir}
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Cleanup rpath
|
|
run: |
|
|
app_target=./src/vnote.app/Contents/MacOS/vnote
|
|
install_name_tool -delete_rpath ${PWD}/src/../libs/vtextedit/src/editor ${app_target}
|
|
install_name_tool -delete_rpath ${PWD}/src/../libs/vtextedit/src/libs/syntax-highlighting ${app_target}
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Mac Deploy
|
|
run: |
|
|
pushd src
|
|
macdeployqt vnote.app
|
|
|
|
# Remove unused sql drivers
|
|
rm vnote.app/Contents/Plugins/sqldrivers/libqsqlodbc.dylib
|
|
rm vnote.app/Contents/Plugins/sqldrivers/libqsqlpsql.dylib
|
|
|
|
python ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py vnote.app/Contents/MacOS/vnote $Qt5_Dir
|
|
# Fix Helpers/QtWebEngineProcess.app
|
|
pushd vnote.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/Helpers
|
|
python ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess $Qt5_Dir
|
|
popd
|
|
|
|
popd
|
|
tree ./
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Package Project
|
|
run: |
|
|
mkdir -p distrib/vnote
|
|
pushd distrib/vnote
|
|
mv ../../src/vnote.app ./
|
|
ln -s /Applications ./Applications
|
|
popd
|
|
sleep 60
|
|
hdiutil create -srcfolder ./distrib/vnote -format UDBZ vnote-mac-x64_v${{env.VNOTE_VER}}.dmg
|
|
cp vnote-mac-x64_v${{env.VNOTE_VER}}.dmg vnote-mac-x64-qt${{matrix.config.qt}}.dmg
|
|
mv vnote-mac-x64_v${{env.VNOTE_VER}}.dmg vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg
|
|
working-directory: ${{runner.workspace}}/build
|
|
|
|
- name: Archive Artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}
|
|
path: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg
|
|
|
|
- name: Update Tag
|
|
if: github.ref == 'refs/heads/master'
|
|
run: |
|
|
git tag --force continuous-build ${GITHUB_SHA}
|
|
git push --force --tags
|
|
|
|
- name: Update Continuous Build Release
|
|
if: github.ref == 'refs/heads/master'
|
|
uses: johnwbyrd/update-release@v1.0.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
files: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}.dmg
|
|
release: Continuous Build
|
|
tag: continuous-build
|
|
|
|
- name: Release
|
|
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, '[Release]')
|
|
uses: ncipollo/release-action@v1.11.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
artifacts: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg
|
|
commit: master
|
|
tag: v${{env.VNOTE_VER}}
|
|
allowUpdates: true
|
|
draft: true
|