Add GitHub action for unit tests #6
Workflow file for this run
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: Unit Tests | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| jobs: | |
| test: | |
| name: ${{ matrix.os }}-${{ matrix.arch }} / ${{ matrix.framework }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # ---------- Windows x64 ---------- | |
| - { runner: windows-latest, os: windows, arch: x64, framework: net462 } | |
| - { runner: windows-latest, os: windows, arch: x64, framework: net6.0 } | |
| - { runner: windows-latest, os: windows, arch: x64, framework: net8.0 } | |
| - { runner: windows-latest, os: windows, arch: x64, framework: net9.0 } | |
| # ---------- Windows ARM64 ---------- | |
| # .NET Framework (net462) is not supported on ARM64. | |
| - { runner: windows-11-arm, os: windows, arch: arm64, framework: net6.0 } | |
| - { runner: windows-11-arm, os: windows, arch: arm64, framework: net8.0 } | |
| - { runner: windows-11-arm, os: windows, arch: arm64, framework: net9.0 } | |
| # ---------- Linux x64 ---------- | |
| - { runner: ubuntu-latest, os: linux, arch: x64, framework: net6.0 } | |
| - { runner: ubuntu-latest, os: linux, arch: x64, framework: net8.0 } | |
| - { runner: ubuntu-latest, os: linux, arch: x64, framework: net9.0 } | |
| # ---------- Linux ARM64 ---------- | |
| - { runner: ubuntu-24.04-arm, os: linux, arch: arm64, framework: net6.0 } | |
| - { runner: ubuntu-24.04-arm, os: linux, arch: arm64, framework: net8.0 } | |
| - { runner: ubuntu-24.04-arm, os: linux, arch: arm64, framework: net9.0 } | |
| # ---------- macOS ARM64 (Apple Silicon) ---------- | |
| - { runner: macos-latest, os: macos, arch: arm64, framework: net6.0 } | |
| - { runner: macos-latest, os: macos, arch: arm64, framework: net8.0 } | |
| - { runner: macos-latest, os: macos, arch: arm64, framework: net9.0 } | |
| # ---------- macOS x64 (Intel) ---------- | |
| - { runner: macos-13, os: macos, arch: x64, framework: net6.0 } | |
| - { runner: macos-13, os: macos, arch: x64, framework: net8.0 } | |
| - { runner: macos-13, os: macos, arch: x64, framework: net9.0 } | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install SkiaSharp Linux dependencies | |
| if: matrix.os == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfontconfig1 libfreetype6 libuuid1 | |
| - name: Install common fonts (Linux) | |
| if: matrix.os == 'linux' | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| run: | | |
| # Pre-accept the EULA for the Microsoft Core Fonts package so apt is non-interactive. | |
| echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" \ | |
| | sudo debconf-set-selections | |
| sudo apt-get install -y \ | |
| fonts-liberation \ | |
| fonts-liberation2 \ | |
| fonts-dejavu \ | |
| fonts-noto-core \ | |
| fonts-noto-mono \ | |
| fonts-noto-cjk \ | |
| ttf-mscorefonts-installer | |
| fc-cache -f | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 6.0.x | |
| 8.0.x | |
| 9.0.x | |
| - name: NuGet cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| nuget-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Restore | |
| run: dotnet restore UglyToad.PdfPig.Rendering.Skia.Tests/UglyToad.PdfPig.Rendering.Skia.Tests.csproj | |
| - name: Build | |
| run: > | |
| dotnet build UglyToad.PdfPig.Rendering.Skia.Tests/UglyToad.PdfPig.Rendering.Skia.Tests.csproj | |
| --framework ${{ matrix.framework }} | |
| --configuration Release | |
| --no-restore | |
| - name: Test | |
| run: > | |
| dotnet test UglyToad.PdfPig.Rendering.Skia.Tests/UglyToad.PdfPig.Rendering.Skia.Tests.csproj | |
| --framework ${{ matrix.framework }} | |
| --configuration Release | |
| --no-build | |
| --logger "trx;LogFileName=test-results.trx" | |
| --logger "console;verbosity=normal" | |
| --results-directory ./TestResults | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.framework }} | |
| path: ./TestResults/**/*.trx | |
| if-no-files-found: ignore |