-
-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (83 loc) · 3.57 KB
/
Copy pathdotnet.yml
File metadata and controls
92 lines (83 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
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"
# Parallel solution-level VSTest with coverage can return a non-zero exit after successful test summaries.
run: dotnet test --no-build -m:1 --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"
cat coverage/report/Summary.txt
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-report
path: coverage/report/
retention-days: 30