Skip to content

Merge pull request #1354 from Ed-Pavlov/patch-1 #443

Merge pull request #1354 from Ed-Pavlov/patch-1

Merge pull request #1354 from Ed-Pavlov/patch-1 #443

Workflow file for this run

name: Unit Test
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container || '' }}
strategy:
fail-fast: false
matrix:
build: [linux-x64-cpu, windows-x64-cpu, macos-arm64-metal, linux-arm64-cpu, linux-musl-x64-cpu]
include:
- build: linux-x64-cpu
os: ubuntu-24.04
config: release
name: Linux x64 CPU
- build: macos-arm64-metal
os: macos-14
config: release
name: macOS ARM64 Metal
- build: windows-x64-cpu
os: windows-2022
config: release
name: Windows x64 CPU
- build: linux-arm64-cpu
os: ubuntu-24.04-arm
config: release
name: Linux ARM64 CPU
- build: linux-musl-x64-cpu
os: ubuntu-24.04
config: release
name: Linux musl x64 CPU
container: mcr.microsoft.com/dotnet/sdk:9.0-alpine
steps:
- name: Free Disk Space (Ubuntu)
if: ${{ matrix.build == 'linux-x64-cpu' || matrix.build == 'linux-arm64-cpu' }}
uses: jlumbroso/free-disk-space@v1.3.1
with:
dotnet: false
- name: Install Alpine dependencies
if: ${{ matrix.build == 'linux-musl-x64-cpu' }}
run: |
apk add --no-cache git bash icu-libs libstdc++ libgomp
dotnet --list-runtimes
dotnet --list-sdks
- name: Install .NET 8.0 runtime (Alpine)
if: ${{ matrix.build == 'linux-musl-x64-cpu' }}
run: |
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --runtime dotnet --channel 8.0 --install-dir /usr/share/dotnet
rm dotnet-install.sh
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
if: ${{ matrix.build != 'linux-musl-x64-cpu' }}
with:
dotnet-version: |
8.0.x
- name: Install Mobile Workloads
if: ${{ contains(runner.os, 'windows') }}
run: |
dotnet workload install android --ignore-failed-sources
dotnet workload install maui --ignore-failed-sources
- name: Remove Mobile Project
if: ${{ !contains(runner.os, 'windows') }}
run: |
dotnet sln LLamaSharp.sln remove Llama.Mobile
- name: Cache Packages
uses: actions/cache@v4
with:
key: "unit_test_models"
path: LLama.Unittest/Models
# workaround for actions/setup-dotnet#155
- name: Clear package cache
run: dotnet clean LLamaSharp.sln && dotnet nuget locals all --clear
- name: Restore packages
run: dotnet restore LLamaSharp.sln
- name: Build
run: dotnet build LLamaSharp.sln -c ${{ matrix.config }} --no-restore
- name: Test
run: dotnet test LLamaSharp.sln -c ${{ matrix.config }} -l "console;verbosity=detailed" --diag:logs/log.txt --filter Category!=NoCI
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: logs/
name: logs-${{ matrix.build }}