Skip to content

Commit 9869a6c

Browse files
committed
[重构项目结构和工作流]: 对项目文件结构和GitHub Actions工作流进行了一系列的重构和改进。
- 更新了`build.yml`工作流,移除了对特定文件变更的忽略,统一了构建类型为`RelWithDebInfo`,并且引入了新的`install-vcpkg`动作,更新了vcpkg的缓存策略。 - 删除了`clean_cache.yml`工作流中的定时触发,仅保留手动触发。 - 在`delete_workflow.yml`中更新了删除运行的结论模式。 - 更新了`readme.yml`工作流,去除了Node.js的版本设置。 - 删除了`toolchain.yml`文件,因为它的功能可能已经合并到其他工作流中。 - 删除了`AtomicQueue`目录及其相关文件,因为该功能可能已经过时或不再需要。 - 更新了`Breakpad`目录中的文件,更改了可执行文件和链接库的名称。 - 添加了全新的`Crashpad`目录和相关文件,用于集成Crashpad错误报告功能。 - 更新了`CMakeLists.txt`文件,增加了新的子目录和依赖,并且提升了CMake的最低版本要求。 - 更新了`CountDownLatch`、`Curl`、`DesignPattern`、`Glog`、`Icmp`、`MonitorDir`、`Mutex`、`OpenSSL`、`Thread`等目录中的文件,主要是更改了头文件的包含路径。 - 添加了`build_info.cmake`、`common.cmake`和`vcpkg.cmake`文件,用于改进项目的构建系统。 - 添加了`setVsDev.ps1` PowerShell脚本,用于设置Visual Studio开发环境。 - 重命名了一些文件,将`object.hpp`和`scopeguard.hpp`移动到了`utils`目录下。 - 添加了`vcpkg.json`文件,用于管理项目的vcpkg依赖。
1 parent d823c6c commit 9869a6c

37 files changed

+420
-421
lines changed

.github/workflows/build.yml

+38-51
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
name: CMake Build
22

33
on:
4-
# push代码时触发workflow
54
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:
116
- '.clang*'
127
- '.gitignore'
138
- 'LICENSE'
149
- 'README*'
1510
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:
2112
- '.clang*'
2213
- '.gitignore'
2314
- 'LICENSE'
@@ -35,74 +26,73 @@ jobs:
3526
- macos-latest
3627
- ubuntu-latest
3728
build_type:
38-
- "Release"
29+
- "RelWithDebInfo"
3930
generators:
4031
- "Ninja"
41-
vcpkg_libs:
42-
- glog breakpad benchmark gtest openssl[tools] curl[openssl,brotli,c-ares,http2,tool]
4332

4433
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-
5834
- name: Install dependencies on windows
5935
if: startsWith(matrix.os, 'windows')
6036
run: |
6137
choco install ninja
6238
ninja --version
6339
cmake --version
64-
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-windows
6540
- name: Install dependencies on macos
6641
if: startsWith(matrix.os, 'macos')
6742
shell: bash
6843
run: |
69-
brew install ninja
44+
brew install ninja python-setuptools
7045
ninja --version
7146
cmake --version
7247
clang --version
73-
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-osx
7448
- name: Install dependencies on ubuntu
7549
if: startsWith(matrix.os, 'ubuntu')
7650
run: |
7751
sudo apt-get update
78-
sudo apt-get install ninja-build
52+
sudo apt-get install ninja-build clang
7953
ninja --version
8054
cmake --version
8155
gcc --version
82-
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-linux
8356
8457
- uses: actions/checkout@v4
8558
with:
8659
fetch-depth: 1
8760

88-
- name: Enable Developer Command Prompt
89-
if: startsWith(matrix.os, 'windows')
90-
uses: ilammy/[email protected]
61+
- name: Install custom vcpkg
62+
uses: RealChuan/install-vcpkg@main
9163
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
9568
shell: bash
9669
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
10696
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
10797
shell: bash
10898
run: |
@@ -111,10 +101,7 @@ jobs:
111101
-B ./build \
112102
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
113103
-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)
118105
cmake --build ./build --config ${{ matrix.build_type }}
119106
120107
- name: Test

.github/workflows/clean_cache.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Cleanup caches by a branch
22
on:
3-
# 每周一 0 点触发
4-
schedule:
5-
- cron: '0 0 * * 1'
63
workflow_dispatch:
74

85
jobs:

.github/workflows/delete_workflow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
delete_run_by_conclusion_pattern:
2828
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
2929
required: true
30-
default: "failure"
30+
default: "Unsuccessful: action_required,cancelled,failure,skipped"
3131
type: choice
3232
options:
3333
- "ALL"

.github/workflows/readme.yml

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v4
18-
with:
19-
node-version: 12.x
2018
# ISO Langusge Codes: https://cloud.google.com/translate/docs/languages
2119
- name: Adding README - English
2220
uses: dephraiim/translate-readme@main

.github/workflows/toolchain.yml

-65
This file was deleted.

AtomicQueue/CMakeLists.txt

-5
This file was deleted.

AtomicQueue/atomicqueue.hpp

-71
This file was deleted.

0 commit comments

Comments
 (0)