Clean code #31
This file contains 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
# This workflow will build and test a .NET project | |
name: .NET | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
backend-build-and-test: | |
name: Build and Test Backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore Backend Dependencies | |
run: dotnet restore CollectifyAPI/CollectifyAPI/CollectifyAPI.csproj | |
- name: Build Backend | |
run: dotnet build CollectifyAPI/CollectifyAPI/CollectifyAPI.csproj --no-restore | |
- name: Run Backend Tests | |
run: dotnet test CollectifyAPI/CollectifyAPI/CollectifyAPI.csproj --no-build --verbosity normal | |
- name: Clean Test Project | |
run: dotnet clean CollectifyAPI/CollectifyAPI.Tests/CollectifyAPI.Tests.csproj | |
- name: Restore Test Dependencies | |
run: dotnet restore CollectifyAPI/CollectifyAPI.Tests/CollectifyAPI.Tests.csproj | |
- name: Build Test Project | |
run: dotnet build CollectifyAPI/CollectifyAPI.Tests/CollectifyAPI.Tests.csproj --no-restore | |
- name: Run Unit and Integration Tests | |
run: dotnet test CollectifyAPI/CollectifyAPI.Tests/CollectifyAPI.Tests.csproj --no-build --verbosity detailed --logger "trx;LogFileName=TestResults.trx" | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: TestResults.trx | |
performance-tests: | |
name: Run Performance Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install k6 | |
run: | | |
sudo apt update | |
sudo snap install k6 | |
- name: Run k6 Performance Tests | |
run: k6 run CollectifyAPI/CollectifyAPI.Tests/PerformanceTests/test.js |