Skip to content

Commit 12027d7

Browse files
author
Stephen Shaw
committed
Stuff
1 parent da41dc3 commit 12027d7

File tree

15 files changed

+2250
-20
lines changed

15 files changed

+2250
-20
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: Modernization Task
3+
about: Track progress on codebase modernization efforts
4+
title: '[MODERNIZATION] '
5+
labels: ['modernization', 'enhancement']
6+
assignees: ''
7+
---
8+
9+
## Modernization Area
10+
<!-- Select the primary area this task addresses -->
11+
- [ ] Framework/Language Upgrade
12+
- [ ] Performance Improvement
13+
- [ ] Architecture/Design
14+
- [ ] Testing/Quality
15+
- [ ] DevOps/Tooling
16+
- [ ] Documentation
17+
- [ ] Security/Reliability
18+
19+
## Task Description
20+
<!-- Detailed description of what needs to be done -->
21+
22+
## Acceptance Criteria
23+
<!-- Specific, measurable criteria for completion -->
24+
- [ ]
25+
- [ ]
26+
- [ ]
27+
28+
## Implementation Phase
29+
<!-- Which phase of the modernization roadmap -->
30+
- [ ] Phase 1: Foundation
31+
- [ ] Phase 2: Core Modernization
32+
- [ ] Phase 3: Advanced Features
33+
- [ ] Phase 4: Polish & Release
34+
35+
## Priority
36+
- [ ] High
37+
- [ ] Medium
38+
- [ ] Low
39+
40+
## Estimated Effort
41+
- [ ] Small (< 1 day)
42+
- [ ] Medium (1-3 days)
43+
- [ ] Large (> 3 days)
44+
45+
## Dependencies
46+
<!-- List any tasks that must be completed first -->
47+
48+
## Additional Context
49+
<!-- Any other relevant information -->

