Skip to content

Merge pull request #34 from BRP-API/chore/sync-met-source-repo_e0b796a #41

Merge pull request #34 from BRP-API/chore/sync-met-source-repo_e0b796a

Merge pull request #34 from BRP-API/chore/sync-met-source-repo_e0b796a #41

Workflow file for this run

name: continuous integration
on:
push:
paths:
- src/**
- features/**
- .github/workflows/ci.yml
workflow_dispatch:
inputs:
publishType:
description: wat moet worden gereleased?
required: true
default: 'ci-only'
type: choice
options:
- ci-only
- app
- mock
env:
NODE_VERSION: '20'
DOTNET_SOLUTION_FILE_PATH: src/BewoningInformatieService.sln
APP_PROJECT_PATH: ./src/Bewoning.Informatie.Service
APP_CSPROJ_FILE_PATH: ./src/Bewoning.Informatie.Service/Bewoning.Informatie.Service.csproj
APP_CONTAINER_IMAGE: ghcr.io/brp-api/bewoning-informatie-service
MOCK_PROJECT_PATH: ./src/Bewoning.Data.Mock
MOCK_CSPROJ_FILE_PATH: ./src/Bewoning.Data.Mock/Bewoning.Data.Mock.csproj
MOCK_CONTAINER_IMAGE: ghcr.io/brp-api/bewoning-service-mock
jobs:
continuous-integration:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Genereer build run identifier
id: build-run-id
uses: ./.github/actions/genereer-build-run-identifier
- name: Zet versie met build run in App csproj
uses: ./.github/actions/zet-versie-met-build-run-in-csproj
id: app-version
with:
path-csproj-file: ${{ env.APP_CSPROJ_FILE_PATH }}
build-run: ${{ steps.build-run-id.outputs.build-run }}
- name: Zet versie met build run in mock csproj
uses: ./.github/actions/zet-versie-met-build-run-in-csproj
id: mock-version
with:
path-csproj-file: ${{ env.MOCK_CSPROJ_FILE_PATH }}
build-run: ${{ steps.build-run-id.outputs.build-run }}
- name: Bepaal gewijzigd project
uses: dorny/paths-filter@v3
id: changed-project
with:
filters: |
app:
- '${{ env.APP_PROJECT_PATH }}/**'
mock:
- '${{ env.MOCK_PROJECT_PATH }}/**'
- name: Valideer .NET solution
uses: ./.github/actions/valideer-dotnet-solution
with:
path-solution-file: ${{ env.DOTNET_SOLUTION_FILE_PATH }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm ci
- name: Zet run permissions op script folder
uses: ./.github/actions/zet-run-bash-scripts-permission
with:
path-bash-file-or-folder: ./scripts/*
- name: Build container images
run: |
./scripts/containers-build.sh
- name: Start containers
run: |
./scripts/containers-start.sh ci
- name: Wait for DB restart
run: sleep 5s
shell: bash
- name: Run unit tests
run: |
./scripts/unit-tests-verify.sh
- name: Valideer functionele specs
run: |
./scripts/specs-verify.sh
- name: Stop containers
if: always()
run: |
./scripts/containers-stop.sh ci
- name: Genereer test rapportage
if: always()
run: |
node ./scripts/generate-cucumber-reports.js ${{ steps.app-version.outputs.version }} ${{ steps.build-run-id.outputs.build-run }} ${{ github.ref_name }}
- name: Upload test rapportage
if: always()
uses: actions/upload-artifact@v4
with:
name: Reports
path: |
test-reports
test-data/logs
- name: Push test rapportage naar brp-api.github.io repo
if: always()
uses: tech-thinker/push-to-repo@main
env:
API_TOKEN_GITHUB: ${{ secrets.GIT_PAT_TOKEN }}
with:
source-directory: test-reports/cucumber-js/reports
destination-repository-name: brp-api.github.io
destination-github-username: BRP-API
target-branch: test-reports/bewoning
commit-message: "test rapporten van build: ${{ steps.build-run-id.outputs.build-run }}"
- name: Login to GitHub Container Registry
if: always()
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configureer container image builder voor multi-platform
if: always()
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
driver: docker-container
- name: Build & push app container images naar registry
if: always() && (steps.changed-project.outputs.app == 'true' || inputs.publishType == 'app')
uses: docker/build-push-action@v6
with:
file: ${{ env.APP_PROJECT_PATH }}/Dockerfile
context: src
push: true
platforms: linux/arm64,linux/amd64
tags: |
${{ env.APP_CONTAINER_IMAGE }}:latest
${{ env.APP_CONTAINER_IMAGE }}:${{ steps.app-version.outputs.version }}-latest
${{ env.APP_CONTAINER_IMAGE }}:${{ steps.app-version.outputs.version }}-${{ steps.build-run-id.outputs.build-run }}
${{ env.APP_CONTAINER_IMAGE }}:${{ github.sha }}
- name: Build & push mock container images naar registry
if: always() && (steps.changed-project.outputs.mock == 'true' || inputs.publishType == 'mock')
uses: docker/build-push-action@v6
with:
file: ${{ env.MOCK_PROJECT_PATH }}/Dockerfile
context: src
push: true
platforms: linux/arm64,linux/amd64
tags: |
${{ env.MOCK_CONTAINER_IMAGE }}:latest
${{ env.MOCK_CONTAINER_IMAGE }}:${{ steps.mock-version.outputs.version }}-latest
${{ env.MOCK_CONTAINER_IMAGE }}:${{ steps.mock-version.outputs.version }}-${{ steps.build-run-id.outputs.build-run }}
${{ env.MOCK_CONTAINER_IMAGE }}:${{ github.workflow_sha }}