bump SCA version (#17) #125
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 & Release | |
on: | |
push: | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
build-version-number: 0.1.${{ github.run_number }} | |
dotnet_version: 8.x | |
jobs: | |
sca: | |
name: SCA | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run SCA | |
uses: tonycknight/pkgchk-action@v1.0.16 | |
with: | |
trace: true | |
style-checks: | |
name: Style Checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "${{ env.dotnet_version }}" | |
- name: Style checks | |
run: | | |
dotnet tool restore | |
dotnet fantomas --recurse --check ./src/ ./tests/ | |
tests: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "${{ env.dotnet_version }}" | |
- name: Run tests | |
run: | | |
dotnet tool restore | |
dotnet restore | |
dotnet test -c Debug --filter OS!=Windows --logger "trx;LogFileName=test_results.trx" /p:CollectCoverage=true /p:CoverletOutput=./TestResults/coverage.info /p:CoverletOutputFormat=cobertura | |
- name: Consolidate code coverage | |
run: | | |
dotnet reportgenerator -reports:./tests/**/coverage.info -targetdir:./publish/codecoverage -reporttypes:Html | |
- name: Archive Test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests.results | |
path: | | |
./tests/**/TestResults/* | |
- name: Archive Code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codecoverage | |
path: ./publish/codecoverage/*.* | |
- name: Unit test results | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: unit test results | |
path: ${{ github.workspace }}/tests/kvps.tests/TestResults/test_results.trx | |
reporter: dotnet-trx | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Code coverage results | |
uses: 5monkeys/cobertura-action@master | |
with: | |
path: ${{ github.workspace }}/tests/kvps.tests/TestResults/coverage.info | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
minimum_coverage: 1 | |
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 | |
build: | |
name: Build and Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "${{ env.dotnet_version }}" | |
- name: Set Build version | |
if: github.ref != 'refs/heads/main' | |
run: | | |
echo "build-version-number=${{ env.build-version-number }}-preview" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
dotnet tool restore | |
dotnet restore | |
dotnet pack ./src/kvps/kvps.fsproj -c Release -o ./package /p:PackageVersion=${{ env.build-version-number }} /p:Version=${{ env.build-version-number }} /p:AssemblyInformationalVersion=${{ env.build-version-number }} | |
- name: Archive tool nupkg | |
uses: actions/upload-artifact@v4 | |
with: | |
name: kvps-cli.nupkg | |
path: ./package/kvps*.nupkg | |
nuget-release: | |
name: Nuget release | |
runs-on: ubuntu-latest | |
needs: [ sca, build, style-checks, tests ] | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "${{ env.dotnet_version }}" | |
- name: Download package | |
uses: actions/download-artifact@v4 | |
with: | |
name: kvps-cli.nupkg | |
path: ${{ github.workspace }}/artifacts | |
- name: Push nuget package | |
run: dotnet nuget push "artifacts/*.nupkg" --api-key ${{ secrets.NUGET_PAT }} --source "nuget.org" | |
gh-release: | |
name: GH release | |
runs-on: ubuntu-latest | |
needs: [ nuget-release ] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ env.build-version-number }} | |
prerelease: false | |
generateReleaseNotes: true |