-
-
Notifications
You must be signed in to change notification settings - Fork 68
144 lines (126 loc) · 6 KB
/
macos.yml
File metadata and controls
144 lines (126 loc) · 6 KB
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
# Author:Kang Lin <kl222@126.com>
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:
include:
- VCPKG_TARGET_TRIPLET: x64-osx
os: macos-15-intel
qt_version: 6.9.3
qt_arch: clang_64
- VCPKG_TARGET_TRIPLET: arm64-osx
os: macos-15
qt_version: 6.9.3
qt_arch: clang_64
- VCPKG_TARGET_TRIPLET: arm64-osx
os: macos-14
qt_version: 6.9.3
qt_arch: clang_64
# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
# See: https://github.com/actions/runner-images/
runs-on: ${{matrix.os}}
env:
BUILD_TYPE: Release
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOLS_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_macos
qt_modules: "qtscxml qtmultimedia qtserialport qt5compat qtwebsockets qtpositioning qtwebchannel"
artifact_name: build_macos
VCPKGGITCOMMITID: 4c5ae6b55f3e3e39d291679f89822f496cf190ee
SerialPortAssistant_VERSION: v0.5.33
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Make directories
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOLS_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{env.BUILD_DIR}}
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: Cache-installed-macos_qt${{matrix.qt_version}}_${{matrix.qt_arch}}_${{matrix.VCPKG_TARGET_TRIPLET}}_Release
- 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.TOOLS_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: build SerialPortAssistant
working-directory: ${{env.BUILD_DIR}}
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
export PATH=$PATH:${Qt6_DIR}/bin
cmake ${{github.workspace}} \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{env.BUILD_DIR}}/SerialPortAssistant.App/Contents \
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake \
-DVCPKG_VERBOSE=ON \
-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \
-DVCPKG_APPLOCAL_DEPS=ON \
-DVCPKG_TARGET_TRIPLET=${{matrix.VCPKG_TARGET_TRIPLET}} \
-DINSTALL_QT=ON \
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
cmake --build . --config Release --target install
echo "executable bin/macdeployqt `pwd`/SerialPortAssistant.App -dmg -verbose=3"
macdeployqt SerialPortAssistant.App -dmg -verbose=3
7z a SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip SerialPortAssistant.App
if [ -f SerialPortAssistant.dmg ]; then
cp SerialPortAssistant.dmg SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.dmg
fi
- name: Update configure file
working-directory: ${{github.workspace}}/build
run: |
echo "md5 SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip"
md5 SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip
MD5SUM=`md5 SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip|awk '{print $4}'`
echo "SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip md5sum: ${MD5SUM}"
SerialPortAssistant.App/Contents/MacOS/SerialPortAssistant \
--file-name SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip \
--md5 "${MD5SUM}" \
-u "https://github.com/KangLin/SerialPortAssistant/releases/download/v${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip,https://sourceforge.net/projects/rabbitSerialPortAssistant/v${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip?viasf=1"
- name: Update artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}_${{matrix.qt_version}}_${{matrix.os}}
path: |
${{github.workspace}}/build/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.zip
${{github.workspace}}/build/update_macos_${{matrix.qt_version}}.json
${{github.workspace}}/build/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.os}}.dmg