Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dotnet-gha-build-test

БесплатноБез исполняемых скриптовНе проверен

Configuring .NET build/test in GitHub Actions. setup-dotnet, NuGet caching, test reporting.

wshaddixот wshaddix★ 94 звезды на GitHub

Об этом скилле

dotnet-gha-build-test

.NET build and test workflow patterns for GitHub Actions: actions/setup-dotnet@v4 configuration with multi-version installs and NuGet authentication, NuGet restore caching for fast CI, dotnet test with result publishing via dorny/test-reporter, code coverage upload to Codecov and Coveralls, multi-TFM matrix testing across net8.0 and net9.0, and test sharding strategies for large projects.

Version assumptions: actions/setup-dotnet@v4 for .NET 8/9/10 support. dorny/test-reporter@v1 for test result visualization. Codecov and Coveralls GitHub Apps for coverage reporting.

Scope boundary: This skill owns .NET build and test pipeline configuration for GitHub Actions. Starter CI templates (basic build/test/pack) are owned by [skill:dotnet-add-ci]. Composable workflow patterns (reusable workflows, matrix strategies, caching) are in [skill:dotnet-gha-patterns]. Testing strategy guidance (what to test, test architecture, quality gates) is owned by [skill:dotnet-testing-strategy]. Benchmark CI workflows are owned by [skill:dotnet-ci-benchmarking].

Out of scope: Starter CI templates -- see [skill:dotnet-add-ci]. Test architecture and strategy -- see [skill:dotnet-testing-strategy]. Benchmark regression detection in CI -- see [skill:dotnet-ci-benchmarking]. Publishing and deployment -- see [skill:dotnet-gha-publish] and [skill:dotnet-gha-deploy]. Azure DevOps build/test pipelines -- see [skill:dotnet-ado-build-test].

Cross-references: [skill:dotnet-add-ci] for starter build/test templates, [skill:dotnet-testing-strategy] for test architecture guidance, [skill:dotnet-ci-benchmarking] for benchmark CI integration, [skill:dotnet-artifacts-output] for artifact upload path adjustments when using centralized build output layout.


actions/setup-dotnet@v4 Configuration

Basic Setup

steps:
  - uses: actions/checkout@v4

  - name: Setup .NET
    uses: actions/setup-dotnet@v4
    with:
      dotnet-version: '8.0.x'

Multi-Version Install

Install multiple SDK versions for multi-TFM builds within a single job:

- name: Setup .NET SDKs
  uses: actions/setup-dotnet@v4
  with:
    dotnet-version: |
      8.0.x
      9.0.x

The first listed version becomes the default dotnet on PATH. All installed versions are available via --framework targeting.

NuGet Authentication for Private Feeds

Configure NuGet source authentication via actions/setup-dotnet@v4:

- name: Setup .NET with NuGet auth
  uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '8.0.x'
    source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
  env:
    NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

For multiple private feeds, configure additional sources after setup:

- name: Setup .NET
  uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '8.0.x'

- name: Add private NuGet feed
  run: |
    set -euo pipefail
    dotnet nuget add source https://pkgs.dev.azure.com/myorg/_packaging/myfeed/nuget/v3/index.json \
      --name AzureArtifacts \
      --username az \
      --password ${{ secrets.AZURE_ARTIFACTS_PAT }} \
      --store-password-in-clear-text

The --store-password-in-clear-text flag is required on Linux runners where DPAPI encryption is unavailable.

Global.json SDK Version Pinning

When global.json exists in the repository root, actions/setup-dotnet@v4 can read it automatically:

- name: Setup .NET from global.json
  uses: actions/setup-dotnet@v4
  with:
    global-json-file: global.json

This ensures CI uses the same SDK version as local development.


NuGet Restore Caching

Standard Cache Configuration

- name: Cache NuGet packages
  uses: actions/cache@v4
  with:
    path: ~/.nuget/packages
    key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
    restore-keys: |
      nuget-${{ runner.os }}-

- name: Restore dependencies
  run: dotnet restore MySolution.sln

Built-in Cache with setup-dotnet

actions/setup-dotnet@v4 has built-in caching support using packages.lock.json:

- name: Setup .NET with caching
  uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '8.0.x'
    cache: true
    cache-dependency-path: '**/packages.lock.json'

Generate lock files locally first: dotnet restore --use-lock-file. Commit packages.lock.json files for deterministic restore.

Cache Key Strategy

Key Component Purpose
runner.os Prevent cross-OS cache collisions
hashFiles('**/*.csproj') Invalidate when package references change
hashFiles('**/Directory.Packages.props') Invalidate when centrally managed versions change
restore-keys prefix Partial match for incremental cache reuse

Test Result Publishing

dorny/test-reporter

Publish dotnet test results as GitHub Actions check annotations with inline failure details:

-
Полный SKILL.md на GitHub

Установить dotnet-gha-build-test в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл dotnet-gha-build-test?

Configuring .NET build/test in GitHub Actions. setup-dotnet, NuGet caching, test reporting.

Как установить скилл dotnet-gha-build-test?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dotnet-gha-build-test запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить dotnet-gha-build-test с