Skip to content

Finally changing the namespace (#35) #81

Finally changing the namespace (#35)

Finally changing the namespace (#35) #81

Workflow file for this run

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."