diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4683614 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,29 @@ +# Git +.git +.gitignore + +# Task / planning files +task.md +.claude/ + +# IDE & build outputs +.vs/ +.idea/ +*.user +**/bin/ +**/obj/ + +# SQLite databases +*.db +*.db-shm +*.db-wal + +# Test results +TestResults/ +*.trx +*.coverage + +# Docker +Dockerfile +.dockerignore + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b597e6..02f028a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,42 +1,34 @@ -name: CI - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -permissions: - contents: read - -env: - DOTNET_NOLOGO: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - buildConfiguration: Release - -jobs: - build-and-test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install .NET SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '10.x' - - # Build only the test projects (pulls in DAL/BL as dependencies automatically, - # skips GameLib.App since that needs MAUI workloads we don't want on free CI runners) - - name: Build backend & tests - run: | - dotnet build solution/GameLib.Tests/GameLib.DAL.Tests.csproj --configuration $buildConfiguration - dotnet build solution/GameLib.BL.Tests/GameLib.BL.Tests.csproj --configuration $buildConfiguration - - # GameLib.Common.Tests is shared seed/assert data referenced by the two suites - # above (built transitively) - it has no tests of its own, so it's not run here. - - name: Run DAL tests - run: dotnet test solution/GameLib.Tests/GameLib.DAL.Tests.csproj --configuration $buildConfiguration --logger trx --no-build - - - name: Run BL tests - run: dotnet test solution/GameLib.BL.Tests/GameLib.BL.Tests.csproj --configuration $buildConfiguration --logger trx --no-build \ No newline at end of file +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build test image (runs xUnit tests inside) + uses: docker/build-push-action@v6 + with: + context: . + target: test + push: false + # Layer cache shared across runs via GitHub Actions cache + cache-from: type=gha,scope=test + cache-to: type=gha,mode=max,scope=test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..78e3625 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +# syntax=docker/dockerfile:1 +# ============================================================ +# Stage: test +# Restores, builds, and runs the DAL + BL xUnit test suites. +# Usage: docker build --target test . +# ============================================================ +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS test + +ENV DOTNET_NOLOGO=true \ + DOTNET_CLI_TELEMETRY_OPTOUT=true + +WORKDIR /src + +# Copy project files first — layer cache is invalidated only when these +# change, so a source-only edit doesn't re-trigger a full restore. +COPY solution/GameLib.DAL/GameLib.DAL.csproj ./solution/GameLib.DAL/ +COPY solution/GameLib.BL/GameLib.BL.csproj ./solution/GameLib.BL/ +COPY solution/GameLib.Common.Tests/GameLib.Common.Tests.csproj ./solution/GameLib.Common.Tests/ +COPY solution/GameLib.Tests/GameLib.DAL.Tests.csproj ./solution/GameLib.Tests/ +COPY solution/GameLib.BL.Tests/GameLib.BL.Tests.csproj ./solution/GameLib.BL.Tests/ + +RUN dotnet restore solution/GameLib.Tests/GameLib.DAL.Tests.csproj && \ + dotnet restore solution/GameLib.BL.Tests/GameLib.BL.Tests.csproj + +# Copy the full source tree +COPY solution/ ./solution/ + +RUN dotnet build solution/GameLib.Tests/GameLib.DAL.Tests.csproj \ + --no-restore --configuration Release && \ + dotnet build solution/GameLib.BL.Tests/GameLib.BL.Tests.csproj \ + --no-restore --configuration Release + +# Tests run during the image build — the build fails fast if any test fails. +RUN dotnet test solution/GameLib.Tests/GameLib.DAL.Tests.csproj \ + --no-build --configuration Release \ + --logger "console;verbosity=normal" && \ + dotnet test solution/GameLib.BL.Tests/GameLib.BL.Tests.csproj \ + --no-build --configuration Release \ + --logger "console;verbosity=normal" diff --git a/solution/GameLib.App/GameLib.App.csproj b/solution/GameLib.App/GameLib.App.csproj index 4dd846b..1ace32c 100644 --- a/solution/GameLib.App/GameLib.App.csproj +++ b/solution/GameLib.App/GameLib.App.csproj @@ -1,4 +1,4 @@ - + net10.0-android @@ -101,9 +101,6 @@ MSBuild:Compile - - MSBuild:Compile - MSBuild:Compile diff --git a/solution/GameLib.App/Views/GameEditView.xaml b/solution/GameLib.App/Views/GameEditView.xaml deleted file mode 100644 index eb86e0f..0000000 --- a/solution/GameLib.App/Views/GameEditView.xaml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - -