Skip to content

Merge pull request #70 from melodee-project/sph-2026-05-01.03 #61

Merge pull request #70 from melodee-project/sph-2026-05-01.03

Merge pull request #70 from melodee-project/sph-2026-05-01.03 #61

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.104
- name: Restore dependencies
run: dotnet restore
- name: Validate localization resources
run: bash scripts/validate-resources.sh
- name: Validate OpenSubsonic compatibility matrix
run: |
if [ ! -f "docs/pages/opensubsonic-matrix.md" ]; then
echo "ERROR: docs/pages/opensubsonic-matrix.md not found!"
exit 1
fi
if ! grep -q "OpenSubsonic Compatibility Matrix" docs/pages/opensubsonic-matrix.md; then
echo "ERROR: opensubsonic-matrix.md is missing title!"
exit 1
fi
if ! grep -q "Last updated" docs/pages/opensubsonic-matrix.md; then
echo "ERROR: opensubsonic-matrix.md is missing last updated date!"
exit 1
fi
echo "OpenSubsonic compatibility matrix validated successfully"
- name: Validate matrix link in README
run: |
if ! grep -q "opensubsonic-matrix" README.md; then
echo "ERROR: README.md is missing link to opensubsonic-matrix.md!"
exit 1
fi
echo "README.md link validated successfully"
- name: Build
run: dotnet build --no-restore
- name: Check Code Formatting
run: |
echo "Checking code formatting with dotnet format..."
dotnet format --verify-no-changes --no-restore --verbosity quiet
continue-on-error: false
- name: Check Code Analyzers (Non-destructive)
run: |
echo "Running code analyzer checks..."
dotnet build --no-restore -c Release /p:EnforceCodeStyleInBuild=true /p:TreatWarningsAsErrors=false
continue-on-error: false
- name: Test with coverage
env:
ConnectionStrings__DefaultConnection: "Host=localhost;Database=melodee_test;Username=test;Password=test"
ConnectionStrings__ArtistSearchEngineConnection: "Data Source=:memory:"
ConnectionStrings__MusicBrainzConnection: "Data Source=:memory:"
Jwt__Key: "testkeytestkeytestkeytestkeytestkeytestkeytestkeytestkey"
Jwt__Issuer: "test"
Jwt__Audience: "test"
security__secretKey: "testsecretkeytestsecretkeytestsecretkey"
QuartzDisabled: "true"
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings coverage.runsettings --results-directory coverage/results
- name: Generate coverage report
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:"coverage/results/**/coverage.cobertura.xml" -targetdir:"coverage/report" -reporttypes:"Html;TextSummary" -assemblyfilters:"+Melodee.*;+server;+mcli;-Melodee.Tests.*"
echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
cat coverage/report/Summary.txt >> $GITHUB_STEP_SUMMARY
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/report/
retention-days: 30