-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05924e7
commit 370ef49
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: C++ CI Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master # 触发工作流的分支,可以根据需要修改 | ||
pull_request: | ||
branches: | ||
- master # 触发PR时的工作流分支 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # 可以选择适合你的操作系统,如ubuntu-latest, windows-latest等 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up CMake | ||
uses: actions/setup-cmake@v3 | ||
with: | ||
cmake-version: '3.30.3' # 使用你的项目中需要的CMake版本,可以根据实际情况调整 | ||
|
||
- name: Set up C++ Build Environment | ||
uses: actions/setup-toolchain@v1 | ||
with: | ||
toolchain: 'clang' # 你也可以根据需要改成gcc或其他工具链 | ||
|
||
- name: Install dependencies (optional, based on your project) | ||
run: | | ||
sudo apt update | ||
sudo apt install -y build-essential | ||
- name: Configure CMake project | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../ # 你可以根据需要调整构建类型 | ||
- name: Build the project | ||
run: | | ||
cd build | ||
cmake --build . --config Release # 指定构建配置,可以根据需要调整 | ||
- name: Run tests (optional) | ||
run: | | ||
cd build | ||
cmake --build . --target test # 如果你的项目有测试,可以启用此步骤 | ||
- name: Upload build artifacts (optional) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: build # 将构建目录上传为构建产物(如果需要) |