forked from MatsuriDayo/nekoray
-
Notifications
You must be signed in to change notification settings - Fork 2
278 lines (276 loc) · 9.93 KB
/
macos.yml
File metadata and controls
278 lines (276 loc) · 9.93 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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
name: Nekoray build matrix - cmake - with macOS
on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
publish:
description: 'Publish: If want ignore'
required: false
artifact-pack:
description: 'artifact-pack: If want ignore'
required: false
env:
MACOSX_DEPLOYMENT_TARGET: "10.15" # Add the global environment variable here
jobs:
build-go:
strategy:
matrix:
cross_os: [ windows, linux, darwin ]
cross_arch: [ amd64 ]
include:
- cross_os: public_res
cross_arch: public_res
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checking out sources
uses: actions/checkout@v3
- name: Go Status
run: git ls-files go | xargs cat | sha1sum > go_status
- name: Cache Common Download
id: cache-common
uses: actions/cache@v3
with:
path: artifacts.tgz
key: CommonCache-${{ matrix.cross_os }}-${{ matrix.cross_arch }}-${{ hashFiles('libs/*.sh', 'go_status', '*.txt') }}
- name: Install Golang
if: steps.cache-common.outputs.cache-hit != 'true'
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: Build golang parts
if: steps.cache-common.outputs.cache-hit != 'true'
shell: bash
run: |
[ ${{ matrix.cross_os }} == public_res ] || ./libs/get_source.sh
[ ${{ matrix.cross_os }} == public_res ] || GOOS=${{ matrix.cross_os }} GOARCH=${{ matrix.cross_arch }} ./libs/build_go.sh
[ ${{ matrix.cross_os }} == public_res ] || exit 0
./libs/build_public_res.sh
- name: Tar files
if: steps.cache-common.outputs.cache-hit != 'true'
run: tar czvf artifacts.tgz ./deployment
- name: Uploading Artifact
uses: actions/upload-artifact@master
with:
name: NekoRay-${{ github.sha }}-Common-${{ matrix.cross_os }}-${{ matrix.cross_arch }}
path: artifacts.tgz
build-cpp:
strategy:
matrix:
include:
- platform: windows-2022
arch: x64
qt_version: "6.5"
- platform: ubuntu-20.04
arch: x64
qt_version: "5.12"
- platform: macos-11
arch: x64
qt_version: "5.15"
- platform: macos-11
arch: x64
qt_version: "6.5"
fail-fast: false
runs-on: ${{ matrix.platform }}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Checking out sources
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Install MSVC compiler
if: matrix.platform == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1
with:
# 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo
toolset: 14.2
arch: ${{ matrix.arch }}
- name: Download Artifacts for macOS
if: matrix.platform == 'macos-11'
uses: actions/download-artifact@v3
with:
path: download-artifact
# ========================================================================================================= Qt Install
- name: macOS - Install Qt ${{ matrix.qt_version }}
if: matrix.platform == 'macos-11'
uses: jurplel/install-qt-action@v3
with:
DL_QT_VER: ${{ matrix.qt_version }}
version: ${{ matrix.qt_version }}
py7zrversion: ' '
aqtversion: ' '
setup-python: false
cache: true
cache-key-prefix: QtCache-${{ matrix.platform }}-${{ matrix.arch }}
- name: Windows - Download Custom Qt ${{ matrix.qt_version }} SDK
shell: bash
if: matrix.platform == 'windows-2022'
run: |
mkdir qtsdk ; cd qtsdk
if [ "$DL_QT_VER" == "5.15" ]; then
curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt5.15.7-Windows-x86_64-VS2019-16.11.20-20221103.7z
else
curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt6.5.0-Windows-x86_64-VS2022-17.5.5-20230507.7z
fi
7z x *.7z
rm *.7z
mv Qt* Qt
# ========================================================================================================= 编译与 Qt 无关的依赖
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Cache Download
id: cache-deps
uses: actions/cache@v3
with:
path: libs/deps
key: DepsCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('libs/build_deps_*.sh') }}
- name: Build Dependencies
shell: bash
if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.platform != 'ubuntu-20.04'
run: |
./libs/build_deps_all.sh
- name: Build Dependencies (Docker)
shell: bash
if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.platform == 'ubuntu-20.04'
run: |
docker run --rm \
-v $PWD:/nekoray \
-w /nekoray \
ghcr.io/matsuridayo/debian10-qt5:20230131 \
bash -c "./libs/build_deps_all.sh"
# ========================================================================================================= Generate MakeFile and Build
- name: Windows - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'windows-2022'
env:
DL_QT_VER: ${{ matrix.qt_version }}
CC: cl.exe
CXX: cl.exe
run: |
source libs/env_qtsdk.sh $PWD/qtsdk/Qt
mkdir build
cd build
if [ "$DL_QT_VER" == "5.15" ]; then
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
else
cmake -GNinja -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release ..
fi
ninja
cd ..
./libs/deploy_windows64.sh
- name: Linux - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'ubuntu-20.04'
run: |
docker run --rm \
-v $PWD:/nekoray \
-w /nekoray \
ghcr.io/matsuridayo/debian10-qt5:20230131 \
bash -c "mkdir build && pushd build && cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. && ninja && popd &&./libs/deploy_linux64.sh"
- name: macOS - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'macos-11'
env:
DL_QT_VER: ${{ matrix.qt_version }}
run: |
mkdir build
cd build
if [ "$DL_QT_VER" == "5.15" ]; then
cmake -GNinja -DQT_VERSION_MAJOR=5 -DCMAKE_BUILD_TYPE=Release -DNKR_PACKAGE_MACOS=1 ..
else
cmake -GNinja -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release -DNKR_PACKAGE_MACOS=1 ..
fi
ninja
cd ..
./libs/deploy_macos.sh
# ========================================================================================================= Deployments
- name: Tar files
shell: bash
run: tar czvf artifacts.tgz ./deployment
- name: Uploading Artifact
uses: actions/upload-artifact@master
with:
name: NekoRay-${{ github.sha }}-${{ matrix.platform }}-${{ matrix.arch }}
path: artifacts.tgz
publish:
name: Pack & Publish Release
if: github.event.inputs.artifact-pack != 'y'
runs-on: ubuntu-latest
needs:
- build-cpp
- build-go
permissions:
contents: write
packages: write
actions: read
pull-requests: write
issues: write
steps:
- name: Checking out sources
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: download-artifact
- name: Pack
run: |
curl -Lo - https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xzv
mv ghr*linux_amd64/ghr .
####
source libs/deploy_common.sh
find . -name artifacts.tgz | xargs -n1 tar xvzf
cd deployment
cp -r public_res/* linux64
cp -r public_res/* windows64
rm -rf public_res *.pdb
####
mv linux64 nekoray
zip -r $version_standalone-linux64.zip nekoray
rm -rf nekoray
####
mv windows64 nekoray
zip -r $version_standalone-windows64.zip nekoray
rm -rf nekoray
####
mv macos-amd64/nekoray.dmg $version_standalone-macos-amd64.dmg
rm -rf macos-amd64
- name: Pack Debian
if: github.event.inputs.publish != 'y'
run: |
source libs/deploy_common.sh
find . -name artifacts.tgz | xargs -n1 tar xvzf
cd deployment
cp -r public_res/* linux64
cp -r public_res/* windows64
rm -rf public_res *.pdb
####
bash ../libs/package_debian.sh ${{ github.event.inputs.tag }}
mv nekoray.deb $version_standalone-debian-x64.deb
sudo rm -rf nekoray
- name: Pack AppImage
run: |
source libs/deploy_common.sh
find . -name artifacts.tgz | xargs -n1 tar xvzf
cd deployment
cp -r public_res/* linux64
rm -rf public_res *.pdb
####
bash ../libs/package_appimage.sh
mv nekoray-x86_64.AppImage $version_standalone-linux-x64.AppImage
- name: Clean Up
run: |
cd deployment
rm -rf linux64
rm -rf windows64
- name: Uploading Artifact
uses: actions/upload-artifact@master
with:
name: Deployment-${{ github.sha }}
path: deployment
- name: Release
if: github.event.inputs.publish != 'y'
run: |
./ghr -delete -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment