Skip to content

Add unit testing workflow #1

Add unit testing workflow

Add unit testing workflow #1

Workflow file for this run

name: CI - Unit Tests
on:
push:
pull_request:
jobs:
test-linux:
name: Tests (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
restore-keys: |
nuget-${{ runner.os }}-
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Run CoreJ2K.Tests
run: dotnet test tests/CoreJ2K.Tests/CoreJ2K.Tests.csproj --configuration Release --no-build --verbosity normal
- name: Run CoreJ2K.Skia.Tests
run: |
if [ -f tests/CoreJ2K.Skia.Tests/CoreJ2K.Skia.Tests.csproj ]; then
dotnet test tests/CoreJ2K.Skia.Tests/CoreJ2K.Skia.Tests.csproj --configuration Release --no-build --verbosity normal
else
echo "CoreJ2K.Skia.Tests project not present - skipping"
fi
test-windows:
name: Tests (Windows)
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: C:\Users\runneradmin\.nuget\packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
restore-keys: |
nuget-${{ runner.os }}-
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Run CoreJ2K.Windows.Tests (if present)
run: |
if (Test-Path tests\CoreJ2K.Windows.Tests\CoreJ2K.Windows.Tests.csproj) {
dotnet test tests\CoreJ2K.Windows.Tests\CoreJ2K.Windows.Tests.csproj --configuration Release --no-build --verbosity normal
} else {
Write-Host "CoreJ2K.Windows.Tests project not present - skipping"
}