Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gregyjames authored Jan 18, 2025
1 parent 956b3fc commit 61fee2d
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
# .github/workflows/dotnet.yml

name: .NET
name: .NET Build and Test

on:
push:
Expand All @@ -10,19 +9,31 @@ on:
branches: [ "main" ]

jobs:
build:

build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
# 1. Checkout the repository with a shallow clone
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

# 2. Setup .NET SDK with exact version and enable NuGet caching
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x # Specify the exact SDK version
cache: 'nuget'

# 3. Restore dependencies
- name: Restore dependencies
run: dotnet restore

# 4. Build the solution in Release configuration
- name: Build
run: dotnet build --no-restore --configuration Release

# 5. Run tests with parallel execution
- name: Test
run: dotnet test --no-build --verbosity normal --parallel

0 comments on commit 61fee2d

Please sign in to comment.