From a8edfd1597c07b6000299d1436be7f38eec90ee0 Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Mon, 23 Mar 2026 10:09:45 +0700 Subject: [PATCH] =?UTF-8?q?fix(p2):=20Wave=203=20=E2=80=94=20fix=204=20P2?= =?UTF-8?q?=20backend=20architecture=20issues=20(TEC-261)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .config/dotnet-tools.json | 12 ++ .../workflows/ci-ads-analytics-service.yml | 86 ++++++++++++++ .github/workflows/ci-ads-billing-service.yml | 86 ++++++++++++++ .github/workflows/ci-ads-manager-service.yml | 86 ++++++++++++++ .github/workflows/ci-ads-serving-service.yml | 86 ++++++++++++++ .github/workflows/ci-ads-tracking-service.yml | 86 ++++++++++++++ .github/workflows/ci-booking-service.yml | 86 ++++++++++++++ .github/workflows/ci-catalog-service.yml | 86 ++++++++++++++ .github/workflows/ci-chat-service.yml | 86 ++++++++++++++ .github/workflows/ci-fnb-engine.yml | 86 ++++++++++++++ .github/workflows/ci-iam-service.yml | 31 ++++- .github/workflows/ci-inventory-service.yml | 86 ++++++++++++++ .github/workflows/ci-membership-service.yml | 86 ++++++++++++++ .github/workflows/ci-merchant-service.yml | 86 ++++++++++++++ .github/workflows/ci-mining-service.yml | 86 ++++++++++++++ .github/workflows/ci-mission-service.yml | 86 ++++++++++++++ .github/workflows/ci-mkt-facebook-service.yml | 86 ++++++++++++++ .github/workflows/ci-mkt-whatsapp-service.yml | 86 ++++++++++++++ .github/workflows/ci-mkt-x-service.yml | 86 ++++++++++++++ .github/workflows/ci-mkt-zalo-service.yml | 86 ++++++++++++++ .github/workflows/ci-order-service.yml | 86 ++++++++++++++ .github/workflows/ci-promotion-service.yml | 86 ++++++++++++++ .github/workflows/ci-social-service.yml | 86 ++++++++++++++ .github/workflows/ci-storage-service.yml | 86 ++++++++++++++ .github/workflows/ci-wallet-service.yml | 86 ++++++++++++++ .../src/WebClientTpos.Client/App.razor | 29 ++++- .../Layout/AdminLayout.razor | 6 +- .../Layout/AuthLayout.razor | 6 +- .../Layout/CustomerLayout.razor | 24 +++- .../Layout/MainLayout.razor | 6 +- .../Layout/MarketingLayout.razor | 22 +++- .../Layout/PosLayout.razor | 6 +- .../Layout/StaffLayout.razor | 27 ++--- .../Pos/Shared/Payment/GiftCardPayment.razor | 46 ++++++-- .../Pos/Shared/Payment/PartialPayment.razor | 66 +++++++++-- .../Pos/Shared/Payment/PaymentPending.razor | 42 +++++-- .../Pages/Pos/Shared/Payment/TipEntry.razor | 34 ++++-- .../src/WebClientTpos.Client/Program.cs | 15 ++- .../Services/AuthService.cs | 40 +++---- .../Services/LocalStorageService.cs | 46 ++++++++ .../Services/PosDataService.cs | 24 +++- .../Services/ThemeStateService.cs | 49 ++++++++ scripts/ci/generate-openapi.sh | 36 ++++++ .../src/MyService.API/MyService.API.csproj | 7 ++ .../src/MyService.API/Program.cs | 21 ++++ .../Merchants/RegisterMerchantCommand.cs | 6 + .../RegisterMerchantCommandHandler.cs | 15 +-- .../Merchants/UpdateMerchantCommand.cs | 6 + .../Merchants/UpdateMerchantCommandHandler.cs | 15 +-- .../Application/Commands/Pos/PosCommands.cs | 22 ++-- .../Commands/Shops/AddShopBranchCommand.cs | 6 + .../Shops/AddShopBranchCommandHandler.cs | 15 +-- .../Commands/Shops/BranchCommands.cs | 37 ++---- .../Commands/Shops/CreateShopCommand.cs | 6 + .../Shops/CreateShopCommandHandler.cs | 15 +-- .../Shops/ShopStatusCommandHandlers.cs | 41 ++----- .../Commands/Shops/ShopStatusCommands.cs | 6 +- .../Commands/Shops/UpdateShopCommand.cs | 21 ++-- .../Commands/Staff/StaffCommands.cs | 110 +++++++----------- .../Subscriptions/SubscribeCommand.cs | 18 +-- .../Queries/Devices/DeviceQueries.cs | 19 +-- .../Merchants/GetMerchantProfileQuery.cs | 2 +- .../GetMerchantProfileQueryHandler.cs | 17 +-- .../Application/Queries/Pos/PosQueries.cs | 23 +--- .../Queries/Shops/GetShopsQuery.cs | 2 +- .../Queries/Shops/GetShopsQueryHandler.cs | 17 +-- .../Queries/Shops/ShopStatsQueries.cs | 19 +-- .../Application/Queries/Staff/StaffQueries.cs | 23 +--- .../Subscriptions/SubscriptionQueries.cs | 4 +- .../SubscriptionQueryHandlers.cs | 46 ++------ .../Controllers/DevicesController.cs | 5 +- .../Controllers/MerchantBaseController.cs | 31 +++++ .../Controllers/MerchantsController.cs | 33 +++--- .../Controllers/PosController.cs | 7 +- .../Controllers/ShopsController.cs | 32 +++-- .../Controllers/StaffController.cs | 18 ++- .../Controllers/SubscriptionsController.cs | 12 +- .../src/MerchantService.API/Program.cs | 17 +-- .../Commands/Reports/CloseDayCommand.cs | 2 +- .../Queries/AdminListOrdersQuery.cs | 4 +- .../Application/Queries/ExportOrdersQuery.cs | 2 +- .../Queries/GetActiveTableOrdersQuery.cs | 4 +- .../Queries/GetOrderByIdQueryHandler.cs | 6 +- .../Application/Queries/GetOrderStatsQuery.cs | 2 +- .../GetOrdersByCustomerQueryHandler.cs | 4 +- .../Queries/GetPosDashboardQuery.cs | 8 +- .../Queries/GetRevenueReportQuery.cs | 2 +- .../Queries/GetTopProductsQuery.cs | 2 +- .../Queries/ListOrdersByShopQueryHandler.cs | 4 +- .../Queries/Reports/GetEodReportQuery.cs | 6 +- .../Reports/GetRevenueAnalyticsQuery.cs | 10 +- .../Reports/GetStaffPerformanceQuery.cs | 2 +- 92 files changed, 2751 insertions(+), 546 deletions(-) create mode 100644 .config/dotnet-tools.json create mode 100644 .github/workflows/ci-ads-analytics-service.yml create mode 100644 .github/workflows/ci-ads-billing-service.yml create mode 100644 .github/workflows/ci-ads-manager-service.yml create mode 100644 .github/workflows/ci-ads-serving-service.yml create mode 100644 .github/workflows/ci-ads-tracking-service.yml create mode 100644 .github/workflows/ci-booking-service.yml create mode 100644 .github/workflows/ci-catalog-service.yml create mode 100644 .github/workflows/ci-chat-service.yml create mode 100644 .github/workflows/ci-fnb-engine.yml create mode 100644 .github/workflows/ci-inventory-service.yml create mode 100644 .github/workflows/ci-membership-service.yml create mode 100644 .github/workflows/ci-merchant-service.yml create mode 100644 .github/workflows/ci-mining-service.yml create mode 100644 .github/workflows/ci-mission-service.yml create mode 100644 .github/workflows/ci-mkt-facebook-service.yml create mode 100644 .github/workflows/ci-mkt-whatsapp-service.yml create mode 100644 .github/workflows/ci-mkt-x-service.yml create mode 100644 .github/workflows/ci-mkt-zalo-service.yml create mode 100644 .github/workflows/ci-order-service.yml create mode 100644 .github/workflows/ci-promotion-service.yml create mode 100644 .github/workflows/ci-social-service.yml create mode 100644 .github/workflows/ci-storage-service.yml create mode 100644 .github/workflows/ci-wallet-service.yml create mode 100644 apps/web-client-tpos-net/src/WebClientTpos.Client/Services/LocalStorageService.cs create mode 100644 apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ThemeStateService.cs create mode 100755 scripts/ci/generate-openapi.sh create mode 100644 services/merchant-service-net/src/MerchantService.API/Controllers/MerchantBaseController.cs diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000..b4ca2626 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "swashbuckle.aspnetcore.cli": { + "version": "7.2.0", + "commands": [ + "dotnet-swagger" + ] + } + } +} diff --git a/.github/workflows/ci-ads-analytics-service.yml b/.github/workflows/ci-ads-analytics-service.yml new file mode 100644 index 00000000..f0100eef --- /dev/null +++ b/.github/workflows/ci-ads-analytics-service.yml @@ -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 }} diff --git a/.github/workflows/ci-ads-billing-service.yml b/.github/workflows/ci-ads-billing-service.yml new file mode 100644 index 00000000..cdbedc11 --- /dev/null +++ b/.github/workflows/ci-ads-billing-service.yml @@ -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 }} diff --git a/.github/workflows/ci-ads-manager-service.yml b/.github/workflows/ci-ads-manager-service.yml new file mode 100644 index 00000000..49d4a937 --- /dev/null +++ b/.github/workflows/ci-ads-manager-service.yml @@ -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 }} diff --git a/.github/workflows/ci-ads-serving-service.yml b/.github/workflows/ci-ads-serving-service.yml new file mode 100644 index 00000000..35f4f89d --- /dev/null +++ b/.github/workflows/ci-ads-serving-service.yml @@ -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 }} diff --git a/.github/workflows/ci-ads-tracking-service.yml b/.github/workflows/ci-ads-tracking-service.yml new file mode 100644 index 00000000..cb3ff5f9 --- /dev/null +++ b/.github/workflows/ci-ads-tracking-service.yml @@ -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 }} diff --git a/.github/workflows/ci-booking-service.yml b/.github/workflows/ci-booking-service.yml new file mode 100644 index 00000000..f1f5f52b --- /dev/null +++ b/.github/workflows/ci-booking-service.yml @@ -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 }} diff --git a/.github/workflows/ci-catalog-service.yml b/.github/workflows/ci-catalog-service.yml new file mode 100644 index 00000000..fb568b5c --- /dev/null +++ b/.github/workflows/ci-catalog-service.yml @@ -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 }} diff --git a/.github/workflows/ci-chat-service.yml b/.github/workflows/ci-chat-service.yml new file mode 100644 index 00000000..918318c6 --- /dev/null +++ b/.github/workflows/ci-chat-service.yml @@ -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 }} diff --git a/.github/workflows/ci-fnb-engine.yml b/.github/workflows/ci-fnb-engine.yml new file mode 100644 index 00000000..5fe9d897 --- /dev/null +++ b/.github/workflows/ci-fnb-engine.yml @@ -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 }} diff --git a/.github/workflows/ci-iam-service.yml b/.github/workflows/ci-iam-service.yml index 36fe4ae7..f0b05571 100644 --- a/.github/workflows/ci-iam-service.yml +++ b/.github/workflows/ci-iam-service.yml @@ -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 }} diff --git a/.github/workflows/ci-inventory-service.yml b/.github/workflows/ci-inventory-service.yml new file mode 100644 index 00000000..7974bbb7 --- /dev/null +++ b/.github/workflows/ci-inventory-service.yml @@ -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 }} diff --git a/.github/workflows/ci-membership-service.yml b/.github/workflows/ci-membership-service.yml new file mode 100644 index 00000000..5d06747a --- /dev/null +++ b/.github/workflows/ci-membership-service.yml @@ -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 }} diff --git a/.github/workflows/ci-merchant-service.yml b/.github/workflows/ci-merchant-service.yml new file mode 100644 index 00000000..7d77f0b0 --- /dev/null +++ b/.github/workflows/ci-merchant-service.yml @@ -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 }} diff --git a/.github/workflows/ci-mining-service.yml b/.github/workflows/ci-mining-service.yml new file mode 100644 index 00000000..8b11374d --- /dev/null +++ b/.github/workflows/ci-mining-service.yml @@ -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 }} diff --git a/.github/workflows/ci-mission-service.yml b/.github/workflows/ci-mission-service.yml new file mode 100644 index 00000000..6bf23150 --- /dev/null +++ b/.github/workflows/ci-mission-service.yml @@ -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 }} diff --git a/.github/workflows/ci-mkt-facebook-service.yml b/.github/workflows/ci-mkt-facebook-service.yml new file mode 100644 index 00000000..698dcb87 --- /dev/null +++ b/.github/workflows/ci-mkt-facebook-service.yml @@ -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 }} diff --git a/.github/workflows/ci-mkt-whatsapp-service.yml b/.github/workflows/ci-mkt-whatsapp-service.yml new file mode 100644 index 00000000..13a5688f --- /dev/null +++ b/.github/workflows/ci-mkt-whatsapp-service.yml @@ -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 }} diff --git a/.github/workflows/ci-mkt-x-service.yml b/.github/workflows/ci-mkt-x-service.yml new file mode 100644 index 00000000..0d6486a1 --- /dev/null +++ b/.github/workflows/ci-mkt-x-service.yml @@ -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 }} diff --git a/.github/workflows/ci-mkt-zalo-service.yml b/.github/workflows/ci-mkt-zalo-service.yml new file mode 100644 index 00000000..9dcdf7ac --- /dev/null +++ b/.github/workflows/ci-mkt-zalo-service.yml @@ -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 }} diff --git a/.github/workflows/ci-order-service.yml b/.github/workflows/ci-order-service.yml new file mode 100644 index 00000000..f14bf8f7 --- /dev/null +++ b/.github/workflows/ci-order-service.yml @@ -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 }} diff --git a/.github/workflows/ci-promotion-service.yml b/.github/workflows/ci-promotion-service.yml new file mode 100644 index 00000000..e6ce5383 --- /dev/null +++ b/.github/workflows/ci-promotion-service.yml @@ -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 }} diff --git a/.github/workflows/ci-social-service.yml b/.github/workflows/ci-social-service.yml new file mode 100644 index 00000000..5d9d180c --- /dev/null +++ b/.github/workflows/ci-social-service.yml @@ -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 }} diff --git a/.github/workflows/ci-storage-service.yml b/.github/workflows/ci-storage-service.yml new file mode 100644 index 00000000..c062eaab --- /dev/null +++ b/.github/workflows/ci-storage-service.yml @@ -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 }} diff --git a/.github/workflows/ci-wallet-service.yml b/.github/workflows/ci-wallet-service.yml new file mode 100644 index 00000000..96ce5f49 --- /dev/null +++ b/.github/workflows/ci-wallet-service.yml @@ -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 }} diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/App.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/App.razor index a8a79e51..59a87f83 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/App.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/App.razor @@ -1,6 +1,33 @@ - +@* + EN: App root — hosts the single set of MudBlazor providers (FRONT-W-06). + Theme and dark mode are controlled via ThemeStateService; layouts call SetTheme on init. + VI: Root ứng dụng — host bộ MudBlazor providers duy nhất (FRONT-W-06). + Theme và dark mode được điều khiển qua ThemeStateService; layout gọi SetTheme khi khởi tạo. +*@ +@using WebClientTpos.Client.Services +@inject ThemeStateService ThemeState +@implements IDisposable + + + + + + + + +@code { + protected override void OnInitialized() + { + ThemeState.OnChange += StateHasChanged; + } + + public void Dispose() + { + ThemeState.OnChange -= StateHasChanged; + } +} diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor index 4f0f18a2..20926ebe 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor @@ -15,10 +15,8 @@ @inject Microsoft.Extensions.Localization.IStringLocalizer L @using WebClientTpos.Client.Services - - - - +@* EN: Theme providers moved to App.razor (FRONT-W-06) — DefaultDark is the ThemeStateService default. *@ +@* VI: Theme providers đã chuyển về App.razor (FRONT-W-06) — DefaultDark là mặc định của ThemeStateService. *@
@* ═══ SIDEBAR ═══ *@ diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AuthLayout.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AuthLayout.razor index 87ff4ff8..09c3cd9a 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AuthLayout.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AuthLayout.razor @@ -2,10 +2,8 @@ @inject IJSRuntime JS @inject Microsoft.Extensions.Localization.IStringLocalizer L - - - - +@* EN: Theme providers moved to App.razor (FRONT-W-06) — DefaultDark is the ThemeStateService default. *@ +@* VI: Theme providers đã chuyển về App.razor (FRONT-W-06) — DefaultDark là mặc định của ThemeStateService. *@