Fix special characters in release notes #6
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: CI/CD | |
on: | |
push: | |
branches: [ main, develop ] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
pull_request: | |
branches: [ main, develop ] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
env: | |
DOTNET_VERSION: '8.0.x' | |
SOLUTION_PATH: 'AlgorithmVisualizer.sln' | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Cache NuGet Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore Dependencies | |
run: dotnet restore ${{ env.SOLUTION_PATH }} | |
- name: Build Solution | |
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore | |
- name: Run Unit Tests | |
run: | | |
dotnet test ${{ env.SOLUTION_PATH }} ` | |
--configuration Release ` | |
--no-build ` | |
--verbosity normal ` | |
--collect:"XPlat Code Coverage" ` | |
--results-directory ./coverage ` | |
--logger trx ` | |
--logger "console;verbosity=detailed" | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: '**/*.trx' | |
retention-days: 7 | |
- name: Upload Coverage Reports | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: coverage-reports | |
path: './coverage/**/*.xml' | |
retention-days: 7 | |
code-analysis: | |
name: Code Analysis | |
runs-on: windows-latest | |
needs: build-and-test | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Restore Dependencies | |
run: dotnet restore ${{ env.SOLUTION_PATH }} | |
- name: Run Code Analysis | |
run: | | |
dotnet build ${{ env.SOLUTION_PATH }} ` | |
--configuration Release ` | |
--verbosity normal ` | |
--property:RunAnalyzersDuringBuild=true ` | |
--property:TreatWarningsAsErrors=false ` | |
--property:_SkipUpgradeNetAnalyzersNuGetWarning=true | |
- name: Install dotnet format | |
run: dotnet tool install -g dotnet-format | |
- name: Format Code | |
run: | | |
dotnet format ${{ env.SOLUTION_PATH }} --verbosity normal | |
- name: Check for Code Changes | |
run: | | |
$changes = git diff --name-only | |
if ($changes) { | |
Write-Host "The following files were reformatted:" | |
$changes | ForEach-Object { Write-Host " $_" } | |
Write-Host "##[error]Code formatting issues found. Please run 'dotnet format' locally and commit the changes." | |
exit 1 | |
} else { | |
Write-Host "No formatting issues found." | |
} | |
shell: powershell | |
security-scan: | |
name: Security Scan | |
runs-on: windows-latest | |
needs: build-and-test | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: 'fs' | |
scan-ref: '.' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
- name: Upload Trivy scan results | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: 'trivy-results.sarif' |