fix(p2): Wave 3 — fix 4 P2 backend architecture issues (TEC-261)

BACK-I-01: Add CI steps to generate openapi.yaml for all 24 .NET services
- Add .config/dotnet-tools.json with swashbuckle.aspnetcore.cli 7.2.0
- Add scripts/ci/generate-openapi.sh reusable script
- Update all 24 service CI workflows with dotnet tool restore + swagger tofile + artifact upload

BACK-I-02: Add OpenTelemetry Metrics + Prometheus /metrics to _template_dot_net
- Add OTel packages (Extensions.Hosting, Instrumentation.AspNetCore, Runtime, Prometheus)
- Register AddOpenTelemetry().WithMetrics() with ASPNetCore + Runtime instrumentation
- Map MapPrometheusScrapingEndpoint("/metrics") in middleware pipeline

BACK-W-01: Remove IHttpContextAccessor from all 18 handler files in merchant-service-net
- Create MerchantBaseController abstract base with GetCurrentUserId() helper
- Add Guid UserId to 11 Commands and 7 Queries
- Remove IHttpContextAccessor injection from all handlers, use request.UserId instead
- Update 7 controllers to inherit MerchantBaseController and extract userId from JWT claims
- Remove AddHttpContextAccessor() registration from Program.cs

BACK-W-03: Add explicit commandTimeout:5 to all Dapper queries in order-service-net
- 14 files updated: QueryAsync, ExecuteScalarAsync, QueryFirstOrDefaultAsync all get commandTimeout: 5

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-03-23 10:09:45 +07:00
parent 90434acbde
commit a8edfd1597
92 changed files with 2751 additions and 546 deletions

View File

