-
-
Notifications
You must be signed in to change notification settings - Fork 7
143 lines (124 loc) · 5.43 KB
/
macos.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
# Author: Kang Lin <[email protected]>
name: build_macos
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_macos.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build_macos:
strategy:
matrix:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: [Release, Debug]
qt_version: [6.6.2, 5.15.2, 5.12.12]
qt_arch: [clang_64]
config_arch: [x86_64]
VCPKG_TARGET_TRIPLET: [x64-osx]
include:
- qt_version: 6.6.2
qt_modules: qtscxml qtmultimedia qtwebchannel qtwebsockets qtwebview qtpositioning
- qt_version: 5.15.2
- qt_version: 5.12.12
# See: https://docs.github.com/zh/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
# See: https://github.com/actions/runner-images/tree/main
runs-on: macos-13
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install
qt_modules: qtwebengine ${{matrix.qt_modules}}
VCPKGGITCOMMITID: 59aeb8fe8fe1c980de6bd5ba634cf21024522d81
VCPKG_TARGET_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}}
artifact_name: build_macos
Calendar_VERSION: 1.0.20
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Make directories
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}/build
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: install_macos_qt${{matrix.qt_version}}_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}}
- name: run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{runner.workspace}}/vcpkg/
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
dir: '${{env.TOOSL_DIR}}/qt' # optional
version: '${{matrix.qt_version}}' # optional, default is 5.15.2
arch: '${{matrix.qt_arch}}' # optional
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/
cache: true
cache-key-prefix: cached_qt
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: Compile
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
cmake ${{github.workspace}} \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake \
-DVCPKG_VERBOSE=ON \
-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \
-DVCPKG_APPLOCAL_DEPS=ON \
-DINSTALL_QT=ON \
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install
7z a Calendar_${{env.Calendar_VERSION}}_macos_qt${{matrix.qt_version}}.zip ./install/*
- name: Update configure file
if: ${{ matrix.BUILD_TYPE == 'Release' }}
working-directory: ${{github.workspace}}/build
run: |
${{env.SOURCE_DIR}}/RabbitCommon/Install/GenerateJsonFile.sh \
"${{github.workspace}}/build/update_macos_${{matrix.qt_version}}.json" \
Calendar_${{env.Calendar_VERSION}}_macos_qt${{matrix.qt_version}}.zip \
macos ${{matrix.config_arch}} \
"https://github.com/KangLin/Calendar/releases/download/v${{env.Calendar_VERSION}}/Calendar_${{env.Calendar_VERSION}}_macos_qt${{matrix.qt_version}}.zip,https://sourceforge.net/projects/rabbitcalendar/files/v${{env.Calendar_VERSION}}/Calendar_${{env.Calendar_VERSION}}_macos_qt${{matrix.qt_version}}.zip"
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version == '6.6.2' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/build/Calendar_${{env.Calendar_VERSION}}_macos_qt${{matrix.qt_version}}.zip
${{github.workspace}}/build/update_macos_${{matrix.qt_version}}.json
# - name: Upload To Github Release
# if: ${{ matrix.BUILD_TYPE == 'Release' && startsWith(github.ref, 'refs/tags/') }}
# uses: softprops/action-gh-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# prerelease: true
# body: |
# [:cn: 修改日志](ChangeLog_zh_CN.md) [:us: Change log](ChangeLog.md)
# files: |
# ${{github.workspace}}/rabbitcommon_${{env.RabbitCommon_VERSION}}_amd64.deb