Add Version, PackageTags, and Copyright for NuGet package #309
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| disassembly: | |
| description: 'Enable DisassemblyDiagnoser for benchmarks' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Build | |
| run: dotnet build -c Release -bl:build.binlog | |
| - name: Pack | |
| run: dotnet pack -c Release --no-build | |
| - name: Verify NuGet package | |
| run: > | |
| dotnet run --project samples/SortingNetworks.Sample | |
| -p:RestoreSources=$(pwd)/SortingNetworks/bin/Release | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: packages | |
| path: | | |
| **/*.nupkg | |
| **/*.binlog | |
| test-and-benchmark: | |
| name: test & benchmark (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Test | |
| run: dotnet test -c Release | |
| - name: Benchmarks | |
| shell: bash | |
| env: | |
| DISASSEMBLY_DIAGNOSER: ${{ inputs.disassembly && '1' || '0' }} | |
| run: | | |
| dotnet run --project SortingNetworks.Benchmarks -c Release -- --filter '*' --exporters GitHub | |
| for f in BenchmarkDotNet.Artifacts/results/*-report-github.md; do | |
| name=$(basename "$f" -report-github.md) | |
| name=${name##*.} | |
| name=${name%SortingBenchmarks} | |
| echo "## $name" >> benchmark-summary.md | |
| echo "" >> benchmark-summary.md | |
| echo "> **ArraySort** = BCL baseline \`Array.Sort\`, **GeneratedSort** = this library" >> benchmark-summary.md | |
| echo "" >> benchmark-summary.md | |
| cat "$f" >> benchmark-summary.md | |
| echo "" >> benchmark-summary.md | |
| done | |
| if [ "$DISASSEMBLY_DIAGNOSER" = "1" ]; then | |
| for f in BenchmarkDotNet.Artifacts/results/*-asm.md; do | |
| [ -f "$f" ] || continue | |
| name=$(basename "$f" -asm.md) | |
| name=${name##*.} | |
| echo "# Disassembly: $name" >> disassembly-summary.md | |
| echo "" >> disassembly-summary.md | |
| cat "$f" >> disassembly-summary.md | |
| echo "" >> disassembly-summary.md | |
| done | |
| fi | |
| - name: Upload benchmark summary | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: benchmark-summary-${{ matrix.os }} | |
| path: benchmark-summary.md | |
| if-no-files-found: ignore | |
| - name: Upload disassembly | |
| uses: actions/upload-artifact@v7 | |
| if: inputs.disassembly | |
| with: | |
| name: disassembly-${{ matrix.os }} | |
| path: | | |
| disassembly-summary.md | |
| BenchmarkDotNet.Artifacts/results/*-asm.md | |
| if-no-files-found: ignore | |
| summarize: | |
| needs: [test-and-benchmark] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Download all benchmark summaries | |
| uses: actions/download-artifact@v7 | |
| with: | |
| pattern: benchmark-summary-* | |
| - name: Merge summaries | |
| shell: bash | |
| run: | | |
| shopt -s nullglob | |
| dirs=(benchmark-summary-*/) | |
| if [ ${#dirs[@]} -eq 0 ]; then | |
| echo "No benchmark summary artifacts found." >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| for dir in "${dirs[@]}"; do | |
| if [ ! -f "${dir}/benchmark-summary.md" ]; then | |
| continue | |
| fi | |
| os="${dir#benchmark-summary-}" | |
| os="${os%/}" | |
| echo "# ${os}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| cat "${dir}/benchmark-summary.md" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| done |