File tree Expand file tree Collapse file tree 2 files changed +77
-6
lines changed Expand file tree Collapse file tree 2 files changed +77
-6
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+
9+ jobs :
10+ build-test :
11+ runs-on : windows-latest
12+ env :
13+ DOTNET_NOLOGO : true
14+ DOTNET_CLI_TELEMETRY_OPTOUT : 1
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v4
18+
19+ - name : Setup .NET
20+ uses : actions/setup-dotnet@v4
21+ with :
22+ dotnet-version : |
23+ 8.0.x
24+
25+ - name : Restore dependencies
26+ run : dotnet restore
27+
28+ - name : Cache NuGet packages
29+ uses : actions/cache@v4
30+ with :
31+ path : ~/.nuget/packages
32+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
33+ restore-keys : |
34+ ${{ runner.os }}-nuget-
35+
36+ - name : Build
37+ run : dotnet build --configuration Release --no-restore
38+
39+ - name : Run tests with coverage
40+ run : dotnet test --configuration Release --no-build --collect "XPlat Code Coverage" --results-directory TestResults
41+
42+ - name : Convert coverage to lcov
43+ run : |
44+ dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.*
45+ reportgenerator -reports:TestResults/**/coverage.cobertura.xml -targetdir:coverage -reporttypes:lcov
46+ env :
47+ PATH : $env:PATH:~/.dotnet/tools
48+
49+ - name : Upload coverage artifact
50+ uses : actions/upload-artifact@v4
51+ with :
52+ name : coverage-report
53+ path : coverage
54+
55+ - name : Upload test results
56+ uses : actions/upload-artifact@v4
57+ with :
58+ name : test-results
59+ path : TestResults
60+
61+ lint-readme :
62+ runs-on : ubuntu-latest
63+ steps :
64+ - name : Checkout
65+ uses : actions/checkout@v4
66+ - name : Markdown lint
67+ uses : avto-dev/markdown-lint@v1
68+ with :
69+ args : README.md
Original file line number Diff line number Diff line change @@ -323,15 +323,17 @@ Do not commit real credentials. Connection string is externalized. Recommended i
323323
324324## 🤖 CI/CD (Suggested)
325325
326- Add a GitHub Actions workflow ` .github/workflows/ci.yml ` :
326+ Workflow defined in ` .github/workflows/ci.yml ` executes on pushes and PRs to ` main ` or ` master ` :
327327
328- - Restore -> Build (Release) -> Test -> (Optional) Publish test & coverage results
329- - Fail build on test failures
328+ - Restore -> Build (Release) -> Test (with coverage collection)
329+ - Publishes test results & coverage (Cobertura + lcov) as artifacts
330+ - Separate job lints ` README.md ` using markdown-lint
330331
331- Optional steps :
332+ You can extend by :
332333
333- - Cache NuGet (` actions/cache ` )
334- - Upload coverage to Codecov
334+ - Adding Codecov upload (needs CODECOV_TOKEN secret)
335+ - Enabling dependabot for NuGet & GitHub Actions
336+ - Adding security scanning (CodeQL workflow)
335337
336338## 🗺️ Roadmap (Ideas)
337339
You can’t perform that action at this time.
0 commit comments