Skip to content

ci: bump gitleaks/gitleaks-action from 2.3.9 to 3.0.0 #156

ci: bump gitleaks/gitleaks-action from 2.3.9 to 3.0.0

ci: bump gitleaks/gitleaks-action from 2.3.9 to 3.0.0 #156

name: CI Tests & Coverage
on:
push:
branches: ["**"]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
dotnet-version: 8.0.x
- name: Cache NuGet packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore CompanyManagementSystem.sln
- name: Build
run: dotnet build CompanyManagementSystem.sln --configuration Release --no-restore
- name: Test with coverage
run: |
dotnet test Tests/Tests.csproj \
--configuration Release \
--no-build \
--verbosity normal \
--settings Tests/coverlet.runsettings.xml \
--collect:"XPlat Code Coverage" \
--results-directory TestResults \
--logger "trx;LogFileName=test-results.trx" \
/p:ExcludeByFile="**/Migrations/*.cs%3b**/Areas/Identity/**/*.cs%3b**/*.g.cs%3b**/*.designer.cs"
- name: Install ReportGenerator for HTML coverage
if: always()
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool || dotnet tool update -g dotnet-reportgenerator-globaltool
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Generate HTML coverage report
if: always()
run: |
reportgenerator \
-reports:"TestResults/**/coverage.cobertura.xml" \
-targetdir:"TestResults/coverage-html" \
-reporttypes:"Html;HtmlSummary"
- name: Upload test results and coverage
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: test-results-and-coverage
path: TestResults
- name: Upload HTML coverage report
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: coverage-html-report
path: TestResults/coverage-html
- name: Generate test & coverage summary
if: always()
run: |
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
echo "- **Framework**: xUnit (FluentAssertions, Moq)" >> $GITHUB_STEP_SUMMARY
echo "- **Coverage Tool**: Coverlet" >> $GITHUB_STEP_SUMMARY
echo "- **Excluded**: Migrations, Identity scaffolding, generated code" >> $GITHUB_STEP_SUMMARY