# Run .NET tests with preview native libs

> Run .NET tests with preview native libs is an Agent Skill for testing & quality published in the sandrohanea/whisper.net repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Use when validating managed .NET changes that do not modify whisper.cpp or native runtime build outputs.

- Skill name: `Run .NET tests with preview native libs`
- Category: [Testing & Quality](https://www.openparable.com/skill/testing-quality/1)
- Source: https://github.com/sandrohanea/whisper.net/blob/HEAD/.github/skills/run-dotnet-tests-with-preview-nativelibs/SKILL.md
- Repository: sandrohanea/whisper.net (934 GitHub stars when collected)

## SKILL.md

# Run .NET tests with preview native libs

Use this skill when you need to run Whisper.net managed tests and the change does not require rebuilding native runtimes or changing the `whisper.cpp` submodule.

## When to use this

- The task changes managed C# code, tests, docs, samples, or project files only.
- You need native libraries available locally for `dotnet test`.
- You do not need to validate a new `whisper.cpp` revision or native build-system change.

Do not use this shortcut for changes under `whisper.cpp`, native build scripts, runtime package targets, or native binary outputs. In those cases, build the relevant native runtimes instead.

## How the preview package is produced

The `.github/workflows/upload-build-artifacts.yml` workflow:

1. Reads the pinned `whisper.cpp` short commit SHA.
2. Creates a prerelease tag named `preview-nativelibs-<sha>`.
3. Uploads one release asset named `native-runtimes.zip`.
4. Stores the merged native build outputs inside the archive under `runtime-artifacts/`.

Example release:

```text
https://github.com/sandrohanea/whisper.net/releases/tag/preview-nativelibs-f24588a
```

## PowerShell workflow

Run from the repository root:

```powershell
$commit = git rev-parse --short=7 HEAD:whisper.cpp
$tag = "preview-nativelibs-$commit"
gh release download $tag --repo sandrohanea/whisper.net --pattern native-runtimes.zip --clobber
Expand-Archive .\native-runtimes.zip -DestinationPath . -Force
Copy-Item .\runtime-artifacts\* .\runtimes\ -Recurse -Force
Remove-Item .\runtime-artifacts -Recurse -Force
Remove-Item .\native-runtimes.zip
dotnet restore .\Whisper.net.slnx
dotnet build .\Whisper.net.slnx --no-restore -warnaserror
dotnet test .\Whisper.net.slnx --no-build --logger "trx"
```

## Bash workflow

Run from the repository root:

```bash
commit="$(git rev-parse --short=7 HEAD:whisper.cpp)"
tag="preview-nativelibs-$commit"
gh release download "$tag" --repo sandrohanea/whisper.net --pattern native-runtimes.zip --clobber
unzip -o native-runtimes.zip
cp -R runtime-artifacts/* runtimes/
rm -rf runtime-artifacts native-runtimes.zip
dotnet restore ./Whisper.net.slnx
dotnet build ./Whisper.net.slnx --no-restore -warnaserror
dotnet test ./Whisper.net.slnx --no-build --logger "trx"
```

## Test model handling

The preview native libs release contains native runtime artifacts, not necessarily test model files. Do not set `WHISPER_TEST_MODEL_PATH` to `runtimes/` unless the required `ggml-*.bin` model files are present there. Without that variable, the tests download models through the normal test fixture path.

## Repository hygiene

- Treat downloaded native runtimes as local test inputs, not source changes.
- Do not commit copied binaries from `native-runtimes.zip` unless the task explicitly asks to update runtime artifacts.
- Remove temporary `native-runtimes.zip` and `runtime-artifacts/` files after unpacking.

---

Source: https://www.openparable.com/skill/testing-quality/run-net-tests-with-preview-native-libs (OpenParable). Cite the canonical URL above.
