mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-06 16:16:44 +08:00
- 修复 benchmark workflow 过滤器输入的 shell 注入风险 - 统一 request 与 stream invoker 基准中 MediatR handler 的生命周期基线 - 更新 request pipeline benchmark 的缓存清理与空行为类型声明 - 压缩 cqrs-rewrite active 跟踪与 trace,记录本轮 PR review 收尾结论
72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
# Copyright (c) 2025-2026 GeWuYou
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
name: Benchmark
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
benchmark_filter:
|
|
description: '可选的 BenchmarkDotNet 过滤器;留空时仅执行 benchmark 项目 Release build'
|
|
required: false
|
|
default: ''
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
benchmark:
|
|
name: Benchmark Build Or Run
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup .NET 10
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
|
|
- name: Cache NuGet packages
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
~/.nuget/packages
|
|
~/.local/share/NuGet
|
|
key: ${{ runner.os }}-nuget-benchmarks-${{ hashFiles('GFramework.Cqrs.Benchmarks/*.csproj', 'GFramework.Cqrs/*.csproj', 'GFramework.Cqrs.Abstractions/*.csproj', 'GFramework.Core/*.csproj', 'GFramework.Core.Abstractions/*.csproj', '**/nuget.config') }}
|
|
|
|
- name: Restore benchmark project
|
|
run: dotnet restore GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj
|
|
|
|
- name: Build benchmark project
|
|
run: dotnet build GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj -c Release --no-restore
|
|
|
|
- name: Report build-only mode
|
|
if: ${{ inputs.benchmark_filter == '' }}
|
|
run: |
|
|
echo "No benchmark filter provided."
|
|
echo "Workflow completed after validating the benchmark project build."
|
|
|
|
- name: Run filtered benchmarks
|
|
if: ${{ inputs.benchmark_filter != '' }}
|
|
env:
|
|
BENCHMARK_FILTER: ${{ inputs.benchmark_filter }}
|
|
run: |
|
|
set -euo pipefail
|
|
dotnet run --project GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj -c Release --no-build -- \
|
|
--filter "$BENCHMARK_FILTER"
|
|
|
|
- name: Upload BenchmarkDotNet artifacts
|
|
if: ${{ always() && inputs.benchmark_filter != '' }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: benchmark-artifacts
|
|
path: |
|
|
BenchmarkDotNet.Artifacts/**
|
|
GFramework.Cqrs.Benchmarks/bin/Release/net10.0/BenchmarkDotNet.Artifacts/**
|
|
if-no-files-found: ignore
|