From 0cd1e9e83a9c444027bd56196680694a02649d3b Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Wed, 15 Apr 2026 12:47:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(ci):=20=E6=B7=BB=E5=8A=A0CI/CD=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E5=92=8CCQRS=E5=91=BD=E4=BB=A4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 配置CI构建和测试工作流,支持多.NET版本和并发测试 - 添加CodeQL静态代码分析工作流 - 实现自动版本递增和标签创建工作流 - 定义CQRS命令接口规范,包括响应式和流式命令 - 为架构测试添加空值参数异常文档注释 --- .github/workflows/auto-tag.yml | 21 +++++++++++-------- .github/workflows/ci.yml | 6 +++--- .github/workflows/codeql.yml | 8 +++---- ...ArchitectureAdditionalCqrsHandlersTests.cs | 3 +++ 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index 45b9b112..a8e761bd 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -5,6 +5,8 @@ on: workflows: ["CI - Build & Test"] types: - completed + branches: + - main workflow_dispatch: concurrency: group: auto-tag-main @@ -13,15 +15,16 @@ concurrency: jobs: auto-tag: if: > - github.ref == 'refs/heads/main' && ( - ( - github.event_name == 'workflow_run' && - github.event.workflow_run.conclusion == 'success' && - contains(github.event.workflow_run.head_commit.message, '[release ci]') - ) - || - github.event_name == 'workflow_dispatch' + github.event_name == 'workflow_run' && + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.head_branch == 'main' && + contains(github.event.workflow_run.head_commit.message, '[release ci]') + ) + || + ( + github.event_name == 'workflow_dispatch' && + github.ref == 'refs/heads/main' ) runs-on: ubuntu-latest @@ -61,4 +64,4 @@ jobs: fi git tag -a "$TAG" -m "Auto tag $TAG" - git push "https://x-access-token:${PAT}@github.com/${{ github.repository }}.git" "$TAG" \ No newline at end of file + git push "https://x-access-token:${PAT}@github.com/${{ github.repository }}.git" "$TAG" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2b53c25..14606c84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,12 @@ # CI/CD工作流配置:构建和测试.NET项目 -# 该工作流在push到main/master分支或创建pull request时触发 +# 该工作流在推送到任意分支或创建面向任意分支的 pull request 时触发 name: CI - Build & Test on: push: - branches: [ main, master ] + branches: [ '**' ] pull_request: - branches: [ main, master ] + branches: [ '**' ] permissions: contents: read diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1802de8f..1bbc0abd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,14 +4,14 @@ name: "CodeQL" # 触发事件配置 # 在以下情况下触发工作流: -# 1. 推送到main分支时 -# 2. 针对main分支的拉取请求时 +# 1. 推送到任意分支时 +# 2. 针对任意分支的拉取请求时 # 3. 每天凌晨2点执行一次 on: push: - branches: [ "main" ] + branches: [ '**' ] pull_request: - branches: [ "main" ] + branches: [ '**' ] schedule: - cron: '0 2 * * *' diff --git a/GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs b/GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs index 23725e7c..d757beaa 100644 --- a/GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs +++ b/GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs @@ -168,6 +168,9 @@ internal sealed class AdditionalAssemblyNotificationHandlerRegistry : ICqrsHandl /// /// 目标服务集合。 /// 日志记录器。 + /// + /// 当 时抛出。 + /// public void Register(IServiceCollection services, ILogger logger) { ArgumentNullException.ThrowIfNull(services);