@@ -0,0 +1,86 @@
name: Ads Analytics Service CI
on:
push:
paths:
- 'services/ads-analytics-service-net/**'
pull_request:
paths:
- 'services/ads-analytics-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/ads-analytics-service-net/src/AdsAnalyticsService.API/AdsAnalyticsService.API.csproj
- name: Build API project
run: dotnet build services/ads-analytics-service-net/src/AdsAnalyticsService.API/AdsAnalyticsService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/ads-analytics-service-net AdsAnalyticsService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-adsanalyticsservice-api
path: services/ads-analytics-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/ads-analytics-service-net/tests/AdsAnalyticsService.UnitTests/AdsAnalyticsService.UnitTests.csproj
dotnet restore services/ads-analytics-service-net/tests/AdsAnalyticsService.FunctionalTests/AdsAnalyticsService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/ads-analytics-service-net/tests/AdsAnalyticsService.UnitTests/AdsAnalyticsService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/ads-analytics-service-net/tests/AdsAnalyticsService.FunctionalTests/AdsAnalyticsService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: ads_analytics_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Ads Billing Service CI
on:
push:
paths:
- 'services/ads-billing-service-net/**'
pull_request:
paths:
- 'services/ads-billing-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/ads-billing-service-net/src/AdsBillingService.API/AdsBillingService.API.csproj
- name: Build API project
run: dotnet build services/ads-billing-service-net/src/AdsBillingService.API/AdsBillingService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/ads-billing-service-net AdsBillingService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-adsbillingservice-api
path: services/ads-billing-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/ads-billing-service-net/tests/AdsBillingService.UnitTests/AdsBillingService.UnitTests.csproj
dotnet restore services/ads-billing-service-net/tests/AdsBillingService.FunctionalTests/AdsBillingService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/ads-billing-service-net/tests/AdsBillingService.UnitTests/AdsBillingService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/ads-billing-service-net/tests/AdsBillingService.FunctionalTests/AdsBillingService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: ads_billing_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Ads Manager Service CI
on:
push:
paths:
- 'services/ads-manager-service-net/**'
pull_request:
paths:
- 'services/ads-manager-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/ads-manager-service-net/src/AdsManagerService.API/AdsManagerService.API.csproj
- name: Build API project
run: dotnet build services/ads-manager-service-net/src/AdsManagerService.API/AdsManagerService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/ads-manager-service-net AdsManagerService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-adsmanagerservice-api
path: services/ads-manager-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/ads-manager-service-net/tests/AdsManagerService.UnitTests/AdsManagerService.UnitTests.csproj
dotnet restore services/ads-manager-service-net/tests/AdsManagerService.FunctionalTests/AdsManagerService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/ads-manager-service-net/tests/AdsManagerService.UnitTests/AdsManagerService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/ads-manager-service-net/tests/AdsManagerService.FunctionalTests/AdsManagerService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: ads_manager_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Ads Serving Service CI
on:
push:
paths:
- 'services/ads-serving-service-net/**'
pull_request:
paths:
- 'services/ads-serving-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/ads-serving-service-net/src/AdsServingService.API/AdsServingService.API.csproj
- name: Build API project
run: dotnet build services/ads-serving-service-net/src/AdsServingService.API/AdsServingService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/ads-serving-service-net AdsServingService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-adsservingservice-api
path: services/ads-serving-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/ads-serving-service-net/tests/AdsServingService.UnitTests/AdsServingService.UnitTests.csproj
dotnet restore services/ads-serving-service-net/tests/AdsServingService.FunctionalTests/AdsServingService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/ads-serving-service-net/tests/AdsServingService.UnitTests/AdsServingService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/ads-serving-service-net/tests/AdsServingService.FunctionalTests/AdsServingService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: ads_serving_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Ads Tracking Service CI
on:
push:
paths:
- 'services/ads-tracking-service-net/**'
pull_request:
paths:
- 'services/ads-tracking-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/ads-tracking-service-net/src/AdsTrackingService.API/AdsTrackingService.API.csproj
- name: Build API project
run: dotnet build services/ads-tracking-service-net/src/AdsTrackingService.API/AdsTrackingService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/ads-tracking-service-net AdsTrackingService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-adstrackingservice-api
path: services/ads-tracking-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/ads-tracking-service-net/tests/AdsTrackingService.UnitTests/AdsTrackingService.UnitTests.csproj
dotnet restore services/ads-tracking-service-net/tests/AdsTrackingService.FunctionalTests/AdsTrackingService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/ads-tracking-service-net/tests/AdsTrackingService.UnitTests/AdsTrackingService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/ads-tracking-service-net/tests/AdsTrackingService.FunctionalTests/AdsTrackingService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: ads_tracking_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Booking Service CI
on:
push:
paths:
- 'services/booking-service-net/**'
pull_request:
paths:
- 'services/booking-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/booking-service-net/src/BookingService.API/BookingService.API.csproj
- name: Build API project
run: dotnet build services/booking-service-net/src/BookingService.API/BookingService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/booking-service-net BookingService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-bookingservice-api
path: services/booking-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/booking-service-net/tests/BookingService.UnitTests/BookingService.UnitTests.csproj
dotnet restore services/booking-service-net/tests/BookingService.FunctionalTests/BookingService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/booking-service-net/tests/BookingService.UnitTests/BookingService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/booking-service-net/tests/BookingService.FunctionalTests/BookingService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: booking_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Catalog Service CI
on:
push:
paths:
- 'services/catalog-service-net/**'
pull_request:
paths:
- 'services/catalog-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/catalog-service-net/src/CatalogService.API/CatalogService.API.csproj
- name: Build API project
run: dotnet build services/catalog-service-net/src/CatalogService.API/CatalogService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/catalog-service-net CatalogService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-catalogservice-api
path: services/catalog-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/catalog-service-net/tests/CatalogService.UnitTests/CatalogService.UnitTests.csproj
dotnet restore services/catalog-service-net/tests/CatalogService.FunctionalTests/CatalogService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/catalog-service-net/tests/CatalogService.UnitTests/CatalogService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/catalog-service-net/tests/CatalogService.FunctionalTests/CatalogService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: catalog_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-chat-service.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: Chat Service CI
on:
push:
paths:
- 'services/chat-service-net/**'
pull_request:
paths:
- 'services/chat-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/chat-service-net/src/ChatService.API/ChatService.API.csproj
- name: Build API project
run: dotnet build services/chat-service-net/src/ChatService.API/ChatService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/chat-service-net ChatService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-chatservice-api
path: services/chat-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/chat-service-net/tests/ChatService.UnitTests/ChatService.UnitTests.csproj
dotnet restore services/chat-service-net/tests/ChatService.FunctionalTests/ChatService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/chat-service-net/tests/ChatService.UnitTests/ChatService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/chat-service-net/tests/ChatService.FunctionalTests/ChatService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: chat_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-fnb-engine.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: FnB Engine CI
on:
push:
paths:
- 'services/fnb-engine-net/**'
pull_request:
paths:
- 'services/fnb-engine-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/fnb-engine-net/src/FnbEngine.API/FnbEngine.API.csproj
- name: Build API project
run: dotnet build services/fnb-engine-net/src/FnbEngine.API/FnbEngine.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/fnb-engine-net FnbEngine.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-fnbengine-api
path: services/fnb-engine-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/fnb-engine-net/tests/FnbEngine.UnitTests/FnbEngine.UnitTests.csproj
dotnet restore services/fnb-engine-net/tests/FnbEngine.FunctionalTests/FnbEngine.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/fnb-engine-net/tests/FnbEngine.UnitTests/FnbEngine.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/fnb-engine-net/tests/FnbEngine.FunctionalTests/FnbEngine.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: fnb_engine_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -44,14 +44,41 @@ jobs:
- name: Build API project
run: dotnet build services/iam-service-net/src/IamService.API/IamService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/iam-service-net IamService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-iamservice-api
path: services/iam-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: dotnet restore services/iam-service-net/tests/IamService.UnitTests/IamService.UnitTests.csproj && dotnet restore services/iam-service-net/tests/IamService.FunctionalTests/IamService.FunctionalTests.csproj
- name: Run unit tests
run: dotnet test services/iam-service-net/tests/IamService.UnitTests/IamService.UnitTests.csproj --configuration Release --no-restore --verbosity normal
- name: Run unit tests with coverage
run: >
dotnet test services/iam-service-net/tests/IamService.UnitTests/IamService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/iam-service-net/tests/IamService.FunctionalTests/IamService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: iam_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Inventory Service CI
on:
push:
paths:
- 'services/inventory-service-net/**'
pull_request:
paths:
- 'services/inventory-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/inventory-service-net/src/InventoryService.API/InventoryService.API.csproj
- name: Build API project
run: dotnet build services/inventory-service-net/src/InventoryService.API/InventoryService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/inventory-service-net InventoryService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-inventoryservice-api
path: services/inventory-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/inventory-service-net/tests/InventoryService.UnitTests/InventoryService.UnitTests.csproj
dotnet restore services/inventory-service-net/tests/InventoryService.FunctionalTests/InventoryService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/inventory-service-net/tests/InventoryService.UnitTests/InventoryService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/inventory-service-net/tests/InventoryService.FunctionalTests/InventoryService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: inventory_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Membership Service CI
on:
push:
paths:
- 'services/membership-service-net/**'
pull_request:
paths:
- 'services/membership-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/membership-service-net/src/MembershipService.API/MembershipService.API.csproj
- name: Build API project
run: dotnet build services/membership-service-net/src/MembershipService.API/MembershipService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/membership-service-net MembershipService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-membershipservice-api
path: services/membership-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/membership-service-net/tests/MembershipService.UnitTests/MembershipService.UnitTests.csproj
dotnet restore services/membership-service-net/tests/MembershipService.FunctionalTests/MembershipService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/membership-service-net/tests/MembershipService.UnitTests/MembershipService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/membership-service-net/tests/MembershipService.FunctionalTests/MembershipService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: membership_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Merchant Service CI
on:
push:
paths:
- 'services/merchant-service-net/**'
pull_request:
paths:
- 'services/merchant-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/merchant-service-net/src/MerchantService.API/MerchantService.API.csproj
- name: Build API project
run: dotnet build services/merchant-service-net/src/MerchantService.API/MerchantService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/merchant-service-net MerchantService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-merchantservice-api
path: services/merchant-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/merchant-service-net/tests/MerchantService.UnitTests/MerchantService.UnitTests.csproj
dotnet restore services/merchant-service-net/tests/MerchantService.FunctionalTests/MerchantService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/merchant-service-net/tests/MerchantService.UnitTests/MerchantService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/merchant-service-net/tests/MerchantService.FunctionalTests/MerchantService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: merchant_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-mining-service.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: Mining Service CI
on:
push:
paths:
- 'services/mining-service-net/**'
pull_request:
paths:
- 'services/mining-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/mining-service-net/src/MiningService.API/MiningService.API.csproj
- name: Build API project
run: dotnet build services/mining-service-net/src/MiningService.API/MiningService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/mining-service-net MiningService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-miningservice-api
path: services/mining-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/mining-service-net/tests/MiningService.UnitTests/MiningService.UnitTests.csproj
dotnet restore services/mining-service-net/tests/MiningService.FunctionalTests/MiningService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/mining-service-net/tests/MiningService.UnitTests/MiningService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/mining-service-net/tests/MiningService.FunctionalTests/MiningService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: mining_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Mission Service CI
on:
push:
paths:
- 'services/mission-service-net/**'
pull_request:
paths:
- 'services/mission-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/mission-service-net/src/MissionService.API/MissionService.API.csproj
- name: Build API project
run: dotnet build services/mission-service-net/src/MissionService.API/MissionService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/mission-service-net MissionService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-missionservice-api
path: services/mission-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/mission-service-net/tests/MissionService.UnitTests/MissionService.UnitTests.csproj
dotnet restore services/mission-service-net/tests/MissionService.FunctionalTests/MissionService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/mission-service-net/tests/MissionService.UnitTests/MissionService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/mission-service-net/tests/MissionService.FunctionalTests/MissionService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: mission_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Facebook Marketing Service CI
on:
push:
paths:
- 'services/mkt-facebook-service-net/**'
pull_request:
paths:
- 'services/mkt-facebook-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/mkt-facebook-service-net/src/FacebookService.API/FacebookService.API.csproj
- name: Build API project
run: dotnet build services/mkt-facebook-service-net/src/FacebookService.API/FacebookService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/mkt-facebook-service-net FacebookService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-facebookservice-api
path: services/mkt-facebook-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/mkt-facebook-service-net/tests/FacebookService.UnitTests/FacebookService.UnitTests.csproj
dotnet restore services/mkt-facebook-service-net/tests/FacebookService.FunctionalTests/FacebookService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/mkt-facebook-service-net/tests/FacebookService.UnitTests/FacebookService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/mkt-facebook-service-net/tests/FacebookService.FunctionalTests/FacebookService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: mkt_facebook_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: WhatsApp Marketing Service CI
on:
push:
paths:
- 'services/mkt-whatsapp-service-net/**'
pull_request:
paths:
- 'services/mkt-whatsapp-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/mkt-whatsapp-service-net/src/WhatsAppService.API/WhatsAppService.API.csproj
- name: Build API project
run: dotnet build services/mkt-whatsapp-service-net/src/WhatsAppService.API/WhatsAppService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/mkt-whatsapp-service-net WhatsAppService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-whatsappservice-api
path: services/mkt-whatsapp-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/mkt-whatsapp-service-net/tests/WhatsAppService.UnitTests/WhatsAppService.UnitTests.csproj
dotnet restore services/mkt-whatsapp-service-net/tests/WhatsAppService.FunctionalTests/WhatsAppService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/mkt-whatsapp-service-net/tests/WhatsAppService.UnitTests/WhatsAppService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/mkt-whatsapp-service-net/tests/WhatsAppService.FunctionalTests/WhatsAppService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: mkt_whatsapp_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-mkt-x-service.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: X Marketing Service CI
on:
push:
paths:
- 'services/mkt-x-service-net/**'
pull_request:
paths:
- 'services/mkt-x-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/mkt-x-service-net/src/MktXService.API/MktXService.API.csproj
- name: Build API project
run: dotnet build services/mkt-x-service-net/src/MktXService.API/MktXService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/mkt-x-service-net MktXService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-mktxservice-api
path: services/mkt-x-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/mkt-x-service-net/tests/MktXService.UnitTests/MktXService.UnitTests.csproj
dotnet restore services/mkt-x-service-net/tests/MktXService.FunctionalTests/MktXService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/mkt-x-service-net/tests/MktXService.UnitTests/MktXService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/mkt-x-service-net/tests/MktXService.FunctionalTests/MktXService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: mkt_x_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Zalo Marketing Service CI
on:
push:
paths:
- 'services/mkt-zalo-service-net/**'
pull_request:
paths:
- 'services/mkt-zalo-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/mkt-zalo-service-net/src/MktZaloService.API/MyService.API.csproj
- name: Build API project
run: dotnet build services/mkt-zalo-service-net/src/MktZaloService.API/MyService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/mkt-zalo-service-net MktZaloService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-mktzaloservice-api
path: services/mkt-zalo-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/mkt-zalo-service-net/tests/MktZaloService.UnitTests/MyService.UnitTests.csproj
dotnet restore services/mkt-zalo-service-net/tests/MyService.FunctionalTests/MyService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/mkt-zalo-service-net/tests/MktZaloService.UnitTests/MyService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/mkt-zalo-service-net/tests/MyService.FunctionalTests/MyService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: mkt_zalo_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-order-service.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: Order Service CI
on:
push:
paths:
- 'services/order-service-net/**'
pull_request:
paths:
- 'services/order-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/order-service-net/src/OrderService.API/OrderService.API.csproj
- name: Build API project
run: dotnet build services/order-service-net/src/OrderService.API/OrderService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/order-service-net OrderService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-orderservice-api
path: services/order-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/order-service-net/tests/OrderService.UnitTests/OrderService.UnitTests.csproj
dotnet restore services/order-service-net/tests/OrderService.FunctionalTests/OrderService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/order-service-net/tests/OrderService.UnitTests/OrderService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/order-service-net/tests/OrderService.FunctionalTests/OrderService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: order_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Promotion Service CI
on:
push:
paths:
- 'services/promotion-service-net/**'
pull_request:
paths:
- 'services/promotion-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/promotion-service-net/src/PromotionService.API/PromotionService.API.csproj
- name: Build API project
run: dotnet build services/promotion-service-net/src/PromotionService.API/PromotionService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/promotion-service-net PromotionService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-promotionservice-api
path: services/promotion-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/promotion-service-net/tests/PromotionService.UnitTests/PromotionService.UnitTests.csproj
dotnet restore services/promotion-service-net/tests/PromotionService.FunctionalTests/PromotionService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/promotion-service-net/tests/PromotionService.UnitTests/PromotionService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/promotion-service-net/tests/PromotionService.FunctionalTests/PromotionService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: promotion_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-social-service.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: Social Service CI
on:
push:
paths:
- 'services/social-service-net/**'
pull_request:
paths:
- 'services/social-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/social-service-net/src/SocialService.API/SocialService.API.csproj
- name: Build API project
run: dotnet build services/social-service-net/src/SocialService.API/SocialService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/social-service-net SocialService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-socialservice-api
path: services/social-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/social-service-net/tests/SocialService.UnitTests/SocialService.UnitTests.csproj
dotnet restore services/social-service-net/tests/SocialService.FunctionalTests/SocialService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/social-service-net/tests/SocialService.UnitTests/SocialService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/social-service-net/tests/SocialService.FunctionalTests/SocialService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: social_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -0,0 +1,86 @@
name: Storage Service CI
on:
push:
paths:
- 'services/storage-service-net/**'
pull_request:
paths:
- 'services/storage-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/storage-service-net/src/StorageService.API/StorageService.API.csproj
- name: Build API project
run: dotnet build services/storage-service-net/src/StorageService.API/StorageService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/storage-service-net StorageService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-storageservice-api
path: services/storage-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/storage-service-net/tests/StorageService.UnitTests/StorageService.UnitTests.csproj
dotnet restore services/storage-service-net/tests/StorageService.FunctionalTests/StorageService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/storage-service-net/tests/StorageService.UnitTests/StorageService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/storage-service-net/tests/StorageService.FunctionalTests/StorageService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: storage_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

