Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c28b248
feat: add CI for backend, fix tests
viktorpekhun Apr 26, 2026
50b4429
feat: add frontend CI, add dockerfile for frontend and docker-compose…
viktorpekhun Apr 27, 2026
c0373ba
add swagger for api, fix node.js error for local run and update readme
viktorpekhun Apr 27, 2026
7ebee97
feat: testing new workflow for deploy
viktorpekhun Apr 28, 2026
bf42032
Merge branch 'develop' into feature/27-implement-cicd
viktorpekhun Apr 28, 2026
bed1cf3
fix: change dockerhub image name
viktorpekhun Apr 28, 2026
98f583d
Merge branch 'feature/27-implement-cicd' of https://github.com/Projec…
viktorpekhun Apr 28, 2026
6135ac9
feat: add deploy to azure to workflow
viktorpekhun Apr 28, 2026
7b04e94
Merge branch 'develop' into feature/27-implement-cicd
viktorpekhun Apr 28, 2026
e59649b
fix: fix tests after merge
viktorpekhun Apr 28, 2026
d488a57
change deploy worflow to deploy only on merge with main
viktorpekhun Apr 28, 2026
d074297
fix comments and test
viktorpekhun Apr 28, 2026
d51e4b0
fix for failing client test job in pr-validation
viktorpekhun Apr 28, 2026
54246bc
fix deployed apps testing
viktorpekhun Apr 28, 2026
18fb0d1
add caching to pr-validation and remove "on pr" from release workflow
viktorpekhun Apr 28, 2026
19c2cc6
minor fix
viktorpekhun Apr 28, 2026
a21325a
Merge branch 'develop' into feature/27-implement-cicd and fix conflicts
viktorpekhun Apr 29, 2026
2f57ded
fix: fix ci tests failure
viktorpekhun Apr 29, 2026
763f9e2
minor fix
viktorpekhun Apr 29, 2026
7108a1c
Merge branch 'develop' into feature/27-implement-cicd
eevatsen Apr 30, 2026
4731e4d
Update package-lock.json
eevatsen Apr 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.vs
**/.vscode
**/bin
**/obj
**/Dockerfile
**/node_modules
**/dist
**/.angular
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.sh text eol=lf
79 changes: 79 additions & 0 deletions .github/workflows/pr-validation.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Client-Side Tests: In pr-validation.yml, the build-and-test-client job installs dependencies and builds the project, but it never runs npm test. Regressions in UI logic will not be caught during PR reviews.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: PR Validation

on:
pull_request:
branches:
- develop
- main

jobs:
build-and-test-api:
name: API Validation
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'

- name: Restore dependencies
run: dotnet restore -p:Configuration=Release

- name: Build project
run: dotnet build --no-restore --configuration Release

- name: Run Unit & Integration Tests
run: dotnet test --no-build --configuration Release --verbosity normal

- name: Verify API Dockerfile builds
uses: docker/build-push-action@v5
with:
context: .
file: src/api/SmartEventBooking.Web/Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max


build-and-test-client:
name: Client UI Validation
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./src/client

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: src/client/.nvmrc
cache: 'npm'
cache-dependency-path: ./src/client/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run client tests
run: npm test -- --watch=false

- name: Verify Client Dockerfile builds
uses: docker/build-push-action@v5
with:
context: ./src/client
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
96 changes: 96 additions & 0 deletions .github/workflows/release-to-prod.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release-to-prod.yml workflow builds and deploys immediately upon a push to main. It does not run any unit or integration tests. If a merge to main introduces an integration issue not caught in the PR, it will be deployed directly to production.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Release to Production

on:
push:
branches: [ main ]

env:
API_IMAGE: smart-event-booking-api-app
CLIENT_IMAGE: smart-event-booking-client-app
AZURE_WEBAPP_API_NAME: app-smarteventbooking-api
AZURE_WEBAPP_CLIENT_NAME: app-smarteventbooking-client

jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'

- name: Run API tests
run: dotnet test --configuration Release --verbosity normal

build-and-push:
needs: run-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }}

- name: Build and push API
uses: docker/build-push-action@v5
with:
context: .
file: src/api/SmartEventBooking.Web/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.API_IMAGE }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.API_IMAGE }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push Client
uses: docker/build-push-action@v5
with:
context: ./src/client
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CLIENT_IMAGE }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CLIENT_IMAGE }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

deploy-api:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Deploy API to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_API_NAME }}
publish-profile: ${{ secrets.AZURE_API_PUBLISH_PROFILE }}
images: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.API_IMAGE }}:${{ github.sha }}'

- name: Smoke test API
run: |
curl --retry 10 --retry-delay 10 --retry-connrefused --fail \
${{ vars.AZURE_WEBAPP_API_URL }}/health/db

deploy-client:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Deploy Client to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_CLIENT_NAME }}
publish-profile: ${{ secrets.AZURE_CLIENT_PUBLISH_PROFILE }}
images: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CLIENT_IMAGE }}:${{ github.sha }}'

- name: Smoke test Client
run: |
curl --retry 10 --retry-delay 10 --retry-connrefused --fail \
${{ vars.AZURE_WEBAPP_CLIENT_URL }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -417,5 +417,5 @@ FodyWeavers.xsd
*.msm
*.msp

docker-compose.yml
Dockerfile
#docker-compose.yml
#Dockerfile
92 changes: 85 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,53 @@ For product vision, scope, and contribution workflow, see `PROJECT_SCOPE.md`.

## Prerequisites

**To run with Docker Compose:**
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)

