From c25e820c5ea768df5fa4454ad82d21859227c7d4 Mon Sep 17 00:00:00 2001 From: Timo Notheisen Date: Thu, 6 Mar 2025 13:27:53 +0100 Subject: [PATCH 1/4] chore: change flutter build --- Applications/AdminApi/src/AdminApi/Dockerfile | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Applications/AdminApi/src/AdminApi/Dockerfile b/Applications/AdminApi/src/AdminApi/Dockerfile index a4c5c4880a..fd68048bec 100644 --- a/Applications/AdminApi/src/AdminApi/Dockerfile +++ b/Applications/AdminApi/src/AdminApi/Dockerfile @@ -106,16 +106,22 @@ FROM ghcr.io/cirruslabs/android-sdk:35 AS flutter-build-env USER root -ENV FLUTTER_HOME=/sdks/flutter -ENV FLUTTER_ROOT=$FLUTTER_HOME -ENV PATH=${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin +ENV FLUTTER_ROOT=${HOME}/sdks/flutter -RUN curl -sLO https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.29.0-stable.tar.xz \ - && mkdir -p ${FLUTTER_HOME} \ - && tar -xf flutter_linux_3.29.0-stable.tar.xz -C /sdks/ \ - && chown -R root:root ${FLUTTER_HOME} +ENV PATH ${PATH}:${FLUTTER_ROOT}/bin:${FLUTTER_ROOT}/bin/cache/dart-sdk/bin -RUN flutter doctor +RUN git clone --depth 1 --branch 3.29.0 https://github.com/flutter/flutter.git ${FLUTTER_ROOT} + +# Temporary workaround for https://github.com/flutter/flutter/issues/163308#issuecomment-2676366371 +# It will be fixed in Flutter 3.29.1 +# Removing this triggers fetching the correct Flutter engine version +RUN cd ${FLUTTER_ROOT} && rm engine/src/.gn + +RUN yes | flutter doctor --android-licenses \ + && flutter doctor \ + && chown -R root:root ${FLUTTER_ROOT} + +RUN flutter precache --android COPY Applications/AdminUi /src WORKDIR /src From fd5a04b1eabe576d83d76f16600fc99f372f9fc0 Mon Sep 17 00:00:00 2001 From: Timo Notheisen Date: Thu, 6 Mar 2025 13:43:34 +0100 Subject: [PATCH 2/4] ci: add test build pipeline for arm --- .github/workflows/test.yml | 356 +++---------------------------------- 1 file changed, 20 insertions(+), 336 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fade5162ac..32754e36c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,346 +12,30 @@ concurrency: cancel-in-progress: true jobs: - adminui-checks: - runs-on: ubuntu-latest - name: Run Admin UI Checks - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Flutter - uses: subosito/flutter-action@v2.18.0 - - name: Run checks - run: ./.ci/aui/runChecks.sh - - check-formatting: - runs-on: ubuntu-latest - name: Check Formatting - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22.4.1 - cache: "npm" - cache-dependency-path: "**/package.json" - - name: Cache npm dependencies - uses: actions/cache@v4 - with: - path: ./runtime/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm- - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "9.x" - - name: Cache NuGet packages - uses: actions/cache@v4 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} - restore-keys: ${{ runner.os }}-nuget- - - name: Check formatting - run: ./.ci/checkFormatting.sh - - unit-test: - runs-on: ubuntu-latest - name: Run Unit Tests - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22.4.1 - cache: "npm" - cache-dependency-path: "**/package.json" - - name: Cache npm dependencies - uses: actions/cache@v4 - with: - path: ./runtime/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm- - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "9.x" - - name: Cache NuGet packages - uses: actions/cache@v4 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} - restore-keys: ${{ runner.os }}-nuget- - - name: Run tests - run: ./.ci/test.sh - env: - DOTNET_CONSOLE_ANSI_COLOR: true - - image-test-builds: - name: Build ${{matrix.image}} Image - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - dockerfile: Applications/ConsumerApi/src/Dockerfile - image: consumer-api - - - dockerfile: Applications/AdminApi/src/AdminApi/Dockerfile - image: admin-ui - - - dockerfile: Applications/AdminCli/src/AdminCli/Dockerfile - image: admin-cli - - - dockerfile: Applications/DatabaseMigrator/src/DatabaseMigrator/Dockerfile - image: database-migrator - - - dockerfile: Applications/EventHandlerService/src/EventHandlerService/Dockerfile - image: event-handler - - - dockerfile: Applications/IdentityDeletionJobs/src/Job.IdentityDeletion/Dockerfile - image: identity-deletion-jobs - - - dockerfile: Applications/SseServer/src/SseServer/Dockerfile - image: sse-server - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: 22.4.1 - cache: "npm" - cache-dependency-path: "**/package-lock.json" - - - name: Setup Docker - uses: docker/setup-buildx-action@v3 - with: - driver: docker-container - - - name: Setup NuGet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 9.x - - - name: Cache Image - uses: actions/cache@v4 - with: - path: /tmp/.buildx-${{ matrix.image }}-cache - key: buildx-${{ matrix.image }}-cache-${{ hashFiles(matrix.dockerfile) }} - restore-keys: buildx-${{ matrix.image }}-cache- - - - name: Build Image - uses: docker/build-push-action@v6 - env: - DOCKER_BUILD_SUMMARY: false - with: - context: . - file: ${{ matrix.dockerfile }} - cache-from: type=local,src=/tmp/.buildx-${{ matrix.image }}-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-${{ matrix.image }}-cache-new - outputs: type=docker,dest=/tmp/${{ matrix.image }}.tar - tags: ghcr.io/nmshd/backbone-${{ matrix.image }}:0.0.1 - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: docker-${{ matrix.image }} - path: /tmp/${{ matrix.image }}.tar - retention-days: 1 - - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move cache - run: | - rm -rf /tmp/.buildx-${{ matrix.image }}-cache - mv /tmp/.buildx-${{ matrix.image }}-cache-new /tmp/.buildx-${{ matrix.image }}-cache - - integration-test: - name: Run ${{matrix.test-project.display-name}} Integration Tests (on ${{matrix.database}}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - database: [sqlserver, postgres] - test-project: - - display-name: admin-api - path: Applications/AdminApi/test/AdminApi.Tests.Integration - - display-name: consumer-api - path: Applications/ConsumerApi/test/ConsumerApi.Tests.Integration - - display-name: identity-deletion-job - path: Applications/IdentityDeletionJobs/test/Job.IdentityDeletion.Tests.Integration - needs: image-test-builds - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: 22.4.1 - cache: "npm" - cache-dependency-path: "**/package-lock.json" - - - name: Setup NuGet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 9.x - - - name: Cache NuGet packages - uses: actions/cache@v4 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} - restore-keys: ${{ runner.os }}-nuget- - - - name: Download cached Docker images - uses: actions/download-artifact@v4 - with: - path: /tmp - pattern: docker-* - merge-multiple: true - - - name: Load Docker images and build test code - run: | - { - ./.ci/loadDockerImages.sh - } & - { - # The following two lines are for the identity deletion job only - mv appsettings.override.json appsettings.override.json.bak - cp .ci/appsettings.override.${{matrix.database}}.local.json appsettings.override.json - - dotnet restore ${{matrix.test-project.path}} - dotnet build --no-restore ${{matrix.test-project.path}} - } - wait - - - name: Start compose stack - run: | - docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml down -v - docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml up --no-build --wait -d - docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml wait admin-cli - - - name: Run integration tests - run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false;summary.includeSkippedTests=false;summary.includePassedTests=false" ${{matrix.test-project.path}} - env: - ADMIN_API_BASE_ADDRESS: "http://localhost:5173" - CONSUMER_API_BASE_ADDRESS: "http://localhost:5000" - - - name: Save Docker Logs - if: failure() - run: docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml logs > logs.txt - - - name: Archive logs - if: failure() - uses: actions/upload-artifact@v4 - with: - name: ${{matrix.test-project.display-name}}-${{matrix.database}} - path: logs.txt - - transport-test: - name: Run transport Tests (on ${{matrix.database}}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - database: [sqlserver, postgres] - needs: image-test-builds - steps: - - name: Checkout backbone repository - uses: actions/checkout@v4 - with: - path: backbone - - - name: Checkout runtime repository - uses: actions/checkout@v4 - with: - repository: nmshd/runtime - path: runtime - - - uses: actions/setup-node@v4 - with: - node-version: 22.4.1 - cache: "npm" - cache-dependency-path: "**/package-lock.json" - - - name: Download cached Docker images - uses: actions/download-artifact@v4 - with: - path: /tmp - pattern: docker-* - merge-multiple: true - - - name: Load Docker images - run: ./backbone/.ci/loadDockerImages.sh - - - name: Start compose stack - run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.${{matrix.database}}.yml up --no-build --wait -d - - - name: Install runtime dependencies - working-directory: ./runtime - run: npm ci - - - name: Build - run: npm run build:node - working-directory: ./runtime - - - name: Run transport Tests - working-directory: ./runtime/packages/transport - env: - NMSHD_TEST_BASEURL: http://localhost:5000 - NMSHD_TEST_CLIENTID: test - NMSHD_TEST_CLIENTSECRET: test - NMSHD_TEST_BASEURL_ADMIN_API: http://localhost:5173 - NMSHD_TEST_ADMIN_API_KEY: test - APPSETTINGS_OVERRIDE_LOCATION: ${{ github.workspace }}/backbone/.ci/appsettings.override.${{matrix.database}}.docker.json - BACKBONE_VERSION: 0.0.1 - run: npm run test:local:lokijs - - - name: Save Docker Logs - if: failure() - run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.${{matrix.database}}.yml logs > logs.txt - - - name: Archive logs - if: failure() - uses: actions/upload-artifact@v4 - with: - name: transport-test-${{matrix.database}}-docker-logs - path: logs.txt - - - name: Stop compose stack - run: docker compose -f ./backbone/.ci/compose.test.${{matrix.database}}.yml -f ./backbone/.ci/compose.test.yml down - - build-helm-chart: - name: Build Helm Chart + test-admin-ui: + name: Test Build of Admin UI Container Image runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install script dependencies run: npm install --prefix ./.ci - - name: Build Helm Chart - run: ./.ci/helm/buildChart.js - env: - VERSION: 0.0.0 - - validate-licenses: - name: Validate Open Source Licenses - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Dotnet - uses: actions/setup-dotnet@v4 + - name: Docker Login + uses: docker/login-action@v3.3.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub for accessing the cloud builder + uses: docker/login-action@v3 + with: + username: ${{ secrets.CLOUD_BUILDER_USERNAME }} + password: ${{ secrets.CLOUD_BUILDER_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 with: - dotnet-version: 9.x - - name: Install nuget-licenses tool - run: dotnet tool install --global nuget-license - - name: Show Allowed Licenses - run: cat ./.ci/allowedLicenses.json - - name: Show Ignored Packages - run: cat ./.ci/ignoredPackages.json - - name: Restore Solution - run: dotnet restore /p:ContinuousIntegrationBuild=true ./Backbone.sln - - name: Validate Licenses - run: nuget-license --input ./Backbone.sln --allowed-license-types ./.ci/allowedLicenses.json --ignored-packages ./.ci/ignoredPackages.json --output table --error-only + version: "lab:latest" + driver: cloud + endpoint: ${{ secrets.CLOUD_BUILDER_ENDPOINT }} + - name: Build and Push Container Image + run: docker buildx build --file ./Applications/AdminApi/src/AdminApi/Dockerfile --tag ghcr.io/nmshd/backbone-admin-ui:7.0.0 --platform linux/arm64 --build-arg VERSION=7.0.0 . From 031c8a00bce9d8fd41c1486ebe0dc517ee650bc2 Mon Sep 17 00:00:00 2001 From: Timo Notheisen Date: Thu, 6 Mar 2025 13:58:54 +0100 Subject: [PATCH 3/4] fix: use cirruslabs/flutter base image --- Applications/AdminApi/src/AdminApi/Dockerfile | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/Applications/AdminApi/src/AdminApi/Dockerfile b/Applications/AdminApi/src/AdminApi/Dockerfile index fd68048bec..e0f52621bc 100644 --- a/Applications/AdminApi/src/AdminApi/Dockerfile +++ b/Applications/AdminApi/src/AdminApi/Dockerfile @@ -102,26 +102,7 @@ RUN dotnet publish /p:ContinuousIntegrationBuild=true /p:UseAppHost=false --no-r RUN dotnet publish /p:ContinuousIntegrationBuild=true --configuration Release --output /app/publish/health "/src/Applications/HealthCheck/src/HealthCheck.csproj" #### Build Flutter Admin UI #### -FROM ghcr.io/cirruslabs/android-sdk:35 AS flutter-build-env - -USER root - -ENV FLUTTER_ROOT=${HOME}/sdks/flutter - -ENV PATH ${PATH}:${FLUTTER_ROOT}/bin:${FLUTTER_ROOT}/bin/cache/dart-sdk/bin - -RUN git clone --depth 1 --branch 3.29.0 https://github.com/flutter/flutter.git ${FLUTTER_ROOT} - -# Temporary workaround for https://github.com/flutter/flutter/issues/163308#issuecomment-2676366371 -# It will be fixed in Flutter 3.29.1 -# Removing this triggers fetching the correct Flutter engine version -RUN cd ${FLUTTER_ROOT} && rm engine/src/.gn - -RUN yes | flutter doctor --android-licenses \ - && flutter doctor \ - && chown -R root:root ${FLUTTER_ROOT} - -RUN flutter precache --android +FROM ghcr.io/cirruslabs/flutter:3.29.0 AS flutter-build-env COPY Applications/AdminUi /src WORKDIR /src From 8e9eb1d86fa41d6db078e6e522824f1bae693522 Mon Sep 17 00:00:00 2001 From: Timo Notheisen Date: Thu, 6 Mar 2025 13:59:13 +0100 Subject: [PATCH 4/4] Revert "ci: add test build pipeline for arm" This reverts commit fd5a04b1eabe576d83d76f16600fc99f372f9fc0. --- .github/workflows/test.yml | 356 ++++++++++++++++++++++++++++++++++--- 1 file changed, 336 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 32754e36c0..fade5162ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,30 +12,346 @@ concurrency: cancel-in-progress: true jobs: - test-admin-ui: - name: Test Build of Admin UI Container Image + adminui-checks: + runs-on: ubuntu-latest + name: Run Admin UI Checks + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Flutter + uses: subosito/flutter-action@v2.18.0 + - name: Run checks + run: ./.ci/aui/runChecks.sh + + check-formatting: + runs-on: ubuntu-latest + name: Check Formatting + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22.4.1 + cache: "npm" + cache-dependency-path: "**/package.json" + - name: Cache npm dependencies + uses: actions/cache@v4 + with: + path: ./runtime/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm- + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "9.x" + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: ${{ runner.os }}-nuget- + - name: Check formatting + run: ./.ci/checkFormatting.sh + + unit-test: + runs-on: ubuntu-latest + name: Run Unit Tests + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22.4.1 + cache: "npm" + cache-dependency-path: "**/package.json" + - name: Cache npm dependencies + uses: actions/cache@v4 + with: + path: ./runtime/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm- + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "9.x" + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: ${{ runner.os }}-nuget- + - name: Run tests + run: ./.ci/test.sh + env: + DOTNET_CONSOLE_ANSI_COLOR: true + + image-test-builds: + name: Build ${{matrix.image}} Image + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - dockerfile: Applications/ConsumerApi/src/Dockerfile + image: consumer-api + + - dockerfile: Applications/AdminApi/src/AdminApi/Dockerfile + image: admin-ui + + - dockerfile: Applications/AdminCli/src/AdminCli/Dockerfile + image: admin-cli + + - dockerfile: Applications/DatabaseMigrator/src/DatabaseMigrator/Dockerfile + image: database-migrator + + - dockerfile: Applications/EventHandlerService/src/EventHandlerService/Dockerfile + image: event-handler + + - dockerfile: Applications/IdentityDeletionJobs/src/Job.IdentityDeletion/Dockerfile + image: identity-deletion-jobs + + - dockerfile: Applications/SseServer/src/SseServer/Dockerfile + image: sse-server + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22.4.1 + cache: "npm" + cache-dependency-path: "**/package-lock.json" + + - name: Setup Docker + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + + - name: Setup NuGet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.x + + - name: Cache Image + uses: actions/cache@v4 + with: + path: /tmp/.buildx-${{ matrix.image }}-cache + key: buildx-${{ matrix.image }}-cache-${{ hashFiles(matrix.dockerfile) }} + restore-keys: buildx-${{ matrix.image }}-cache- + + - name: Build Image + uses: docker/build-push-action@v6 + env: + DOCKER_BUILD_SUMMARY: false + with: + context: . + file: ${{ matrix.dockerfile }} + cache-from: type=local,src=/tmp/.buildx-${{ matrix.image }}-cache + cache-to: type=local,mode=max,dest=/tmp/.buildx-${{ matrix.image }}-cache-new + outputs: type=docker,dest=/tmp/${{ matrix.image }}.tar + tags: ghcr.io/nmshd/backbone-${{ matrix.image }}:0.0.1 + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: docker-${{ matrix.image }} + path: /tmp/${{ matrix.image }}.tar + retention-days: 1 + + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Move cache + run: | + rm -rf /tmp/.buildx-${{ matrix.image }}-cache + mv /tmp/.buildx-${{ matrix.image }}-cache-new /tmp/.buildx-${{ matrix.image }}-cache + + integration-test: + name: Run ${{matrix.test-project.display-name}} Integration Tests (on ${{matrix.database}}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + database: [sqlserver, postgres] + test-project: + - display-name: admin-api + path: Applications/AdminApi/test/AdminApi.Tests.Integration + - display-name: consumer-api + path: Applications/ConsumerApi/test/ConsumerApi.Tests.Integration + - display-name: identity-deletion-job + path: Applications/IdentityDeletionJobs/test/Job.IdentityDeletion.Tests.Integration + needs: image-test-builds + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22.4.1 + cache: "npm" + cache-dependency-path: "**/package-lock.json" + + - name: Setup NuGet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.x + + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: ${{ runner.os }}-nuget- + + - name: Download cached Docker images + uses: actions/download-artifact@v4 + with: + path: /tmp + pattern: docker-* + merge-multiple: true + + - name: Load Docker images and build test code + run: | + { + ./.ci/loadDockerImages.sh + } & + { + # The following two lines are for the identity deletion job only + mv appsettings.override.json appsettings.override.json.bak + cp .ci/appsettings.override.${{matrix.database}}.local.json appsettings.override.json + + dotnet restore ${{matrix.test-project.path}} + dotnet build --no-restore ${{matrix.test-project.path}} + } + wait + + - name: Start compose stack + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml down -v + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml up --no-build --wait -d + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml wait admin-cli + + - name: Run integration tests + run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false;summary.includeSkippedTests=false;summary.includePassedTests=false" ${{matrix.test-project.path}} + env: + ADMIN_API_BASE_ADDRESS: "http://localhost:5173" + CONSUMER_API_BASE_ADDRESS: "http://localhost:5000" + + - name: Save Docker Logs + if: failure() + run: docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml logs > logs.txt + + - name: Archive logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{matrix.test-project.display-name}}-${{matrix.database}} + path: logs.txt + + transport-test: + name: Run transport Tests (on ${{matrix.database}}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + database: [sqlserver, postgres] + needs: image-test-builds + steps: + - name: Checkout backbone repository + uses: actions/checkout@v4 + with: + path: backbone + + - name: Checkout runtime repository + uses: actions/checkout@v4 + with: + repository: nmshd/runtime + path: runtime + + - uses: actions/setup-node@v4 + with: + node-version: 22.4.1 + cache: "npm" + cache-dependency-path: "**/package-lock.json" + + - name: Download cached Docker images + uses: actions/download-artifact@v4 + with: + path: /tmp + pattern: docker-* + merge-multiple: true + + - name: Load Docker images + run: ./backbone/.ci/loadDockerImages.sh + + - name: Start compose stack + run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.${{matrix.database}}.yml up --no-build --wait -d + + - name: Install runtime dependencies + working-directory: ./runtime + run: npm ci + + - name: Build + run: npm run build:node + working-directory: ./runtime + + - name: Run transport Tests + working-directory: ./runtime/packages/transport + env: + NMSHD_TEST_BASEURL: http://localhost:5000 + NMSHD_TEST_CLIENTID: test + NMSHD_TEST_CLIENTSECRET: test + NMSHD_TEST_BASEURL_ADMIN_API: http://localhost:5173 + NMSHD_TEST_ADMIN_API_KEY: test + APPSETTINGS_OVERRIDE_LOCATION: ${{ github.workspace }}/backbone/.ci/appsettings.override.${{matrix.database}}.docker.json + BACKBONE_VERSION: 0.0.1 + run: npm run test:local:lokijs + + - name: Save Docker Logs + if: failure() + run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.${{matrix.database}}.yml logs > logs.txt + + - name: Archive logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: transport-test-${{matrix.database}}-docker-logs + path: logs.txt + + - name: Stop compose stack + run: docker compose -f ./backbone/.ci/compose.test.${{matrix.database}}.yml -f ./backbone/.ci/compose.test.yml down + + build-helm-chart: + name: Build Helm Chart runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install script dependencies run: npm install --prefix ./.ci - - name: Docker Login - uses: docker/login-action@v3.3.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Log in to Docker Hub for accessing the cloud builder - uses: docker/login-action@v3 - with: - username: ${{ secrets.CLOUD_BUILDER_USERNAME }} - password: ${{ secrets.CLOUD_BUILDER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Build Helm Chart + run: ./.ci/helm/buildChart.js + env: + VERSION: 0.0.0 + + validate-licenses: + name: Validate Open Source Licenses + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Dotnet + uses: actions/setup-dotnet@v4 with: - version: "lab:latest" - driver: cloud - endpoint: ${{ secrets.CLOUD_BUILDER_ENDPOINT }} - - name: Build and Push Container Image - run: docker buildx build --file ./Applications/AdminApi/src/AdminApi/Dockerfile --tag ghcr.io/nmshd/backbone-admin-ui:7.0.0 --platform linux/arm64 --build-arg VERSION=7.0.0 . + dotnet-version: 9.x + - name: Install nuget-licenses tool + run: dotnet tool install --global nuget-license + - name: Show Allowed Licenses + run: cat ./.ci/allowedLicenses.json + - name: Show Ignored Packages + run: cat ./.ci/ignoredPackages.json + - name: Restore Solution + run: dotnet restore /p:ContinuousIntegrationBuild=true ./Backbone.sln + - name: Validate Licenses + run: nuget-license --input ./Backbone.sln --allowed-license-types ./.ci/allowedLicenses.json --ignored-packages ./.ci/ignoredPackages.json --output table --error-only