Merge branch 'main' into nmshdb-124-extension-of-the-audit-log #5678
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches-ignore: | |
- "main" | |
tags-ignore: | |
- "**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
run-adminUi-checks: | |
runs-on: ubuntu-latest | |
name: Run Admin UI Checks | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Checks | |
run: ./.ci/aui/runChecks.sh | |
run-adminUi-flutter-checks: | |
runs-on: ubuntu-latest | |
name: Run Admin UI Flutter Checks | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/[email protected] | |
- name: Run checks | |
run: ./.ci/aui/runFlutterChecks.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: latest | |
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: "8.0.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: latest | |
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: "8.0.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: | |
matrix: | |
include: | |
- dockerfile: ConsumerApi/Dockerfile | |
image: consumer-api | |
- dockerfile: AdminApi/src/AdminApi/Dockerfile | |
image: admin-ui | |
- dockerfile: Modules/Devices/src/Devices.AdminCli/Dockerfile | |
image: admin-cli | |
- dockerfile: DatabaseMigrator/Dockerfile | |
image: database-migrator | |
- dockerfile: EventHandlerService/src/EventHandlerService/Dockerfile | |
image: event-handler-service | |
- dockerfile: Modules/Files/src/Files.Jobs.SanityCheck/Dockerfile | |
image: files-sanity-check | |
- dockerfile: Jobs/src/Job.IdentityDeletion/Dockerfile | |
image: identity-deletion-jobs | |
- dockerfile: SseServer/src/SseServer/Dockerfile | |
image: sse-server | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
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: 8.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: ${{ 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.path}} on ${{matrix.database}} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
database: [sqlserver, postgres] | |
test-project: | |
- display-name: AdminApi | |
path: AdminApi/test/AdminApi.Tests.Integration | |
additional-compose-files: -f ./.ci/compose.test.aui.yml | |
# - ConsumerApi.Tests.Integration | |
# - Job.IdentityDeletion.Tests.Integration | |
needs: image-test-builds | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Setup NuGet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.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 | |
} & | |
{ | |
dotnet restore Backbone.sln | |
mv Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json ./Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json.bak | |
cp .ci/appsettings.override.${{matrix.database}}.local.json Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json | |
dotnet build --no-restore Backbone.sln | |
} | |
wait | |
- name: Start compose stack | |
run: | | |
docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml ${{matrix.test-project.additional-compose-files}} down -v | |
docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml ${{matrix.test-project.additional-compose-files}} up --no-build --wait -d | |
- name: Run integration tests | |
run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" ${{matrix.test-project.name}} | |
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 ${{matrix.test-project.additional-compose-files}} 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-sqlserver: | |
name: Run transport Tests (on SQL Server) | |
runs-on: ubuntu-latest | |
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 | |
ref: release/v5 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
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.sqlserver.yml -f ./backbone/.ci/compose.test.capi.yml up --no-build --wait -d | |
- name: Install runtime dependencies | |
working-directory: ./runtime | |
run: npm install | |
- 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 | |
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.sqlserver.yml -f ./backbone/.ci/compose.test.capi.yml logs > docker-log.txt | |
- name: Archive logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: transport-test-sqlserver-docker-logs | |
path: docker-log.txt | |
- name: Stop compose stack | |
run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.sqlserver.yml -f ./backbone/.ci/compose.test.capi.yml down | |
transport-test-postgres: | |
name: Run transport Tests (on Postgres) | |
runs-on: ubuntu-latest | |
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 | |
ref: release/v5 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
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: Run compose stack | |
run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.postgres.yml -f ./backbone/.ci/compose.test.capi.yml up --no-build --wait -d | |
- name: Install runtime dependencies | |
working-directory: ./runtime | |
run: npm install | |
- 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 | |
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.postgres.yml -f ./backbone/.ci/compose.test.capi.yml logs > docker-log.txt | |
- name: Archive logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: transport-test-postgres-docker-logs | |
path: docker-log.txt | |
- name: Stop compose stack | |
run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.postgres.yml -f ./backbone/.ci/compose.test.capi.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: Build Helm Chart | |
run: ./.ci/helm/buildChart.js | |
env: | |
VERSION: 0.0.0 |