Reference BeatyBit.Bits nuget #272
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 & Test | |
| on: | |
| workflow_dispatch: | |
| # inputs: | |
| # prerelease_tag: | |
| # description: 'Prerelease tag' | |
| # required: false | |
| # default: '' | |
| # publish_artifacts: | |
| # description: 'Publish artifacts' | |
| # required: true | |
| # default: 'false' | |
| # type: choice | |
| # options: | |
| # - 'true' | |
| # - 'false' | |
| push: | |
| branches: | |
| - main | |
| - 'feature/**' | |
| - 'release/**' | |
| - 'hotfix/**' | |
| env: | |
| configuration: Release | |
| artifacts-dir: artifacts | |
| nugets-dir: artifacts/nupkgs | |
| pdb-dir: artifacts/pdb | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4.1.1 | |
| with: | |
| fetch-depth: 0 | |
| - | |
| name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.104 | |
| - | |
| name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v3.1.11 | |
| with: | |
| versionSpec: '6.0.x' | |
| - | |
| name: Use GitVersion | |
| id: gitversion # step id used as reference for output values | |
| uses: gittools/actions/gitversion/execute@v3.1.11 | |
| # Build | |
| - | |
| name: Build | |
| run: > | |
| dotnet build | |
| -c ${{env.configuration}} | |
| -p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }} | |
| -p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} | |
| -p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} | |
| # Run tests | |
| - | |
| name: Test | |
| run: dotnet test --no-build -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover | |
| # Create and place nuget packages into env.nugets-dir directory | |
| - | |
| name: Pack | |
| run: dotnet pack --no-build -o:${{ env.nugets-dir }} -p:PackageVersion=${{ steps.gitversion.outputs.semVer }} | |
| - | |
| name: Store Version | |
| uses: jsdaniell/create-json@v1.2.3 | |
| with: | |
| name: version.json | |
| json: | | |
| { | |
| "assembly-version": "${{ steps.gitversion.outputs.assemblySemVer }}", | |
| "assembly-file-version": "${{ steps.gitversion.outputs.assemblySemFileVer }}", | |
| "nuget-version": "${{ steps.gitversion.outputs.semVer }}" | |
| } | |
| dir: ${{ env.artifacts-dir }} | |
| - | |
| name: Store PDB | |
| run: | | |
| robocopy .out\bin\netstandard2.1\ ${{ env.pdb-dir }} *.pdb | |
| if ($lastexitcode -lt 8) { $global:lastexitcode = 0 } | |
| - | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Artifacts | |
| path: ${{ env.artifacts-dir }}/ | |
| retention-days: 3 | |
| - name: Create Test Coverage Badge | |
| uses: simon-k/dotnet-code-coverage-badge@v1.0.0 | |
| id: create_coverage_badge | |
| with: | |
| label: Unit Test Coverage | |
| color: brightgreen | |
| path: test\Test\TestResults\coverage.net9.0.opencover.xml | |
| gist-filename: armature-test-coverage.json | |
| gist-id: ad5636de8f9cf631d90e2e85d2f3019c | |
| gist-auth-token: ${{ secrets.GIST_KEY }} | |
| - name: Print code coverage | |
| run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%" | |
| - name: Print code coverage badge data | |
| run: echo "Badge data ${{steps.test_step.outputs.badge}}" |