Skip to content
38 changes: 38 additions & 0 deletions .github/actions/setup-dotnet/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Setup .NET Environment'
description: 'Set up .NET SDK, configure dependency caching, restore, and optionally build'
inputs:
build:
description: 'Whether to run dotnet build after restore'
required: false
default: 'true'
runs:
using: 'composite'
steps:
- name: Setup dotnet SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x

- name: Set up dependency caching for faster builds
uses: actions/cache@v4
id: nuget-cache
with:
path: |
~/.nuget/packages
${{ github.workspace }}/**/obj/project.assets.json
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
${{ runner.os }}-nuget-

- name: Restore dependencies
shell: bash
run: dotnet restore

- name: Build
if: ${{ inputs.build == 'true' }}
shell: bash
run: dotnet build --no-restore
20 changes: 3 additions & 17 deletions .github/workflows/Code-Analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup dotnet SDK
uses: actions/setup-dotnet@v5
- name: Setup .NET environment
uses: ./.github/actions/setup-dotnet
with:
global-json-file: global.json
- name: Set up dependency caching for faster builds
uses: actions/cache@v4
id: nuget-cache
with:
path: |
~/.nuget/packages
${{ github.workspace }}/**/obj/project.assets.json
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
${{ runner.os }}-nuget-
# Run NuGet restore for the solution at repo root
- name: Run NuGet restore
run: dotnet restore
build: 'false'

# Run code analysis for the solution at repo root
- name: Run .NET Code Analysis
Expand Down
24 changes: 2 additions & 22 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,8 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v5
- name: Setup dotnet SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Set up dependency caching for faster builds
uses: actions/cache@v4
id: nuget-cache
with:
path: |
~/.nuget/packages
${{ github.workspace }}/**/obj/project.assets.json
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Setup .NET environment
uses: ./.github/actions/setup-dotnet
- name: Test
run: dotnet test --no-build --no-restore --verbosity normal --logger trx --results-directory ${{ runner.temp }}

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Copilot Setup Steps

on:
push:
paths:
- '.github/workflows/copilot-setup-steps.yml'
pull_request:
paths:
- '.github/workflows/copilot-setup-steps.yml'
workflow_dispatch:

jobs:
copilot-setup-steps:
name: copilot-setup-steps
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Setup .NET environment
uses: ./.github/actions/setup-dotnet
Loading