neon-sprawl/.github/workflows/dotnet.yml

53 lines
1.5 KiB
YAML

# Build and test the C# solution (server + tests). Targets repo root NeonSprawl.sln.
# pull_request has no paths filter so this job always runs on PRs to main — add check
# ".NET / build" under branch protection required status checks (see PR gate workflow comment).
name: .NET
on:
push:
branches: [main]
paths:
- "NeonSprawl.sln"
- "server/**"
- ".github/workflows/dotnet.yml"
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: neon_sprawl
POSTGRES_PASSWORD: neon_sprawl_dev
POSTGRES_DB: neon_sprawl
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U neon_sprawl -d neon_sprawl"
--health-interval=5s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore NeonSprawl.sln
- name: Build
run: dotnet build NeonSprawl.sln --no-restore --configuration Release
- name: Test
env:
ConnectionStrings__NeonSprawl: >-
Host=localhost;Port=5432;Database=neon_sprawl;Username=neon_sprawl;Password=neon_sprawl_dev
run: dotnet test NeonSprawl.sln --no-build --configuration Release --verbosity normal