Finally changing the namespace (#35) #81
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: .NET Core | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- develop | |
workflow_dispatch: | |
jobs: | |
build: | |
name: π¨ Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v4 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
# - name: Install DocFX | |
# if: github.ref == 'refs/heads/develop' | |
# run: choco install docfx -y | |
- name: π¨ Build | |
run: | | |
dotnet build src/Unobtanium.Web.Proxy/Unobtanium.Web.Proxy.csproj --configuration Release | |
dotnet build tests/Unobtanium.Web.Proxy.UnitTests/Unobtanium.Web.Proxy.UnitTests.csproj --configuration Release | |
dotnet build tests/Unobtanium.Web.Proxy.IntegrationTests/Unobtanium.Web.Proxy.IntegrationTests.csproj --property WarningLevel=0 | |
- name: π§ͺ Test | |
id: test | |
shell: pwsh | |
run: | | |
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '## π§ͺ Unit Tests' | |
$outputDir = "${{github.workspace}}/coverage" | |
./tests/run-tests.ps1 | |
- name: π Code Coverage report | |
if: success() || steps.test.conclusion == 'failure' | |
shell: pwsh | |
run: | | |
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.* | |
reportgenerator -reports:${{github.workspace}}/coverage.cobertura.xml -targetdir:${{github.workspace}}/report -reporttypes:MarkdownSummaryGithub -filefilters:-*.g.cs "-classfilters:-Unobtanium.Web.Proxy.Network.WinAuth.*" -verbosity:Warning | |
$report = Get-Content ${{github.workspace}}/report/SummaryGithub.md -Raw | |
$report = $report.Replace('# Summary', '## π Code Coverage').Replace('## Coverage', '### π Code Coverage details') | |
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $report | |
env: | |
REPORTGENERATOR_LICENSE: ${{ secrets.REPORTGENERATOR_LICENSE }} | |
- name: π¦ Upload Code Coverage report | |
if: success() || steps.test.conclusion == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: ${{github.workspace}}\report | |
if-no-files-found: ignore | |
retention-days: 5 | |
# - name: Update Documentation | |
# if: github.ref == 'refs/heads/develop' | |
# run: docfx .github/docfx.json | |
# - name: Publish Documentation | |
# if: github.ref == 'refs/heads/develop' | |
# uses: EndBug/add-and-commit@v9 | |
# with: | |
# default_author: github_actions | |
# message: Update documentation | |
# committer_name: GitHub Actions | |
# committer_email: actions@github.com | |
publish: | |
name: π Publish | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v4 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
- name: π¦ Package | |
shell: pwsh | |
run: | | |
dotnet pack src/Unobtanium.Web.Proxy/Unobtanium.Web.Proxy.csproj --configuration Release -p:Version=$("${{ github.ref_name }}".Substring(1)) | |
- name: π Publish | |
run: | | |
dotnet nuget push **\*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_AUTH_TOKEN | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
- name: π Publish summary | |
shell: pwsh | |
run: | | |
$version = $("${{ github.ref_name }}".Substring(1)); | |
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '## π Published' | |
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "- Code [tag ${{ github.ref_name }}](https://github.com/svrooij/unobtanium-web-proxy/tree/${{ github.ref_name }}) has been published to NuGet." | |
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "- Nuget [$version](https://www.nuget.org/packages/Unobtanium.Web.Proxy/$version) has been published to NuGet." | |