Skip to content

ci: fix compiler error #8426

ci: fix compiler error

ci: fix compiler error #8426

Workflow file for this run

name: Test
on:
push:
branches-ignore:
- "main"
tags-ignore:
- "**"
jobs:
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: 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
- 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: always()
run: docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.${{matrix.database}}.yml logs > logs.txt
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{matrix.test-project.display-name}}-${{matrix.database}}
path: logs.txt