You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 该工作流用于构建 .NET 项目
# 更多信息参考: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
# 工作流名称
name : .NET
# 触发条件:指定事件触发工作流
on :
# 1. 当代码推送到 master 分支时触发
push :
branches : [ "master" ]
# 2. 当向 master 分支提交拉取请求( PR) 时触发
pull_request :
branches : [ "master" ]
# 定义作业( Job) : 一个工作流可包含多个作业, 默认串行执行
jobs :
# 作业名称: build( 构建)
build :
# 作业运行环境:基于最新版 Ubuntu 系统
runs-on : ubuntu-latest
# 作业步骤:按顺序执行的具体操作
steps :
# 步骤1: 拉取代码仓库到运行环境
# 使用官方 action: actions/checkout@v4, 负责获取仓库源码
- uses : actions/checkout@v4
# 步骤2: 配置 .NET 环境
# 使用官方 action: actions/setup-dotnet@v4, 安装指定版本 .NET SDK
- name : Setup .NET
uses : actions/setup-dotnet@v4
with :
# 指定要安装的 .NET 版本( 9.0.x 表示最新的 9.0 系列版本)
dotnet-version : 9.0 .x
# 步骤3: 还原项目依赖
# 执行 dotnet restore 命令,恢复项目所需的 NuGet 包
- name : Restore dependencies
run : dotnet restore ./src/KopSoftWms
# 步骤4: 构建项目
# 执行 dotnet build 命令构建项目,--no-restore 表示跳过依赖还原(已单独执行过)
- name : Build
run : dotnet build ./src/KopSoftWms --no-restore
# 步骤5: 测试项目( 已注释, 暂不执行)
# 执行 dotnet test 命令运行单元测试,--no-build 表示跳过构建(已单独执行过)
# --verbosity normal 表示输出普通详细程度的日志
# - name: Test
# run: dotnet test ./src/KopSoftWms --no-build --verbosity normal