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>
87 lines
2.7 KiB
YAML
87 lines
2.7 KiB
YAML
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 }}
|