.github/workflows/build-and-test.yml

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
env:
10+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
11+
DOTNET_NOLOGO: true
12+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
13+
14+
jobs:
15+
build-and-test:
16+
name: Build and Test (${{ matrix.os }}, ${{ matrix.framework }})
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, windows-latest, macos-latest]
23+
framework: [net8.0, net9.0]
24+
include:
25+
- os: windows-latest
26+
framework: net462
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: |
38+
8.0.x
39+
9.0.x
40+
41+
- name: Restore dependencies
42+
run: dotnet restore
43+
44+
- name: Build
45+
run: dotnet build --no-restore --configuration Release
46+
47+
- name: Test with Coverage
48+
run: |
49+
dotnet test --no-build --configuration Release \
50+
--verbosity normal \
51+
--collect:"XPlat Code Coverage" \
52+
--results-directory ./coverage \
53+
--logger trx \
54+
--logger "console;verbosity=detailed" \
55+
--settings tests/TaglibSharp.Tests/MSTest.runsettings \
56+
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
57+
58+
- name: Install ReportGenerator
59+
if: matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0'
60+
run: dotnet tool install -g dotnet-reportgenerator-globaltool
61+
62+
- name: Generate Coverage Report
63+
if: matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0'
64+
run: |
65+
reportgenerator \
66+
-reports:"coverage/**/coverage.opencover.xml" \
67+
-targetdir:"coverage/report" \
68+
-reporttypes:"Html;TextSummary;Badges;Cobertura;JsonSummary" \
69+
-verbosity:Info \
70+
-classfilters:"-*.Tests*;-*.Benchmarks*" \
71+
-filefilters:"-**/bin/**;-**/obj/**"
72+
73+
- name: Coverage Summary
74+
if: matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0'
75+
run: |
76+
echo "📊 Coverage Summary:"
77+
cat coverage/report/Summary.txt
78+
echo ""
79+
80+
# Extract coverage percentage for status check
81+
if [ -f "coverage/report/Summary.json" ]; then
82+
echo "📈 Detailed Coverage Metrics:"
83+
cat coverage/report/Summary.json | jq '.summary'
84+
fi
85+
86+
- name: Coverage Threshold Check
87+
if: matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0'
88+
run: |
89+
# Run the coverage validation tests
90+
dotnet test --no-build --configuration Release \
91+
--filter "TestCategory=Coverage" \
92+
--logger "console;verbosity=detailed"
93+
94+
- name: Upload coverage reports to Codecov
95+
if: matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0'
96+
uses: codecov/codecov-action@v4
97+
with:
98+
directory: ./coverage
99+
files: ./coverage/report/Cobertura.xml
100+
fail_ci_if_error: true
101+
token: ${{ secrets.CODECOV_TOKEN }}
102+
flags: unittests
103+
name: taglib-sharp-coverage
104+
105+
- name: Upload Coverage Artifacts
106+
if: matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0'
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: coverage-report
110+
path: coverage/report/
111+
112+
- name: Test Result Analysis
113+
if: always()
114+
run: |
115+
echo "📋 Test Results Summary:"
116+
find ./coverage -name "*.trx" -exec echo "Processing {}" \;
117+
118+
# Count test results
119+
if [ -d "./coverage" ]; then
120+
echo "✅ Test artifacts generated successfully"
121+
find ./coverage -name "*.xml" -o -name "*.trx" | wc -l | xargs echo "Coverage files found:"
122+
fi
123+
124+
quality-gates:
125+
name: Quality Gates
126+
runs-on: ubuntu-latest
127+
needs: build-and-test
128+
129+
steps:
130+
- name: Checkout
131+
uses: actions/checkout@v4
132+
133+
- name: Setup .NET
134+
uses: actions/setup-dotnet@v4
135+
with:
136+
dotnet-version: |
137+
8.0.x
138+
9.0.x
139+
140+
- name: Download Coverage Report
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: coverage-report
144+
path: ./coverage-report
145+
146+
- name: Quality Gate - Coverage Threshold
147+
run: |
148+
if [ -f "./coverage-report/Summary.txt" ]; then
149+
echo "📊 Coverage Summary:"
150+
cat ./coverage-report/Summary.txt
151+
152+
# Extract line coverage percentage using more robust regex
153+
COVERAGE=$(grep -oP 'Line coverage:\s*\K[\d.]+' ./coverage-report/Summary.txt || echo "0")
154+
echo "📈 Line Coverage: ${COVERAGE}%"
155+
156+
# Extract branch coverage if available
157+
BRANCH_COVERAGE=$(grep -oP 'Branch coverage:\s*\K[\d.]+' ./coverage-report/Summary.txt || echo "0")
158+
echo "🌿 Branch Coverage: ${BRANCH_COVERAGE}%"
159+
160+
# Set thresholds
161+
LINE_THRESHOLD=80
162+
BRANCH_THRESHOLD=70
163+
164+
# Validate coverage thresholds
165+
if (( $(echo "$COVERAGE >= $LINE_THRESHOLD" | bc -l) )); then
166+
echo "✅ Line coverage ${COVERAGE}% meets ${LINE_THRESHOLD}% threshold"
167+
else
168+
echo "❌ Line coverage ${COVERAGE}% is below ${LINE_THRESHOLD}% threshold"
169+
exit 1
170+
fi
171+
172+
if (( $(echo "$BRANCH_COVERAGE >= $BRANCH_THRESHOLD" | bc -l) )); then
173+
echo "✅ Branch coverage ${BRANCH_COVERAGE}% meets ${BRANCH_THRESHOLD}% threshold"
174+
else
175+
echo "⚠️ Branch coverage ${BRANCH_COVERAGE}% is below ${BRANCH_THRESHOLD}% threshold (warning only)"
176+
fi
177+
else
178+
echo "❌ Coverage report not found"
179+
exit 1
180+
fi
181+
182+
- name: Generate Coverage Badge
183+
run: |
184+
if [ -f "./coverage-report/Summary.json" ]; then
185+
echo "🏷️ Coverage badge data available"
186+
# This could be used to update a coverage badge
187+
fi
188+
189+
package:
190+
name: Package
191+
runs-on: ubuntu-latest
192+
needs: [build-and-test, quality-gates]
193+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
194+
195+
steps:
196+
- name: Checkout
197+
uses: actions/checkout@v4
198+
with:
199+
fetch-depth: 0
200+
201+
- name: Setup .NET
202+
uses: actions/setup-dotnet@v4
203+
with:
204+
dotnet-version: |
205+
8.0.x
206+
9.0.x
207+
208+
- name: Restore dependencies
209+
run: dotnet restore
210+
211+
- name: Pack
212+
run: dotnet pack --configuration Release --no-restore --output ./packages
213+
214+
- name: Upload packages
215+
uses: actions/upload-artifact@v4
216+
with:
217+
name: nuget-packages
218+
path: ./packages/*.nupkg

.github/workflows/codeql.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,35 @@ jobs:
5959
- name: Checkout repository
6060
uses: actions/checkout@v4
6161

62-
# Add any setup steps before running the `github/codeql-action/init` action.
63-
# This includes steps like installing compilers or runtimes (`actions/setup-node`
64-
# or others). This is typically only required for manual builds.
65-
# - name: Setup runtime (example)
66-
# uses: actions/setup-example@v1
62+
# Setup .NET for C# analysis
63+
- name: Setup .NET
64+
if: matrix.language == 'csharp'
65+
uses: actions/setup-dotnet@v4
66+
with:
67+
dotnet-version: |
68+
8.0.x
69+
9.0.x
6770
6871
# Initializes the CodeQL tools for scanning.
6972
- name: Initialize CodeQL
7073
uses: github/codeql-action/init@v3
7174
with:
7275
languages: ${{ matrix.language }}
7376
build-mode: ${{ matrix.build-mode }}
74-
# If you wish to specify custom queries, you can do so here or in a config file.
75-
# By default, queries listed here will override any specified in a config file.
76-
# Prefix the list here with "+" to use these queries and those in the config file.
77-
78-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
79-
# queries: security-extended,security-and-quality
77+
# Enhanced security queries for better coverage
78+
queries: security-extended,security-and-quality
8079

81-
# If the analyze step fails for one of the languages you are analyzing with
82-
# "We were unable to automatically build your code", modify the matrix above
83-
# to set the build mode to "manual" for that language. Then modify this step
84-
# to build your code.
85-
# ℹ️ Command-line programs to run using the OS shell.
86-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
87-
- if: matrix.build-mode == 'manual'
88-
shell: bash
80+
# Build step for C# if using manual build mode
81+
- if: matrix.language == 'csharp' && matrix.build-mode == 'manual'
82+
name: Build C# project
8983
run: |
90-
echo 'If you are using a "manual" build mode for one or more of the' \
84+
dotnet restore
85+
dotnet build --configuration Release --no-restore
86+
87+
- name: Perform CodeQL Analysis
88+
uses: github/codeql-action/analyze@v3
89+
with:
90+
category: "/language:${{matrix.language}}"
9191
'languages you are analyzing, replace this with the commands to build' \
9292
'your code, for example:'
9393
echo ' make bootstrap'

.github/workflows/performance.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Performance Benchmarks
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
benchmark:
12+
name: Run Benchmarks
13+
runs-on: ubuntu-latest
14+
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+
9.0.x
25+
26+
- name: Restore dependencies
27+
run: dotnet restore
28+
29+
- name: Build benchmarks
30+
run: dotnet build --configuration Release --no-restore
31+
32+
- name: Run benchmarks
33+
run: dotnet run --project benchmarks --configuration Release -- --exporters json
34+
35+
- name: Upload benchmark results
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: benchmark-results
39+
path: BenchmarkDotNet.Artifacts/results/*

0 commit comments

Comments
 (0)