generated from BRP-API/brp-shared
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (152 loc) · 5.79 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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 }}