1
1
name : CMake Build
2
2
3
3
on :
4
- # push代码时触发workflow
5
4
push :
6
- paths-ignore : # 下列文件的变更不触发部署,可以自行添加
7
- - ' .github/workflows/clean_cache.yml'
8
- - ' .github/workflows/delete_workflow.yml'
9
- - ' .github/workflows/readme.yml'
10
- - ' .github/workflows/toolchain.yml'
5
+ paths-ignore :
11
6
- ' .clang*'
12
7
- ' .gitignore'
13
8
- ' LICENSE'
14
9
- ' README*'
15
10
pull_request :
16
- paths-ignore : # 下列文件的变更不触发部署,可以自行添加
17
- - ' .github/workflows/clean_cache.yml'
18
- - ' .github/workflows/delete_workflow.yml'
19
- - ' .github/workflows/readme.yml'
20
- - ' .github/workflows/toolchain.yml'
11
+ paths-ignore :
21
12
- ' .clang*'
22
13
- ' .gitignore'
23
14
- ' LICENSE'
@@ -35,74 +26,73 @@ jobs:
35
26
- macos-latest
36
27
- ubuntu-latest
37
28
build_type :
38
- - " Release "
29
+ - " RelWithDebInfo "
39
30
generators :
40
31
- " Ninja"
41
- vcpkg_libs :
42
- - glog breakpad benchmark gtest openssl[tools] curl[openssl,brotli,c-ares,http2,tool]
43
32
44
33
steps :
45
- - name : Restore windows vcpkg
46
- if : startsWith(matrix.os, 'windows')
47
- uses : actions/cache/restore@v3
48
- with :
49
- path : C:\vcpkg\installed
50
- key : ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
51
- - name : Restore macos or ubuntu vcpkg
52
- if : startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
53
- uses : actions/cache/restore@v3
54
- with :
55
- path : /usr/local/share/vcpkg/installed
56
- key : ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
57
-
58
34
- name : Install dependencies on windows
59
35
if : startsWith(matrix.os, 'windows')
60
36
run : |
61
37
choco install ninja
62
38
ninja --version
63
39
cmake --version
64
- vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-windows
65
40
- name : Install dependencies on macos
66
41
if : startsWith(matrix.os, 'macos')
67
42
shell : bash
68
43
run : |
69
- brew install ninja
44
+ brew install ninja python-setuptools
70
45
ninja --version
71
46
cmake --version
72
47
clang --version
73
- vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-osx
74
48
- name : Install dependencies on ubuntu
75
49
if : startsWith(matrix.os, 'ubuntu')
76
50
run : |
77
51
sudo apt-get update
78
- sudo apt-get install ninja-build
52
+ sudo apt-get install ninja-build clang
79
53
ninja --version
80
54
cmake --version
81
55
gcc --version
82
- vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-linux
83
56
84
57
- uses : actions/checkout@v4
85
58
with :
86
59
fetch-depth : 1
87
60
88
- - name : Enable Developer Command Prompt
89
- if : startsWith(matrix.os, 'windows')
90
-
61
+ - name : Install custom vcpkg
62
+ uses : RealChuan/install-vcpkg@main
91
63
with :
92
- arch : amd64
93
- - name : Configure windows
94
- if : startsWith(matrix.os, 'windows')
64
+ repo : ' https://github.com/RealChuan/vcpkg.git'
65
+ branch : ' dev'
66
+
67
+ - name : Update vcpkg manifest baseline
95
68
shell : bash
96
69
run : |
97
- cmake \
98
- -S . \
99
- -B ./build \
100
- -DCMAKE_C_COMPILER=cl \
101
- -DCMAKE_CXX_COMPILER=cl \
102
- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
103
- -G "${{ matrix.generators }}" \
104
- -DCMAKE_INSTALL_PREFIX:PATH=instdir
105
- - name : Configure macos or ubuntu
70
+ vcpkg x-update-baseline
71
+
72
+ - name : Cache vcpkg
73
+ uses : actions/cache@v4
74
+ with :
75
+ path : ${{ github.workspace }}/build/vcpkg_installed
76
+ key : ${{ matrix.os }}-vcpkg-installed-${{ runner.os }}-${{ github.sha }}
77
+ restore-keys : |
78
+ ${{ matrix.os }}-vcpkg-installed-${{ runner.os }}-
79
+ ${{ matrix.os }}-vcpkg-installed-
80
+ ${{ matrix.os }}-
81
+ save-always : true
82
+
83
+ - name : Configure and build windows
84
+ if : startsWith(matrix.os, 'windows')
85
+ shell : pwsh
86
+ run : |
87
+ .\scripts\windows\setVsDev.ps1
88
+ cmake `
89
+ -S . `
90
+ -B ./build `
91
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
92
+ -G "${{ matrix.generators }}" `
93
+ ; if (-not $?) { Get-Content ./build/vcpkg_installed/vcpkg/issue_body.md; exit 1 }
94
+ cmake --build ./build --config ${{ matrix.build_type }}
95
+ - name : Configure and build macos or ubuntu
106
96
if : startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
107
97
shell : bash
108
98
run : |
@@ -111,10 +101,7 @@ jobs:
111
101
-B ./build \
112
102
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
113
103
-G "${{ matrix.generators }}" \
114
- -DCMAKE_INSTALL_PREFIX:PATH=instdir
115
- - name : Build
116
- shell : bash
117
- run : |
104
+ || (cat ./build/vcpkg_installed/vcpkg/issue_body.md && exit 1)
118
105
cmake --build ./build --config ${{ matrix.build_type }}
119
106
120
107
- name : Test
0 commit comments