Add workflow to test release packages #213
Workflow file for this run
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 | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
checks: write | |
packages: read | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
source-url: https://nuget.pkg.github.com/prplecake/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test | |
run: dotnet test --verbosity normal --logger "trx" --results-directory "./TestResults" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[BunnyDDNS.*.Tests?]*" | |
- uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: .NET Test Results | |
path: TestResults/*.trx | |
reporter: dotnet-trx | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
publish: | |
strategy: | |
matrix: | |
rid: [ | |
linux-x64, linux-arm64, | |
win-x64, osx-x64, | |
] | |
permissions: | |
contents: write | |
packages: read | |
checks: write | |
runs-on: ubuntu-latest | |
name: publish-${{matrix.rid}} | |
if: github.event_name == 'release' | |
needs: run-tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
source-url: https://nuget.pkg.github.com/prplecake/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish CLI (${{matrix.rid}}) | |
run: | | |
dotnet publish src/BunnyDDNS.CLI/BunnyDDNS.CLI.csproj -c Release -r ${{matrix.rid}} --self-contained -p:PublishSingleFile=true -p:PublishReadyToRun=true | |
zip -j ddns-bunny.net-${{ github.ref_name }}-${{matrix.rid}}.zip src/BunnyDDNS.CLI/bin/Release/net8.0/${{matrix.rid}}/publish/* README.md LICENSE | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ddns-bunny.net-*.zip |