CI remove building before testing #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/dotnet.yml | |
name: .NET Build and Test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Checkout the repository with a shallow clone | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 # Shallow clone for faster checkouts | |
# 2. Setup .NET SDK with exact version | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x # Specify the exact SDK version | |
# 3. Cache NuGet packages | |
- name: Cache NuGet packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.sln') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
# 4. Restore dependencies | |
- name: Restore dependencies | |
run: dotnet restore | |
# 5. Run tests with parallel execution | |
- name: Test | |
run: dotnet test --verbosity normal |