-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.54 KB
/
Copy pathCI.yaml
File metadata and controls
88 lines (74 loc) · 2.54 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
name: Build Project
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
# 设置MSBuild
- name: setup-msbuild
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
# 安装 vcpkg
- name: Setup vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg; .\bootstrap-vcpkg.bat
.\vcpkg.exe integrate install
# 安装 Qt
- name: Setup Qt6
uses: jurplel/install-qt-action@v4.1.1
with:
host: windows
version: 6.8.0
setup-python: false
arch: 'win64_msvc2022_64'
cache: true
- name: Set vcpkg binary cache directory
run: echo "VCPKG_DEFAULT_BINARY_CACHE=$(pwd)/vcpkg_binary_cache" >> $GITHUB_ENV
- name: Cache vcpkg binary cache
id: cache-vcpkg-binary
uses: actions/cache@v3
with:
path: vcpkg_binary_cache
key: ${{ runner.os }}-vcpkg-binary-${{ hashFiles('vcpkg.json') }}
# 安装 vcpkg 依赖
- name: Install dependencies from vcpkg.json
run: |
.\vcpkg\vcpkg install
# 安装 QtMsBuild
- name: Install QtMsBuild
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://download.qt.io/development_releases/vsaddin/3.3.1/qt-vsaddin-msbuild-3.3.1.zip" -OutFile "msbuild.zip"
Expand-Archive -Path "msbuild.zip" -DestinationPath ".\Schedule\QtMsBuild"
# 设置 MSBuild 环境变量
- name: Setup environment variables
run: |
echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV
echo "PATH=$(pwd)/vcpkg:$PATH" >> $GITHUB_ENV
echo "CXXFLAGS=-I$(pwd)/vcpkg/installed/x64-windows/include" >> $GITHUB_ENV
echo "LIBS=-L$(pwd)/vcpkg/installed/x64-windows/lib" >> $GITHUB_ENV
echo "QTDIR=$QT_ROOT_DIR" >> $GITHUB_ENV
echo "QtMsBuild=$(pwd)/Schedule/QtMsBuild" >> $GITHUB_ENV # 设置 QtMsBuild 环境变量
echo "PATH=$(pwd)/Schedule/QtMsBuild;$(pwd)/vcpkg;$PATH;%QTDIR%/bin" >> $GITHUB_ENV # 将 QtMsBuild 添加到 PATH
# 使用 MSBuild 构建项目
- name: Build project using MSBuild
run: |
msbuild "Schedule.sln" /p:Configuration=Action /p:Platform=x64
- name: Deploy program using windeployqt
run: |
windeployqt x64/Action/Schedule.exe
- name: Upload Artifacts
uses: actions/upload-artifact@v4.5.0
with:
name: schedule-release
path: x64/Action/