Skip to content

Commit cf4e4ac

Browse files
committed
Upgrade project to .NET 10.0 and update package references across all projects; remove obsolete test files and adjust launch settings for new port configuration.
1 parent 8fc059c commit cf4e4ac

22 files changed

Lines changed: 537 additions & 1161 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Test .NET Project
2+
description: Build, test, and publish a .NET project with configurable paths and settings.
3+
4+
inputs:
5+
backendCsprojPath:
6+
description: Path to the .csproj file for the backend project.
7+
required: true
8+
9+
unitTestsProjectPath:
10+
description: Path to the unit tests project (optional).
11+
required: false
12+
default: ''
13+
14+
integrationTestsProjectPath:
15+
description: Path to the integration tests project (optional).
16+
required: false
17+
default: ''
18+
19+
buildConfiguration:
20+
description: Build configuration (Debug or Release).
21+
required: true
22+
23+
serviceName:
24+
description: Name of the service being built.
25+
required: true
26+
27+
runs:
28+
using: composite
29+
steps:
30+
- name: Setup .NET 10.0 SDK
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: 10.0.x
34+
35+
- name: Restore NuGet Packages
36+
run: dotnet restore ./MessagingPlatform.sln
37+
shell: bash
38+
39+
- name: Build .NET Solution
40+
run: |
41+
dotnet build ./MessagingPlatform.sln \
42+
--no-restore \
43+
--configuration "${{ inputs.buildConfiguration }}"
44+
shell: bash
45+
46+
- name: Run Unit Tests
47+
if: ${{ inputs.unitTestsProjectPath != '' }}
48+
run: |
49+
dotnet test "${{ inputs.unitTestsProjectPath }}" \
50+
--configuration "${{ inputs.buildConfiguration }}" \
51+
--no-build \
52+
--verbosity normal
53+
shell: bash
54+
55+
- name: Run Integration Tests
56+
if: ${{ inputs.integrationTestsProjectPath != '' }}
57+
run: |
58+
dotnet test "${{ inputs.integrationTestsProjectPath }}" \
59+
--configuration "${{ inputs.buildConfiguration }}" \
60+
--no-build \
61+
--verbosity normal
62+
shell: bash
63+
64+
- name: Publish .NET Project
65+
run: |
66+
dotnet publish "${{ inputs.backendCsprojPath }}" \
67+
--configuration "${{ inputs.buildConfiguration }}" \
68+
--output "publish"
69+
shell: bash

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
paths:
6+
- backend/src/**
7+
- .github/workflows/ci.yml
8+
branches:
9+
- master
10+
- develop
11+
tags:
12+
- 'v*'
13+
pull_request:
14+
types: [opened, synchronize, reopened]
15+
16+
jobs:
17+
build-and-test:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Run reusable Build and Test action
25+
uses: ./.github/actions/build-and-test
26+
with:
27+
backendCsprojPath: ./backend/src/MessagingPlatform.Api/MessagingPlatform.Api.csproj
28+
unitTestsProjectPath: ./backend/tests/MessagingPlatform.Domain.Tests/MessagingPlatform.Domain.Tests.csproj
29+
buildConfiguration: Release
30+
serviceName: MessagingPlatform
31+
32+
docker:
33+
needs: build-and-test
34+
runs-on: ubuntu-latest
35+
36+
env:
37+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
38+
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Log in to Docker Hub
45+
run: echo "${{ env.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ env.DOCKER_HUB_USERNAME }}" --password-stdin
46+
47+
- name: Build Docker image
48+
run: |
49+
IMAGE_VERSION="latest"
50+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
51+
IMAGE_VERSION=${GITHUB_REF#refs/tags/}
52+
fi
53+
docker buildx build \
54+
-t ${{ env.DOCKER_HUB_USERNAME }}/messagingplatform:${IMAGE_VERSION} \
55+
-t ${{ env.DOCKER_HUB_USERNAME }}/messagingplatform:latest \
56+
-f ./backend/Dockerfile \
57+
./backend/src
58+
59+
- name: Push latest Docker image to Docker Hub
60+
run: docker push ${{ env.DOCKER_HUB_USERNAME }}/messagingplatform:latest
61+
62+
- name: Push Docker image to Docker Hub
63+
if: startsWith(github.ref, 'refs/tags/')
64+
run: |
65+
IMAGE_VERSION=${GITHUB_REF#refs/tags/}
66+
docker push ${{ env.DOCKER_HUB_USERNAME }}/messagingplatform:${IMAGE_VERSION}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docker Compose Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
branches: [ develop ]
10+
11+
jobs:
12+
docker-compose:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Build Docker Compose
20+
run: docker compose build --no-cache
21+
22+
- name: Start Docker Compose
23+
run: docker compose up -d
24+
25+
- name: Health Check Gateway
26+
run: |
27+
echo "Checking health..."
28+
for i in {1..10}; do
29+
curl --fail http://0.0.0.0:8000/health && break || sleep 5
30+
done
31+
curl --fail http://0.0.0.0:8000/health || exit 1

.github/workflows/web.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Web CI Pipeline
2+
3+
on:
4+
push:
5+
paths:
6+
- clients/web/**
7+
- .github/workflows/web.yml
8+
branches:
9+
- master
10+
- develop
11+
tags:
12+
- 'v*'
13+
pull_request:
14+
types: [opened, synchronize, reopened]
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20.x'
28+
29+
- name: Restore dependencies
30+
run: |
31+
cd clients/web
32+
npm ci
33+
34+
- name: Build Angular app
35+
run: |
36+
cd clients/web
37+
npm run build -- --configuration production
38+
39+
# - name: Run tests
40+
# run: |
41+
# cd clients/web
42+
# npm test -- --watch=false --code-coverage
43+
docker:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
47+
env:
48+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
49+
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Log in to Docker Hub
56+
run: echo "${{ env.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ env.DOCKER_HUB_USERNAME }}" --password-stdin
57+
58+
- name: Build Docker image
59+
run: |
60+
IMAGE_VERSION="latest"
61+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
62+
IMAGE_VERSION=${GITHUB_REF#refs/tags/}
63+
fi
64+
docker buildx build \
65+
-t ${{ env.DOCKER_HUB_USERNAME }}/web:${IMAGE_VERSION} \
66+
-t ${{ env.DOCKER_HUB_USERNAME }}/web:latest \
67+
-f ./clients/web/Dockerfile \
68+
--build-arg ENVIRONMENT=Production \
69+
./clients/web
70+
71+
- name: Push latest Docker image to Docker Hub
72+
run: docker push ${{ env.DOCKER_HUB_USERNAME }}/web:latest
73+
74+
- name: Push Docker image to Docker Hub
75+
if: startsWith(github.ref, 'refs/tags/')
76+
run: |
77+
IMAGE_VERSION=${GITHUB_REF#refs/tags/}
78+
docker push ${{ env.DOCKER_HUB_USERNAME }}/web:${IMAGE_VERSION}
79+

0 commit comments

Comments
 (0)