forked from boschresearch/catena-x-edc
-
Notifications
You must be signed in to change notification settings - Fork 0
252 lines (245 loc) · 7.48 KB
/
build.yaml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
name: "Build"
on:
push:
branches:
- main
- develop
tags:
- '[0-9]+.[0-9]+.[0-9]+'
release:
types:
- published
pull_request:
paths-ignore:
- 'charts/**'
- 'docs/**'
- '**/*.md'
branches:
- '*'
workflow_dispatch:
jobs:
secret-presence:
runs-on: ubuntu-latest
outputs:
CXNG_GHCR_PAT: ${{ steps.secret-presence.outputs.CXNG_GHCR_PAT }}
SONAR_TOKEN: ${{ steps.secret-presence.outputs.SONAR_TOKEN }}
steps:
-
name: Check whether secrets exist
id: secret-presence
run: |
[ ! -z "${{ secrets.CXNG_GHCR_PAT }}" ] && echo "::set-output name=CXNG_GHCR_PAT::true"
[ ! -z "${{ secrets.SONAR_TOKEN }}" ] && echo "::set-output name=SONAR_TOKEN::true"
exit 0
verify-formatting:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
-
name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
-
name: Verify proper formatting
run: ./mvnw -s settings.xml -B spotless:check
sonar:
needs: [ secret-presence, verify-formatting ]
if: |
needs.secret-presence.outputs.SONAR_TOKEN
runs-on: ubuntu-latest
steps:
# Set-Up
-
name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
-
name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
-
name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# Analyse
-
name: Build with Maven and analyze with Sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |-
./mvnw -s settings.xml -B clean verify sonar:sonar \
-Pcoverage,failsafe \
-Dsonar.projectKey=${GITHUB_REPOSITORY_OWNER}_product-edc \
-Dsonar.organization=${GITHUB_REPOSITORY_OWNER} \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.coverage.jacoco.xmlReportPaths=${GITHUB_WORKSPACE}/edc-tests/target/site/jacoco-aggregate/jacoco.xml \
-Dsonar.verbose=true
build-extensions:
runs-on: ubuntu-latest
needs: [ secret-presence, verify-formatting ]
steps:
# Set-Up
-
name: Checkout
uses: actions/[email protected]
-
name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
# Build
-
name: Build Extensions
run: |-
./mvnw -s settings.xml -B -f edc-extensions -am package
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
build-controlplane:
runs-on: ubuntu-latest
needs: [ secret-presence, verify-formatting ]
strategy:
fail-fast: false
matrix:
name:
- edc-controlplane-memory
- edc-controlplane-memory-hashicorp-vault
- edc-controlplane-postgresql
- edc-controlplane-postgresql-hashicorp-vault
steps:
# Set-Up
-
name: Checkout
uses: actions/[email protected]
-
name: Login to GitHub Container Registry
if: |
needs.secret-presence.outputs.CXNG_GHCR_PAT && github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CXNG_GHCR_PAT }}
-
name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
# Build
-
name: Build Controlplane
run: |-
./mvnw -s settings.xml -B -pl .,edc-controlplane/${{ matrix.name }} -am package
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
-
name: edc-controlplane Docker Metadata
id: edc_controlplane_meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{raw}}
type=match,pattern=\d.\d.\d
type=sha
-
name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
file: edc-controlplane/${{ matrix.name }}/src/main/docker/Dockerfile
build-args: |
JAR=edc-controlplane/${{ matrix.name }}/target/${{ matrix.name }}.jar
LIB=edc-controlplane/${{ matrix.name }}/target/lib
push: |
${{ (needs.secret-presence.outputs.CXNG_GHCR_PAT && github.event_name != 'pull_request' && 'true') || 'false' }}
tags: ${{ steps.edc_controlplane_meta.outputs.tags }}
labels: ${{ steps.edc_controlplane_meta.outputs.labels }}
build-dataplane:
runs-on: ubuntu-latest
needs: [ secret-presence, verify-formatting ]
strategy:
fail-fast: false
matrix:
name:
- edc-dataplane-azure-vault
- edc-dataplane-hashicorp-vault
steps:
# Set-Up
-
name: Checkout
uses: actions/[email protected]
-
name: Login to GitHub Container Registry
if: |
needs.secret-presence.outputs.CXNG_GHCR_PAT && github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CXNG_GHCR_PAT }}
-
name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
# Build
-
name: Build Dataplane
run: |-
./mvnw -s settings.xml -B -pl .,edc-dataplane/${{ matrix.name }} -am package
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
-
name: edc-dataplane Docker Metadata
id: edc_dataplane_meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{raw}}
type=match,pattern=\d.\d.\d
type=sha
-
name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
file: edc-dataplane/${{ matrix.name }}/src/main/docker/Dockerfile
build-args: |
JAR=edc-dataplane/${{ matrix.name }}/target/${{ matrix.name }}.jar
LIB=edc-dataplane/${{ matrix.name }}/target/lib
push: |
${{ (needs.secret-presence.outputs.CXNG_GHCR_PAT && github.event_name != 'pull_request' && 'true') || 'false' }}
tags: ${{ steps.edc_dataplane_meta.outputs.tags }}
labels: ${{ steps.edc_dataplane_meta.outputs.labels }}