86
.github/workflows/ci-wallet-service.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: Wallet Service CI
on:
push:
paths:
- 'services/wallet-service-net/**'
pull_request:
paths:
- 'services/wallet-service-net/**'
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore API project
run: dotnet restore services/wallet-service-net/src/WalletService.API/WalletService.API.csproj
- name: Build API project
run: dotnet build services/wallet-service-net/src/WalletService.API/WalletService.API.csproj --configuration Release --no-restore
- name: Restore dotnet tools
run: dotnet tool restore
- name: Generate OpenAPI spec
run: bash scripts/ci/generate-openapi.sh services/wallet-service-net WalletService.API
- name: Upload OpenAPI spec artifact
uses: actions/upload-artifact@v4
with:
name: openapi-walletservice-api
path: services/wallet-service-net/openapi.yaml
if-no-files-found: warn
- name: Restore test projects
run: |
dotnet restore services/wallet-service-net/tests/WalletService.UnitTests/WalletService.UnitTests.csproj
dotnet restore services/wallet-service-net/tests/WalletService.FunctionalTests/WalletService.FunctionalTests.csproj
- name: Run unit tests with coverage
run: >
dotnet test services/wallet-service-net/tests/WalletService.UnitTests/WalletService.UnitTests.csproj
--configuration Release --no-restore --verbosity normal
--collect:"XPlat Code Coverage"
--settings coverage.runsettings
--results-directory TestResults/unit
- name: Run functional tests
run: dotnet test services/wallet-service-net/tests/WalletService.FunctionalTests/WalletService.FunctionalTests.csproj --configuration Release --no-restore --verbosity normal
env:
ConnectionStrings__DefaultConnection: Host=localhost;Port=5432;Database=test_db;Username=testuser;Password=testpass
ASPNETCORE_ENVIRONMENT: Testing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: TestResults/unit/**/coverage.cobertura.xml
flags: wallet_service_net
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}