解决MySql布尔型新旧版本兼容问题,采用枚举来表示布尔型的数据表。由正向工程赋值
大石头
authored at
2018-05-15 21:21:05
X
name: test
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
jobs:
# 全解决方案编译校验(含 Samples/Zero.*/Benchmark 等非测试工程),与测试矩阵并行运行
build:
name: build solution
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.x
cache: true
cache-dependency-path: '**/*.csproj'
- name: Build
shell: pwsh
# 源生成器工程既作为解决方案条目、又被多目标工程引用生成,两类实例会被并行重复生成,
# 偶发 CS2012(同一 obj 输出被两个编译器进程写入);重试一次即可(第二次已是增量构建)
run: |
dotnet build -c Release
if ($LASTEXITCODE -ne 0) {
Write-Host '首次构建失败,重试一次(已知并行重复生成竞态)'
dotnet build -c Release
if ($LASTEXITCODE -ne 0) { exit 1 }
}
# 测试矩阵:每个目标框架独立 job,job 间并行且互不争抢宿主资源(进程/端口/CPU),
# 每个 job 只构建自身目标框架,省去全解决方案构建的墙钟开销(编译校验由 build job 承担)。
# 测试内并行度由各工程 xunit.runner.json 的 maxParallelThreads 控制。
test:
name: test (${{ matrix.name }})
runs-on: windows-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: Core-net8.0
project: 'XUnitTest.Core\XUnitTest.Core.csproj'
framework: net8.0
dotnet: |
8.x
10.x
- name: Core-net8.0-windows
project: 'XUnitTest.Core\XUnitTest.Core.csproj'
framework: net8.0-windows
dotnet: |
8.x
10.x
- name: Core-net9.0
project: 'XUnitTest.Core\XUnitTest.Core.csproj'
framework: net9.0
dotnet: |
9.x
10.x
- name: Core-net10.0
project: 'XUnitTest.Core\XUnitTest.Core.csproj'
framework: net10.0
dotnet: 10.x
- name: Core-net10.0-windows
project: 'XUnitTest.Core\XUnitTest.Core.csproj'
framework: net10.0-windows
dotnet: 10.x
- name: Net6-net6.0
project: 'XUnitTest.Net6\XUnitTest.Net6.csproj'
framework: net6.0
dotnet: |
6.x
10.x
- name: Net6-net6.0-windows
project: 'XUnitTest.Net6\XUnitTest.Net6.csproj'
framework: net6.0-windows
dotnet: |
6.x
10.x
- name: Compat-net462
project: 'XUnitTest.Compat\XUnitTest.Compat.csproj'
framework: net462
dotnet: 10.x
- name: Compat-net8.0
project: 'XUnitTest.Compat\XUnitTest.Compat.csproj'
framework: net8.0
dotnet: |
8.x
10.x
- name: SourceGenerator
project: 'XUnitTest.SourceGenerator\XUnitTest.SourceGenerator.csproj'
framework: net10.0
dotnet: 10.x
steps:
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
cache: true
cache-dependency-path: '**/*.csproj'
- name: Test
run: dotnet test ${{ matrix.project }} -f ${{ matrix.framework }} -c Release --logger "trx;LogFileName=${{ matrix.name }}.trx" --results-directory TestResults
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.name }}
path: TestResults/*.trx
if-no-files-found: ignore
# 源生成器随主包分发校验
pack:
name: pack check
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.x
- name: Pack 校验(源生成器随主包分发)
# 校验主包 NewLife.Core 内含 analyzers/dotnet/cs 的分析器程序集,且 lib 正常
run: |
dotnet pack NewLife.Core\NewLife.Core.csproj -c Release -o out-sg
$zip = Get-ChildItem out-sg\NewLife.Core.*.nupkg | Select-Object -First 1
Add-Type -AssemblyName System.IO.Compression.FileSystem
$archive = [System.IO.Compression.ZipFile]::OpenRead($zip.FullName)
$names = $archive.Entries | ForEach-Object { $_.FullName }
$archive.Dispose()
if (-not ($names -contains 'analyzers/dotnet/cs/NewLife.Core.SourceGenerator.dll')) { throw '主包缺少 analyzers/dotnet/cs/NewLife.Core.SourceGenerator.dll' }
if (-not ($names -match '^lib/net8.0/NewLife.Core.dll')) { throw '主包缺少 lib/net8.0/NewLife.Core.dll' }
Write-Host ($names -join "`n")
|