Skip to content

tool update

tool update #94

Workflow file for this run

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@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "${{ env.dotnet_version }}"
- name: SCA checks
run: |
dotnet tool restore
dotnet run --project ./build/build.fsproj -t "SCA"
style-checks:
name: Style Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "${{ env.dotnet_version }}"
- name: Style checks
run: |
dotnet tool restore
dotnet run --project ./build/build.fsproj -t "Check Style Rules"
tests:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "${{ env.dotnet_version }}"
- name: Run tests
run: |
dotnet tool restore
dotnet run --project ./build/build.fsproj -t "Tests"
- name: Archive Test results
uses: actions/upload-artifact@v3
with:
name: tests.results
path: |
./tests/**/TestResults/*
- name: Archive Code coverage
uses: actions/upload-artifact@v3
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@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "${{ env.dotnet_version }}"
- name: Build
run: |
dotnet tool restore
dotnet run --project ./build/build.fsproj -t "Build"
- name: Archive tool nupkg
uses: actions/upload-artifact@v3
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@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "${{ env.dotnet_version }}"
- name: Download package
uses: actions/download-artifact@v3
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@v3
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ env.build-version-number }}
prerelease: false
generateReleaseNotes: true