⬆️(deps): Bump MSTest.TestFramework from 3.6.0 to 3.6.1 #626
Workflow file for this run
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
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
paths: | |
- .github/workflows/build.yml | |
- .config/dotnet-tools.json | |
- global.json | |
- nuget.config | |
- Shimakaze.Sdk.sln | |
- Directory.Build.props | |
- Directory.Build.targets | |
- Directory.Packages.props | |
- "src/**/*" | |
- "sdk/**/*" | |
- "test/**/*" | |
pull_request: | |
branches: | |
- master | |
- develop | |
paths: | |
- .github/workflows/build.yml | |
- .config/dotnet-tools.json | |
- global.json | |
- nuget.config | |
- Shimakaze.Sdk.sln | |
- Directory.Build.props | |
- Directory.Build.targets | |
- Directory.Packages.props | |
- "src/**/*" | |
- "sdk/**/*" | |
- "test/**/*" | |
merge_group: | |
jobs: | |
build-dotnet: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
name: .Net 构建 ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: 签出仓库 | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: 配置 .Net 环境 | |
uses: actions/setup-dotnet@v4.0.1 | |
with: | |
global-json-file: ./global.json | |
cache-dependency-path: ./**/packages.lock.json | |
cache: false | |
- name: 还原本地工具 | |
shell: pwsh | |
run: dotnet tool restore | |
- name: 还原 | |
shell: pwsh | |
run: dotnet restore | |
- name: 构建 | |
shell: pwsh | |
run: dotnet build --graph --configuration Release --no-restore | |
- name: 测试 | |
shell: pwsh | |
run: dotnet coverage collect -f cobertura dotnet test --graph --configuration Release --no-build | |
- name: 打包 | |
shell: pwsh | |
run: dotnet pack --graph --configuration Release --no-restore --no-build --include-symbols --include-source | |
- name: 生成校验和 | |
shell: pwsh | |
env: | |
matrix_os : ${{ matrix.os }} | |
run: | | |
Write-Output "### Build Success :rocket: $env:matrix_os" >> $env:GITHUB_STEP_SUMMARY | |
Write-Output "|File|SHA256|" >> $env:GITHUB_STEP_SUMMARY | |
Write-Output "|:-|:-:|" >> $env:GITHUB_STEP_SUMMARY | |
Get-ChildItem nupkg | ForEach-Object { | |
Write-Output "|$($PSItem.Name)|$((Get-FileHash $PSItem -Algorithm SHA256).Hash)|" >> $env:GITHUB_STEP_SUMMARY | |
} | |
- name: 收集 Nuget 包 | |
uses: actions/upload-artifact@v4.4.0 | |
with: | |
name: nuget-packages-${{ matrix.os }} | |
path: | | |
nupkg/* | |
retention-days: 3 | |
- name: 收集测试覆盖率 | |
uses: coverallsapp/github-action@v2 | |
continue-on-error: true | |
with: | |
flag-name: run-${{ join(matrix.*, '-') }} | |
parallel: true | |
file: ./output.cobertura.xml | |
coverage-upload: | |
needs: build-dotnet | |
if: ${{ always() }} | |
name: 上传测试覆盖率 | |
runs-on: ubuntu-latest | |
steps: | |
- name: 上传测试覆盖率 | |
uses: coverallsapp/github-action@v2 | |
continue-on-error: true | |
with: | |
parallel-finished: true | |
carryforward: "run-ubuntu-latest,run-windows-latest,run-macos-latest" | |
release: | |
needs: build-dotnet | |
name: 发布 | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
discussions: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: nuget-packages-windows-latest | |
path: artifact | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: artifact/* | |
- name: 推送 Nuget 包 | |
shell: pwsh | |
continue-on-error: true | |
env: | |
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
run: | | |
Set-Location nupkg | |
dotnet nuget push *.nupkg -s nuget -k $env:NUGET_TOKEN --skip-duplicate | |
Set-Location .. |