Skip to content

.NET

.NET #17

Workflow file for this run

# 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