Bump the packages group with 3 updates (#77) #309
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: Build & Release | |
| permissions: | |
| actions: read | |
| pull-requests: write | |
| security-events: write | |
| contents: write | |
| checks: write | |
| on: | |
| push: | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| build-version-number: 0.1.${{ github.run_number }} | |
| package-version-number: 0.1.${{ github.run_number }} | |
| jobs: | |
| sca: | |
| uses: ./.github/workflows/sca.yml | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v5 | |
| - name: Restore tools | |
| run: dotnet tool restore | |
| - name: Run tests | |
| run: dotnet test -c Debug --filter FullyQualifiedName!~integration /p:CollectCoverage=true /p:CoverletOutput=./TestResults/coverage.info /p:CoverletOutputFormat=cobertura --logger "trx;LogFileName=test_results.trx" | |
| - name: Consolidate code coverage | |
| run: dotnet reportgenerator -reports:./test/**/coverage.info -targetdir:./reports/codecoverage -reporttypes:Html | |
| - name: Archive Test results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: tests.results | |
| path: | | |
| ./test/**/TestResults/* | |
| - name: Unit test results | |
| uses: dorny/test-reporter@v3 | |
| if: always() | |
| with: | |
| name: unit test results | |
| path: ${{ github.workspace }}/test/Tk.Extensions.Tests/TestResults/test_results.trx | |
| reporter: dotnet-trx | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Code coverage results | |
| uses: 5monkeys/cobertura-action@master | |
| if: always() | |
| with: | |
| path: ${{ github.workspace }}/test/Tk.Extensions.Tests/TestResults/coverage.info | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| minimum_coverage: 90 | |
| fail_below_threshold: true | |
| show_line: true | |
| show_branch: true | |
| show_missing: true | |
| show_class_names: true | |
| link_missing_lines: true | |
| report_name: code coverage results | |
| codeql: | |
| uses: ./.github/workflows/codeql-analysis.yml | |
| stryker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v5 | |
| - name: Restore tools | |
| run: dotnet tool restore | |
| - name: Run build | |
| run: dotnet dotnet-stryker | |
| - name: Archive Stryker results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: stryker.results | |
| path: | | |
| ./StrykerOutput/**/reports/* | |
| benchmarks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v5 | |
| - name: Restore tools | |
| run: dotnet tool restore | |
| - name: Publish | |
| run: dotnet publish ./test/Tk.Extensions.Benchmarks/Tk.Extensions.Benchmarks.csproj -c Release -o ./publish/ | |
| - name: Run build | |
| run: dotnet "./publish/Tk.Extensions.Benchmarks.dll" -f "*" | |
| - name: Archive Benchmark results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: benchmarks.results | |
| path: | | |
| ./BenchmarkDotNet.Artifacts/**/results/*.html | |
| release-to-nuget: | |
| name: release to nuget | |
| runs-on: ubuntu-latest | |
| needs: [ tests, codeql, sca, stryker, benchmarks ] | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v5 | |
| - name: Restore tools | |
| run: dotnet tool restore | |
| - name: Restore solutiom | |
| run: dotnet restore | |
| - name: Set package version | |
| if: github.ref != 'refs/heads/main' | |
| run: | | |
| echo "package-version-number=${{ env.package-version-number }}-preview" >> $GITHUB_ENV | |
| - name: Package | |
| run: dotnet pack -c Release -o ./package/ -p:PackageVersion=${{ env.package-version-number }} | |
| - name: Push nuget package | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: dotnet nuget push "package/*.nupkg" --api-key ${{ secrets.NUGET_PAT }} --source "nuget.org" | |
| create-gh-release: | |
| name: create gh release | |
| runs-on: ubuntu-latest | |
| needs: [ release-to-nuget ] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: v${{ env.build-version-number }} | |
| generateReleaseNotes: true |