**To run locally:**
- .NET SDK 10.0
- Node.js 24 LTS (see [Node version setup](#node-version-setup))
- SQL Server (local instance or Docker)
- Node.js (v18 or later) and npm
- Angular CLI (`npm install -g @angular/cli`)

## Running with Docker Compose

The quickest way to run the full stack (API + client + database) without any local tooling beyond Docker.

1. Copy the env file and fill in your credentials:
```bash
cp .env.example .env
```

2. Start everything:
```bash
docker compose up -d --build
```

| Service | URL |
|---|---|
| Client (Angular) | http://localhost:4200 |
| API (ASP.NET Core) | http://localhost:5270 |
| SQL Server | localhost:1433 |

Migrations run automatically on API startup — no manual `dotnet ef` step needed.

3. Stop everything:
```bash
docker compose down
```
Add `-v` to also wipe the database volume.

---

## Running locally

Follow the numbered steps below to run the API and client separately.

## 1) Configure the database settings

This app reads database values from environment variables (`Database__Server`, `Database__Name`, `Database__User`, `Database__Password`, `Database__TrustServerCertificate`) and falls back to `src/SmartEventBooking.Web/appsettings.json`.
This app reads database values from environment variables (`Database__Server`, `Database__Name`, `Database__User`, `Database__Password`, `Database__TrustServerCertificate`) and falls back to `src/api/SmartEventBooking.Web/appsettings.json`.

Admin seeding credentials are also read from environment variables:

Expand Down Expand Up @@ -45,10 +84,10 @@ From the repository root:

```bash
dotnet restore
dotnet ef database update --project src/SmartEventBooking.Infrastructure/SmartEventBooking.Infrastructure.csproj --startup-project src/SmartEventBooking.Web/SmartEventBooking.Web.csproj --context ApplicationDbContext
dotnet ef database update --project src/api/SmartEventBooking.Infrastructure/SmartEventBooking.Infrastructure.csproj --startup-project src/api/SmartEventBooking.Web/SmartEventBooking.Web.csproj --context ApplicationDbContext
```

## 4) Run the app
## 4) Run the API

```bash
dotnet run --project src/api/SmartEventBooking.Web/SmartEventBooking.Web.csproj --launch-profile https
Expand All @@ -58,23 +97,24 @@ Default URLs (development):

- `https://localhost:7134`
- `http://localhost:5270`
- Swagger UI: `https://localhost:7134/swagger`

If you run without the `https` launch profile, you may see:

- `Failed to determine the https port for redirect.`

Use `--launch-profile https` (shown above), or set `ASPNETCORE_URLS` to include an HTTPS URL.

## Run the Frontend (Development server)

To start a local development server for the frontend, navigate to the client directory and run:
## 5) Run the client

```bash
cd src/client
npm install
npm ci
ng serve
```

Client runs at `http://localhost:4200`. The API URL it connects to is configured in `src/client/public/assets/config.json`.

## 6) Verify connectivity

Health endpoint:
Expand All @@ -93,3 +133,41 @@ Expected result:
dotnet build
dotnet test
```

---

## Node version setup

The client requires **Node.js 24 LTS**, pinned in `src/client/.nvmrc`.

### Option A — Install Node 24 directly (simplest)

Download and install Node 24 LTS from [nodejs.org](https://nodejs.org/en/download). No version manager needed if you only work on this project.

### Option B — Use fnm (if you work on multiple projects with different Node versions)

**Windows:**
```powershell
winget install Schniz.fnm
```
Add to your PowerShell profile (run once):
```powershell
Add-Content $PROFILE "fnm env --use-on-cd --shell power-shell | Out-String | Invoke-Expression"
```
Restart PowerShell, then inside `src/client/`:
```powershell
fnm install
fnm use
```

**macOS / Linux:**
```bash
curl -fsSL https://fnm.vercel.app/install | bash
```
Then inside `src/client/`:
```bash
fnm install
fnm use
```

> **Switching versions and seeing native module errors?** Delete `node_modules` and run `npm ci` again — native binaries are version-specific.
8 changes: 6 additions & 2 deletions SmartEventBooking.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
</Folder>
<Folder Name="/tests/">
<File Path="src/SmartEventBooking.Web/.env" />
<Project Path="SmartEventBooking.Infrastructure.IntegrationTests/SmartEventBooking.Infrastructure.IntegrationTests.csproj" Id="ff0fdb7a-e2f2-4d11-8c5d-fee1440c01a1" />
<Project Path="SmartEventBooking.Infrastructure.UnitTests/SmartEventBooking.Infrastructure.UnitTests.csproj" Id="c87eafba-727f-4bc3-8384-ef0721e5d1a7" />
<Project Path="tests/SmartEventBooking.Infrastructure.IntegrationTests/SmartEventBooking.Infrastructure.IntegrationTests.csproj">
<Build Solution="Debug|*" Project="false" />
</Project>
<Project Path="tests/SmartEventBooking.Infrastructure.UnitTests/SmartEventBooking.Infrastructure.UnitTests.csproj">
<Build Solution="Debug|*" Project="false" />
</Project>
<Project Path="tests/SmartEventBooking.Web.Tests/SmartEventBooking.Web.Tests.csproj" />
</Folder>
</Solution>
Loading
Loading