-
Notifications
You must be signed in to change notification settings - Fork 67
113 lines (111 loc) · 3.82 KB
/
windows.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
name: Windows
on:
# push代码时触发workflow
push:
# 忽略README.md
paths-ignore:
- "README.md"
- "LICENSE"
- "BUILD.md"
# pull_request时触发workflow
pull_request:
# 忽略README.md
paths-ignore:
- "README.md"
- "LICENSE"
- "BUILD.md"
release:
types: [published]
jobs:
build:
name: Build
strategy:
matrix:
qt_version: [5.15.2]
platform: [windows-latest]
build_type: [Release, RelWithDebInfo]
arch: [x64]
include:
- platform: windows-latest
arch: x64
qtarch: win64_msvc2019_64
fail-fast: false
runs-on: ${{ matrix.platform }}
env:
targetName: lemon.exe
# 步骤
steps:
- name: Get the version
id: get_version
shell: bash
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
- name: Checking out sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install Python 3.9 version
uses: actions/setup-python@v4
with:
python-version: "3.9"
architecture: ${{ matrix.arch }}
- name: Restoring submodules
run: git submodule update --init
# =========================================================================================================
- name: Install MSVC compiler
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: Cache Qt
id: cache-qt
uses: actions/cache@v4
with:
path: ../Qt
key: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }}
- name: Installing Qt - ${{ matrix.arch }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
arch: ${{ matrix.qtarch }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}
setup-python: "false"
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Generate Dependencies and Build
shell: bash
env:
CC: cl.exe
CXX: cl.exe
run: |
cmake . -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DLEMON_BUILD_INFO="Build for Windows" -DLEMON_BUILD_EXTRA_INFO="Build on Windows ${{matrix.arch}}" -DENABLE_XLS_EXPORT=ON
cmake --build . --parallel $(nproc)
- name: package
env:
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
shell: pwsh
run: |
# 创建文件夹
New-Item -ItemType Directory ${{ env.archiveName }}
# 拷贝exe
Copy-Item ${{ env.targetName }} ${{ env.archiveName}}\
# 拷贝依赖
windeployqt --qmldir . ${{ env.archiveName }}\${{ env.targetName }}
# 打包zip
Compress-Archive -Path ${{ env.archiveName }} ${{ env.archiveName }}'.zip'
- name: Upload artifact
uses: actions/upload-artifact@v4
env:
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
with:
name: lemon-win-${{matrix.arch}}-${{ matrix.build_type }}.zip
path: ${{ env.archiveName }}.zip
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v1-release
env:
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.archiveName }}.zip
asset_name: lemon-win-${{matrix.arch}}-${{ matrix.build_type }}.zip
tag: ${{ github.ref }}
overwrite: true