diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ffabdf8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI + +on: + push: + pull_request: + +permissions: + contents: read + +jobs: + backend: + name: Backend + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-dotnet@v6 + with: + global-json-file: global.json + - name: Restore locked dependencies + run: dotnet restore ChessRealms.Platform.slnx --locked-mode + - name: Build + run: dotnet build ChessRealms.Platform.slnx --no-restore + - name: Test + run: dotnet test ChessRealms.Platform.slnx --no-build --no-restore + + frontend: + name: Frontend + runs-on: ubuntu-latest + timeout-minutes: 15 + defaults: + run: + working-directory: src/cr-platform-web-app + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version: '26' + cache: npm + cache-dependency-path: src/cr-platform-web-app/package-lock.json + - name: Set up npm + run: npm install --global "$(node -p "require('./package.json').packageManager")" + - name: Restore locked dependencies + run: npm ci + - name: Build + run: npm run build -- --configuration development + - name: Test + run: npm test -- --watch=false diff --git a/README.md b/README.md index 22bc886..566a56e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ An open-source chess platform focused on playing chess against other players or The first milestone is the core experience of playing a complete chess game against another player or a computer opponent. Additional features will be considered after this core functionality is in place. -The repository contains a .NET 10 backend scaffold, an Angular frontend, and Aspire orchestration with PostgreSQL and an EF Core migration worker. CI will be added separately. +The repository contains a .NET 10 backend scaffold, an Angular frontend, and Aspire orchestration with PostgreSQL and an EF Core migration worker. ## Technology @@ -23,7 +23,7 @@ The repository contains a .NET 10 backend scaffold, an Angular frontend, and Asp - `docs/` — project documentation. - `orchestration/` — application orchestration configuration. - `scripts/` — repository development and maintenance scripts. -- `.github/` — GitHub configuration and future workflows. +- `.github/` — GitHub configuration and CI workflows. Empty directories may not appear in a fresh clone until files are added. @@ -83,6 +83,10 @@ npm test -- --watch=false The Angular app stays outside the .NET solution; Aspire runs it directly from its directory. Use `npm start` there to run the frontend independently at http://localhost:4200. +### Continuous integration + +The [CI workflow](.github/workflows/ci.yml) runs on every push and pull request with separate backend and frontend jobs on Ubuntu. The backend uses the SDK from `global.json`, restores with `--locked-mode`, builds, and runs tests without restoring or rebuilding. The frontend uses Node.js 26 and the npm version from `package.json`, installs with `npm ci`, builds the development configuration, and runs Vitest without watch mode. CI does not start AppHost or containers. + ### Run locally Start Docker Desktop with Linux containers, then run: