-
-
Notifications
You must be signed in to change notification settings - Fork 63
176 lines (156 loc) · 7.43 KB
/
msvc.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Author:Kang Lin <[email protected]>
name: build_msvc
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_msvc.outputs.name }}
jobs:
build_msvc:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
qt_version: [6.8.2, 5.15.2, 5.12.12]
include:
- qt_version: 6.8.2
VCPKG_TARGET_TRIPLET: x64-windows
VCPKG_PLATFORM_TOOLSET: v143
qt_arch: win64_msvc2022_64
CMAKE_GENERATOR_PLATFORM: x64
qt_modules: qtscxml qtserialport
- qt_version: 5.15.2
VCPKG_TARGET_TRIPLET: x64-windows
VCPKG_PLATFORM_TOOLSET: v143
qt_arch: win64_msvc2019_64
CMAKE_GENERATOR_PLATFORM: x64
VCPKG_MANIFEST_DIR: "\\vcpkg\\manifests"
- qt_version: 5.12.12
VCPKG_TARGET_TRIPLET: x86-windows
VCPKG_PLATFORM_TOOLSET: v143
qt_arch: win32_msvc2017
CMAKE_GENERATOR_PLATFORM: Win32
VCPKG_MANIFEST_DIR: "\\vcpkg\\manifests"
# 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/
runs-on: windows-latest
env:
SerialPortAssistant_VERSION: v0.5.29
SOURCE_DIR: ${{github.workspace}}\.cache\source
TOOSL_DIR: ${{github.workspace}}\.cache\tools
INSTALL_DIR: ${{github.workspace}}\.cache\install_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}}
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}}
VCPKGGITCOMMITID: 59aeb8fe8fe1c980de6bd5ba634cf21024522d81
VCPKG_TARGET_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}}
VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}}
VCPKG_MANIFEST_DIR: "${{github.workspace}}${{matrix.VCPKG_MANIFEST_DIR}}"
qt_modules: ${{matrix.qt_modules}}
artifact_name: build_msvc
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
defaults:
run:
shell: cmd
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Make directories
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-msvc-${{matrix.qt_arch}}
- 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: build SerialPortAssistant
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
run: |
cmake ${{github.workspace}} ^
-A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^
-T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^
-DCMARK_SHARED=OFF ^
-DCMARK_TESTS=OFF ^
-DCMARK_STATIC=ON ^
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install ^
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake ^
-DVCPKG_MANIFEST_DIR=${{env.VCPKG_MANIFEST_DIR}} ^
-DVCPKG_VERBOSE=ON ^
-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON ^
-DVCPKG_APPLOCAL_DEPS=ON ^
-DRABBIT_ENABLE_INSTALL_DEPENDENT=ON ^
-DRABBIT_ENABLE_INSTALL_QT=ON ^
-DRABBIT_ENABLE_INSTALL_TO_BUILD_PATH=OFF
cmake --build . --config ${{matrix.BUILD_TYPE}}
- name: Package
working-directory: ${{github.workspace}}/build
if: ${{ matrix.BUILD_TYPE == 'Release' }}
run: |
cmake --install . --config ${{matrix.BUILD_TYPE}} --component=Application
cmake --install . --config ${{matrix.BUILD_TYPE}} --component=Runtime
cmake --install . --config ${{matrix.BUILD_TYPE}} --component=DependLibraries
copy /Y vcpkg_installed\${{matrix.VCPKG_TARGET_TRIPLET}}\bin\*.dll install\bin
copy /Y ${{env.INSTALL_DIR}}\bin\*.dll install\bin
copy /Y ${{env.INSTALL_DIR}}\lib\*.dll install\bin
makensis Install.nsi
copy /Y SerialPortAssistant_Setup_${{env.SerialPortAssistant_VERSION}}.exe SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe
- name: Update configure file
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version == '6.8.2' }}
working-directory: ${{github.workspace}}\build
run: |
.\install\bin\SerialPortAssistant.exe ^
-f "${{github.workspace}}\build\update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json" ^
--foc 1 ^
-p ${{github.workspace}}\build\SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe ^
-m "${{env.SerialPortAssistant_VERSION}}" ^
-u "https://github.com/KangLin/SerialPortAssistant/releases/download/${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe ;https://sourceforge.net/projects/rabbitSerialPortAssistant/${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe?viasf=1"
- name: Update artifact
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version != '5.15.2' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}_${{matrix.qt_version}}_${{matrix.qt_arch}}
path: |
${{github.workspace}}\build\SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe
${{github.workspace}}\build\update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json
# - name: Upload To Github Release
# if: ${{ matrix.BUILD_TYPE == 'Release' && '5.12.12' == matrix.qt_version && 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}}\build\SerialPortAssistant_Setup_${{env.SerialPortAssistant_VERSION}}.exe
# ${{github.workspace}}\build\update_windows.xml
#