Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/TvdbClient-Nuget-Package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Publish Public Release on NuGet

on:
push:
paths: [ 'TvdbClient/**' ]
paths: [ 'src/**' ]
pull_request:
paths: [ 'TvdbClient/**' ]
paths: [ 'src/**' ]
workflow_dispatch:

env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/TvdbClient-Unit-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Code Coverage

on:
push:
paths: [ 'TvdbClient/**','TvdbClient.Tests/**' ]
paths: [ 'src/**','tests/**' ]
pull_request:
paths: [ 'TvdbClient/**','TvdbClient.Tests/**' ]
paths: [ 'src/**','tests/**' ]
workflow_dispatch:

env:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
run: dotnet build --no-restore

- name: Run tests with coverage
run: dotnet test ${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}.csproj --no-build --collect:"XPlat Code Coverage" #-p:CollectCoverage=true -p:CoverletOutputFormat=opencover
run: dotnet test --configuration Release -- --report-trx --results-directory '**/${{env.PROJECT_NAME}}/TestResults' --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" --settings "coverlet.runsettings" --no-build
continue-on-error: true

- name: Upload coverage report
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Code Coverage

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x' # Adjust to your .NET version

Copilot AI Jul 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .NET version comment indicates '8.x' but the project targets net9.0. Update the dotnet-version to '9.x' to match the project's target framework.

Suggested change
dotnet-version: '8.x' # Adjust to your .NET version
dotnet-version: '9.x' # Adjust to your .NET version

Copilot uses AI. Check for mistakes.

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Run TUNIT tests with coverage
run: |
dotnet test ./tests --no-build --configuration Release \
--collect:"XPlat Code Coverage" \
--results-directory ./test-results \
--logger "trx;LogFileName=TestResults.trx" \
--logger "console;verbosity=detailed"

- name: Install ReportGenerator
run: dotnet tool install -g dotnet-reportgenerator-globaltool

- name: Generate coverage report
run: |
reportgenerator \
-reports:"./test-results/**/coverage.cobertura.xml" \
-targetdir:"./coverage-report" \
-reporttypes:"Html;Cobertura;MarkdownSummaryGithub"

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
./test-results/**/*.trx
./coverage-report/**/*

- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results
path: './test-results/**/*.trx'
reporter: dotnet-trx

- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: ./coverage-report/Cobertura.xml
badge: true
fail_below_min: false # Set to true if you want to fail on low coverage
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '60 80' # Warning at 60%, error below 80%

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
142 changes: 142 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Release

on:
push:
branches: [ release, release/* ] # Trigger on release branch(es)
workflow_dispatch: # Allows manual trigger from any branch

jobs:
build-and-test:
runs-on: ubuntu-latest

outputs:
version: ${{ steps.nbgv.outputs.SemVer2 }}
simple-version: ${{ steps.nbgv.outputs.SimpleVersion }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for Nerdbank.GitVersioning

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x' # Adjust to your .NET version

Copilot AI Jul 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .NET version comment indicates '8.x' but the project targets net9.0. Update the dotnet-version to '9.x' to match the project's target framework.

Suggested change
dotnet-version: '8.x' # Adjust to your .NET version
dotnet-version: '9.x' # Adjust to your .NET version

Copilot uses AI. Check for mistakes.

- name: Install Nerdbank.GitVersioning
run: dotnet tool install -g nbgv

- name: Get Version from Nerdbank.GitVersioning
id: nbgv
run: |
nbgv cloud
echo "SemVer2=$(nbgv get-version -v SemVer2)" >> $GITHUB_OUTPUT
echo "SimpleVersion=$(nbgv get-version -v SimpleVersion)" >> $GITHUB_OUTPUT
echo "Version will be: $(nbgv get-version -v SemVer2)"

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Run TUNIT tests
run: dotnet test ./tests --no-build --configuration Release

- name: Pack NuGet packages
run: |
dotnet pack ./src --no-build --configuration Release \
--output ./packages

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./packages/*.nupkg

publish-nuget:
needs: build-and-test
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./packages

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

Copilot AI Jul 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .NET version should be '9.x' to match the project's target framework (net9.0).

Suggested change
dotnet-version: '8.x'
dotnet-version: '9.x'

Copilot uses AI. Check for mistakes.

- name: Publish to NuGet
run: |
dotnet nuget push "./packages/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate

github-release:
needs: [build-and-test, publish-nuget]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./packages

- name: Create source archive
run: |
# Create a clean source archive excluding build artifacts
git archive --format=zip --output=./packages/source-v${{ needs.build-and-test.outputs.simple-version }}.zip HEAD
git archive --format=tar.gz --output=./packages/source-v${{ needs.build-and-test.outputs.simple-version }}.tar.gz HEAD

- name: Generate Release Notes
id: release_notes
run: |
# Generate basic release notes from commits since last release tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "")

echo "## What's Changed" > release_notes.md
if [ -n "$PREVIOUS_TAG" ]; then
echo "" >> release_notes.md
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD >> release_notes.md
else
echo "- Initial release" >> release_notes.md
fi

echo "" >> release_notes.md
echo "## NuGet Package" >> release_notes.md
echo "This release is available on NuGet:" >> release_notes.md
echo '```' >> release_notes.md
echo "dotnet add package YourPackageName --version ${{ needs.build-and-test.outputs.version }}" >> release_notes.md

Copilot AI Jul 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placeholder 'YourPackageName' should be replaced with the actual package name 'TvdbClient' based on the project structure.

Suggested change
echo "dotnet add package YourPackageName --version ${{ needs.build-and-test.outputs.version }}" >> release_notes.md
echo "dotnet add package TvdbClient --version ${{ needs.build-and-test.outputs.version }}" >> release_notes.md

Copilot uses AI. Check for mistakes.
echo '```' >> release_notes.md

- name: Create Git Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ needs.build-and-test.outputs.simple-version }}" -m "Release v${{ needs.build-and-test.outputs.simple-version }}"
git push origin "v${{ needs.build-and-test.outputs.simple-version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.build-and-test.outputs.simple-version }}
name: Release v${{ needs.build-and-test.outputs.simple-version }}
body_path: release_notes.md
files: |
./packages/*.nupkg
./packages/*.zip
./packages/*.tar.gz
draft: false
prerelease: ${{ contains(needs.build-and-test.outputs.version, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 10 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyGroup Label="Project Properties">
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Tvdb</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Versioning">
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.7.115</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Label="Variables">
<CurrentYear>$([System.DateTime]::Now.ToString("yyyy"))</CurrentYear>
</PropertyGroup>
</Project>
18 changes: 16 additions & 2 deletions TvdbApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35617.110
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "src\TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "tests\TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -18,6 +18,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
version.json = version.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1570EA31-904E-4036-89EE-890A8358C7AA}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7849F1D9-4557-41C5-A747-241B92631187}"
ProjectSection(SolutionItems) = preProject
tests\Directory.Build.props = tests\Directory.Build.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,6 +46,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{02CB1507-5FF6-9962-1A70-EC35D9E298ED} = {1570EA31-904E-4036-89EE-890A8358C7AA}
{E72AACA8-0A10-E62A-E526-41B75B6E6348} = {7849F1D9-4557-41C5-A747-241B92631187}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EBB4E090-0583-48B6-AEC2-1AB4E3B98D2A}
EndGlobalSection
Expand Down
71 changes: 0 additions & 71 deletions TvdbClient.Tests/Converters/DateOnlyConverterTests.cs

This file was deleted.

Loading
Loading