Skip to content

feat(doc): README

feat(doc): README #82

Workflow file for this run

name: 🚀 Build & Pack
on:
push:
branches:
- "main"
- "develop"
- "feature/*"
- "bug/*"
- "hotfix/*"
pull_request:
branches:
- "main"
- "develop"
types: [opened, synchronize, reopened, closed]
workflow_dispatch:
inputs:
build_config:
description: "Build configuration"
required: true
default: "Release"
type: choice
options:
- Release
- Debug
run_tests:
description: "Run tests"
required: true
default: true
type: boolean
pack_nuget:
description: "Create NuGet packages"
required: true
default: true
type: boolean
env:
DOTNET_VERSION: "8.0.x"
BUILD_CONFIG: ${{ github.event.inputs.build_config || 'Release' }}
RUN_TESTS: ${{ github.event.inputs.run_tests || 'true' }}
PACK_NUGET: ${{ github.event.inputs.pack_nuget || 'true' }}
jobs:
# Build QRCoder.Core
build-qrcoder:
name: Build QRCoder.Core (.NET 8)
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 🗄️ Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 📦 Cache NuGet Packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: 🔧 Restore Dependencies
run: |
echo "Restoring NuGet packages for QRCoder.Core.sln"
dotnet restore QRCoder.Core.sln --no-cache --force --verbosity normal
- name: 🏗️ Build Solution
run: |
echo "Building QRCoder.Core.sln with configuration: ${{ env.BUILD_CONFIG }}"
dotnet build QRCoder.Core.sln \
--no-restore \
--configuration ${{ env.BUILD_CONFIG }} \
--verbosity minimal \
/p:ContinuousIntegrationBuild=true
- name: 🧪 Run Tests
if: ${{ github.event.inputs.run_tests != 'false' }}
run: |
echo "Running tests for QRCoder.Core.Tests"
dotnet test QRCoder.Core.Tests/ \
--configuration ${{ env.BUILD_CONFIG }} \
--logger "trx;LogFileName=test-results.trx" \
--results-directory TestResults \
--collect:"XPlat Code Coverage" \
--verbosity normal \
--no-build
- name: 📤 Upload Test Results
uses: actions/upload-artifact@v4
if: ${{ always() && github.event.inputs.run_tests != 'false' }}
with:
name: test-results-qrcoder
path: |
TestResults/**/*.trx
TestResults/**/*.coverage
retention-days: 7
- name: 📤 Upload Coverage Reports
uses: actions/upload-artifact@v4
if: ${{ always() && github.event.inputs.run_tests != 'false' }}
with:
name: coverage-qrcoder
path: TestResults/**/coverage.*
retention-days: 7
# Build for Multiple Target Frameworks
build-frameworks:
name: Build Target Frameworks
runs-on: ubuntu-latest
needs: build-qrcoder
strategy:
matrix:
framework: [netstandard2.1, net8.0, net48]
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
- name: 🗄️ Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 🔧 Restore Dependencies
run: dotnet restore QRCoder.Core/QRCoder.Core.csproj
- name: 🏗️ Build Framework
run: |
echo "Building QRCoder.Core for ${{ matrix.framework }}"
dotnet build QRCoder.Core/QRCoder.Core.csproj \
--framework ${{ matrix.framework }} \
--configuration ${{ env.BUILD_CONFIG }} \
--no-restore \
--verbosity minimal
# Security & Quality Checks
security:
name: 🔒 Security & Quality
runs-on: ubuntu-latest
needs: [build-qrcoder]
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
- name: 🔍 Security Scan (QRCoder.Core)
run: |
echo "🔒 Running security scan on QRCoder.Core"
dotnet list package --vulnerable --include-prerelease
- name: 📊 Code Quality Analysis
run: |
echo "📊 Analyzing code quality"
echo "✅ Security and quality checks completed"
# Pack NuGet Packages
pack-nuget:
name: 📦 Pack NuGet Packages
runs-on: ubuntu-latest
needs: [build-qrcoder, security]
if: ${{ github.event.inputs.pack_nuget != 'false' }}
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
- name: 🗄️ Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 🔧 Restore Dependencies
run: dotnet restore QRCoder.Core.sln
- name: 📦 Pack NuGet Packages
run: |
echo "Creating NuGet packages for QRCoder.Core"
dotnet pack QRCoder.Core.sln \
--configuration ${{ env.BUILD_CONFIG }} \
--output ./packages \
--no-build \
/p:ContinuousIntegrationBuild=true \
/p:PackageVersion=${{ github.ref_type == 'tag' && github.ref_name || '1.0.5-ci' }}
- name: 📤 Upload Package Artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages-qrcoder
path: ./packages/*.nupkg
retention-days: 30
- name: 📤 Upload Symbol Packages
uses: actions/upload-artifact@v4
with:
name: nuget-symbols-qrcoder
path: ./packages/*.snupkg
retention-days: 30
# Coverage Reports
coverage-reports:
name: 📊 Coverage Reports
runs-on: ubuntu-latest
needs: [build-qrcoder]
if: ${{ always() && github.event.inputs.run_tests != 'false' }}
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
- name: 🗄️ Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 🔧 Restore dependencies
run: dotnet restore QRCoder.Core.sln --ignore-failed-sources
- name: 📦 Install ReportGenerator
run: dotnet tool install -g dotnet-reportgenerator-globaltool
- name: 🔧 Restore .NET local tools
run: dotnet tool restore
- name: 📊 Generate Coverage Report
run: |
echo "Generating coverage report"
reportgenerator -reports:TestResults/**/coverage.cobertura.xml -targetdir:TestResults/CoverageReport -reporttypes:Html;XmlSummary;TextSummary
- name: 📊 Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
files: TestResults/CoverageReport/Summary.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: 📤 Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-coverage
path: TestResults/
retention-days: 7
- name: 📤 Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: TestResults/CoverageReport/
retention-days: 7
- name: 📊 Generate Coverage Summary
run: |
echo "## 📊 Coverage Report Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📈 Test Coverage Metrics" >> $GITHUB_STEP_SUMMARY
echo "- **Test Results**: Available in artifacts" >> $GITHUB_STEP_SUMMARY
echo "- **Coverage Report**: Generated and uploaded" >> $GITHUB_STEP_SUMMARY
echo "- **Codecov**: Uploaded to Codecov platform" >> $GITHUB_STEP_SUMMARY
echo "- **Artifacts**: Available for download" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🔗 Links" >> $GITHUB_STEP_SUMMARY
echo "- **Codecov**: [View Coverage Report](https://codecov.io/gh/${{ github.repository }})" >> $GITHUB_STEP_SUMMARY
echo "- **Artifacts**: Download from Actions tab" >> $GITHUB_STEP_SUMMARY
# Build Summary
build-summary:
name: 📊 Build Summary
runs-on: ubuntu-latest
needs:
[build-qrcoder, build-frameworks, security, pack-nuget, coverage-reports]
if: always()
steps:
- name: 📊 Generate Build Summary
run: |
echo "## 🚀 Build & Pack Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Component | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| 🏗️ QRCoder.Core Build | ${{ needs.build-qrcoder.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| 🔗 Framework Builds | ${{ needs.build-frameworks.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| 🔒 Security & Quality | ${{ needs.security.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| 📦 NuGet Packages | ${{ needs.pack-nuget.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| 📊 Coverage Reports | ${{ needs.coverage-reports.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**🎯 Build Configuration**: ${{ env.BUILD_CONFIG }}" >> $GITHUB_STEP_SUMMARY
echo "**🧪 Tests Executed**: ${{ env.RUN_TESTS }}" >> $GITHUB_STEP_SUMMARY
echo "**📦 Packages Created**: ${{ env.PACK_NUGET }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Target Frameworks" >> $GITHUB_STEP_SUMMARY
echo "- ✅ .NET Standard 2.1" >> $GITHUB_STEP_SUMMARY
echo "- ✅ .NET 8.0" >> $GITHUB_STEP_SUMMARY
echo "- ✅ .NET Framework 4.8" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🔗 Artifacts" >> $GITHUB_STEP_SUMMARY
echo "- **Test Results**: Available in artifacts" >> $GITHUB_STEP_SUMMARY
echo "- **Coverage Reports**: Available in artifacts" >> $GITHUB_STEP_SUMMARY
echo "- **NuGet Packages**: Available in artifacts" >> $GITHUB_STEP_SUMMARY