ci-macos.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. name: CI-MacOS
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. # Allows you to run this workflow manually from the Actions tab.
  8. workflow_dispatch:
  9. env:
  10. VNOTE_VER: 3.0.0-beta.2
  11. jobs:
  12. build-linux:
  13. name: Build On MacOS
  14. runs-on: macos-latest
  15. timeout-minutes: 120
  16. steps:
  17. # Checks-out your repository under $GITHUB_WORKSPACE.
  18. - uses: actions/checkout@v2
  19. with:
  20. fetch-depth: 1
  21. - name: Init Submodules
  22. run: |
  23. auth_header="$(git config --local --get http.https://github.com/.extraheader)"
  24. git submodule sync --recursive
  25. git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
  26. - name: Install Dependencies
  27. run: |
  28. brew install tree
  29. - name: Install macdeployqtfix
  30. run: |
  31. git clone https://github.com/tamlok/macdeployqtfix.git macdeployqtfix --depth=1
  32. working-directory: ${{runner.workspace}}
  33. - name: Install Qt
  34. uses: jurplel/install-qt-action@v2
  35. with:
  36. version: 5.12.10
  37. target: desktop
  38. modules: qtwebchannel qtwebengine qtsvg qtlocation qttools qttranslations
  39. - name: Create Build Dir
  40. run: mkdir build
  41. working-directory: ${{runner.workspace}}
  42. - name: Configure Project
  43. run: |
  44. qmake -v
  45. qmake CONFIG+=release ${GITHUB_WORKSPACE}/vnote.pro
  46. working-directory: ${{runner.workspace}}/build
  47. - name: Build Project
  48. run: make -j4
  49. working-directory: ${{runner.workspace}}/build
  50. - name: Deploy VSyntaxHighlighting Framework
  51. run: |
  52. my_lib_name=VSyntaxHighlighting
  53. my_lib_framework=${my_lib_name}.framework
  54. my_lib_dir=./libs/vtextedit/src/libs/syntax-highlighting
  55. frameworks_dir=./src/vnote.app/Contents/Frameworks
  56. mkdir -p ${frameworks_dir}
  57. cp -R ${my_lib_dir}/${my_lib_framework} ${frameworks_dir}
  58. working-directory: ${{runner.workspace}}/build
  59. - name: Deploy VTextEdit Framework
  60. run: |
  61. my_lib_name=VTextEdit
  62. my_lib_framework=${my_lib_name}.framework
  63. my_lib_dir=./libs/vtextedit/src/editor
  64. frameworks_dir=./src/vnote.app/Contents/Frameworks
  65. mkdir -p ${frameworks_dir}
  66. cp -R ${my_lib_dir}/${my_lib_framework} ${frameworks_dir}
  67. working-directory: ${{runner.workspace}}/build
  68. - name: Cleanup rpath
  69. run: |
  70. app_target=./src/vnote.app/Contents/MacOS/vnote
  71. install_name_tool -delete_rpath ${PWD}/src/../libs/vtextedit/src/editor ${app_target}
  72. install_name_tool -delete_rpath ${PWD}/src/../libs/vtextedit/src/libs/syntax-highlighting ${app_target}
  73. working-directory: ${{runner.workspace}}/build
  74. - name: Mac Deploy
  75. run: |
  76. pushd src
  77. macdeployqt vnote.app
  78. python ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py vnote.app/Contents/MacOS/vnote $Qt5_Dir
  79. # Fix Helpers/QtWebEngineProcess.app
  80. pushd vnote.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/Helpers
  81. macdeployqt QtWebEngineProcess.app
  82. python ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess $Qt5_Dir
  83. popd
  84. popd
  85. tree ./
  86. working-directory: ${{runner.workspace}}/build
  87. - name: Package Project
  88. run: |
  89. mkdir -p distrib/vnote
  90. pushd distrib/vnote
  91. mv ../../src/vnote.app ./
  92. ln -s /Applications ./Applications
  93. popd
  94. sleep 1m
  95. hdiutil create -srcfolder ./distrib/vnote -format UDBZ vnote-mac-x64_v${{env.VNOTE_VER}}.dmg
  96. cp vnote-mac-x64_v${{env.VNOTE_VER}}.dmg vnote-mac-x64.dmg
  97. working-directory: ${{runner.workspace}}/build
  98. - name: Archive Artifacts
  99. uses: actions/upload-artifact@v2
  100. with:
  101. name: vnote-mac-x64_v${{env.VNOTE_VER}}
  102. path: ${{runner.workspace}}/build/vnote-mac-x64_v${{env.VNOTE_VER}}.dmg
  103. - name: Update Tag
  104. if: github.ref == 'refs/heads/master'
  105. run: |
  106. git tag --force continuous-build ${GITHUB_SHA}
  107. git push --force --tags
  108. - name: Update Continuous Build Release
  109. if: github.ref == 'refs/heads/master'
  110. uses: johnwbyrd/[email protected]
  111. with:
  112. token: ${{ secrets.GITHUB_TOKEN }}
  113. files: ${{runner.workspace}}/build/vnote-mac-x64.dmg
  114. release: Continuous Build
  115. tag: continuous-build