Skip to content

Commit

Permalink
[重构项目结构和工作流]: 对项目文件结构和GitHub Actions工作流进行了一系列的重构和改进。
Browse files Browse the repository at this point in the history
- 更新了`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依赖。
  • Loading branch information
RealChuan committed May 24, 2024
1 parent d823c6c commit 9869a6c
Show file tree
Hide file tree
Showing 37 changed files with 420 additions and 421 deletions.
89 changes: 38 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
name: CMake Build

on:
# push代码时触发workflow
push:
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- '.github/workflows/clean_cache.yml'
- '.github/workflows/delete_workflow.yml'
- '.github/workflows/readme.yml'
- '.github/workflows/toolchain.yml'
paths-ignore:
- '.clang*'
- '.gitignore'
- 'LICENSE'
- 'README*'
pull_request:
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- '.github/workflows/clean_cache.yml'
- '.github/workflows/delete_workflow.yml'
- '.github/workflows/readme.yml'
- '.github/workflows/toolchain.yml'
paths-ignore:
- '.clang*'
- '.gitignore'
- 'LICENSE'
Expand All @@ -35,74 +26,73 @@ jobs:
- macos-latest
- ubuntu-latest
build_type:
- "Release"
- "RelWithDebInfo"
generators:
- "Ninja"
vcpkg_libs:
- glog breakpad benchmark gtest openssl[tools] curl[openssl,brotli,c-ares,http2,tool]

steps:
- name: Restore windows vcpkg
if: startsWith(matrix.os, 'windows')
uses: actions/cache/restore@v3
with:
path: C:\vcpkg\installed
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
- name: Restore macos or ubuntu vcpkg
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
uses: actions/cache/restore@v3
with:
path: /usr/local/share/vcpkg/installed
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}

- name: Install dependencies on windows
if: startsWith(matrix.os, 'windows')
run: |
choco install ninja
ninja --version
cmake --version
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-windows
- name: Install dependencies on macos
if: startsWith(matrix.os, 'macos')
shell: bash
run: |
brew install ninja
brew install ninja python-setuptools
ninja --version
cmake --version
clang --version
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-osx
- name: Install dependencies on ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install ninja-build
sudo apt-get install ninja-build clang
ninja --version
cmake --version
gcc --version
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-linux
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Enable Developer Command Prompt
if: startsWith(matrix.os, 'windows')
uses: ilammy/[email protected]
- name: Install custom vcpkg
uses: RealChuan/install-vcpkg@main
with:
arch: amd64
- name: Configure windows
if: startsWith(matrix.os, 'windows')
repo: 'https://github.com/RealChuan/vcpkg.git'
branch: 'dev'

- name: Update vcpkg manifest baseline
shell: bash
run: |
cmake \
-S . \
-B ./build \
-DCMAKE_C_COMPILER=cl \
-DCMAKE_CXX_COMPILER=cl \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
- name: Configure macos or ubuntu
vcpkg x-update-baseline
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/build/vcpkg_installed
key: ${{ matrix.os }}-vcpkg-installed-${{ runner.os }}-${{ github.sha }}
restore-keys: |
${{ matrix.os }}-vcpkg-installed-${{ runner.os }}-
${{ matrix.os }}-vcpkg-installed-
${{ matrix.os }}-
save-always: true

- name: Configure and build windows
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
.\scripts\windows\setVsDev.ps1
cmake `
-S . `
-B ./build `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-G "${{ matrix.generators }}" `
; if (-not $?) { Get-Content ./build/vcpkg_installed/vcpkg/issue_body.md; exit 1 }
cmake --build ./build --config ${{ matrix.build_type }}
- name: Configure and build macos or ubuntu
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
Expand All @@ -111,10 +101,7 @@ jobs:
-B ./build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
- name: Build
shell: bash
run: |
|| (cat ./build/vcpkg_installed/vcpkg/issue_body.md && exit 1)
cmake --build ./build --config ${{ matrix.build_type }}
- name: Test
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/clean_cache.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Cleanup caches by a branch
on:
# 每周一 0 点触发
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/delete_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
delete_run_by_conclusion_pattern:
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
required: true
default: "failure"
default: "Unsuccessful: action_required,cancelled,failure,skipped"
type: choice
options:
- "ALL"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 12.x
# ISO Langusge Codes: https://cloud.google.com/translate/docs/languages
- name: Adding README - English
uses: dephraiim/translate-readme@main
Expand Down
65 changes: 0 additions & 65 deletions .github/workflows/toolchain.yml

This file was deleted.

5 changes: 0 additions & 5 deletions AtomicQueue/CMakeLists.txt

This file was deleted.

71 changes: 0 additions & 71 deletions AtomicQueue/atomicqueue.hpp

This file was deleted.

Loading

0 comments on commit 9869a6c

Please sign in to comment.