🔄 Bump Microsoft.Extensions.Caching.Abstractions from 8.0.0 to 10.0.2 #45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: .NET | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| DOTNET_VERSION: '8.0.x' | |
| WORKING_DIRECTORY: './src' | |
| CONFIGURATION: 'Release' | |
| jobs: | |
| build-and-test: | |
| name: 🏗️ Build & Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| fail-fast: false | |
| steps: | |
| - name: 🛒 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🔧 Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: 📦 Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: 🔄 Restore dependencies | |
| working-directory: ${{ env.WORKING_DIRECTORY }} | |
| run: dotnet restore --verbosity minimal | |
| - name: 🏗️ Build solution | |
| working-directory: ${{ env.WORKING_DIRECTORY }} | |
| run: dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore --verbosity minimal | |
| - name: 🧪 Run unit tests | |
| working-directory: ${{ env.WORKING_DIRECTORY }} | |
| run: dotnet test --configuration ${{ env.CONFIGURATION }} --no-build --verbosity minimal --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByFile="**/Program.cs" | |
| - name: 📊 Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.os }} | |
| path: ${{ env.WORKING_DIRECTORY }}/TestResults/ | |
| - name: 📈 Upload coverage reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() && matrix.os == 'ubuntu-latest' | |
| with: | |
| name: coverage-reports | |
| path: ${{ env.WORKING_DIRECTORY }}/TestResults/**/coverage.cobertura.xml | |
| security-scan: | |
| name: 🔒 Security Scan | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| steps: | |
| - name: 🛒 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🔧 Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: 🔐 Run security scan | |
| working-directory: ${{ env.WORKING_DIRECTORY }} | |
| run: | | |
| dotnet list package --vulnerable --include-transitive || true | |
| dotnet list package --deprecated || true | |
| code-quality: | |
| name: 📏 Code Quality | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| if: github.event_name == 'pull_request' && !cancelled() | |
| steps: | |
| - name: 🛒 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🔧 Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: 📊 Download coverage reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage-reports | |
| path: coverage/ | |
| continue-on-error: true | |
| - name: 📈 Generate coverage report | |
| run: | | |
| if [ -d "coverage" ] && [ "$(find coverage -name 'coverage.cobertura.xml' | wc -l)" -gt 0 ]; then | |
| dotnet tool install -g dotnet-reportgenerator-globaltool | |
| reportgenerator -reports:"coverage/**/coverage.cobertura.xml" -targetdir:"coverage-report" -reporttypes:"MarkdownSummaryGithub" | |
| else | |
| echo "⚠️ No coverage files found. Skipping coverage report generation." | |
| mkdir -p coverage-report | |
| echo "# ⚠️ Coverage Report Not Available" > coverage-report/SummaryGithub.md | |
| echo "Coverage data was not generated in the build-and-test job." >> coverage-report/SummaryGithub.md | |
| fi | |
| - name: 💬 Comment coverage on PR | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' && hashFiles('coverage-report/SummaryGithub.md') != '' | |
| with: | |
| recreate: true | |
| path: coverage-report/SummaryGithub.md | |
| publish-packages: | |
| name: 📦 Publish Packages | |
| runs-on: ubuntu-latest | |
| needs: [build-and-test, security-scan] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - name: 🛒 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🔧 Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: 📦 Create packages | |
| working-directory: ${{ env.WORKING_DIRECTORY }} | |
| run: dotnet pack --configuration ${{ env.CONFIGURATION }} --output ./packages | |
| - name: 📤 Upload packages artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: ${{ env.WORKING_DIRECTORY }}/packages/*.nupkg |