-
Notifications
You must be signed in to change notification settings - Fork 3
248 lines (208 loc) · 7.8 KB
/
gradle.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
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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
permissions:
contents: read
actions: read
checks: write
security-events: write
jobs:
build:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Xmx1024m"
services:
postgres:
image: postgres
env:
POSTGRES_USER: sandbox
POSTGRES_DB: sandbox
POSTGRES_PASSWORD: sandbox
options: >-
--health-cmd pg_isready
--health-interval 1s
--health-timeout 5s
--health-retries 50
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: true
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
- name: Core gradle info
run: |
./gradlew -v
./gradlew jvmArgs sysProps
- name: Mdm-core grails info
working-directory: ./mdm-core
run: |
./grailsw -v
- name: License header check
run: |
./gradlew license
- name: Flyway migration check
run: |
./gradlew verifyFlywayMigrationVersions
- name: Unit Tests
run: ./gradlew test --no-daemon --stacktrace -Duser.language=en -Duser.country=GB
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit Test Results
path: '**/build/test-results/**/*.xml'
reporter: java-junit
list-tests: 'failed'
- name: Parallel Integration Tests
run: |
./gradlew -Dgradle.integrationTest=true -Dgradle.parallel=true \
mdm-core:integrationTest \
mdm-plugin-authentication-apikey:integrationTest \
mdm-plugin-authentication-basic:integrationTest \
mdm-plugin-dataflow:integrationTest \
mdm-plugin-datamodel:integrationTest \
mdm-plugin-email-proxy:integrationTest \
mdm-plugin-federation:integrationTest \
mdm-plugin-profile:integrationTest \
mdm-plugin-referencedata:integrationTest \
mdm-plugin-terminology:integrationTest
# mdm-plugin-security:integrationTest // Is commented out in Jenkins - not sure why
- name: Parallel Integration Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Parallel Integration Test Results
path: '**/build/test-results/parallelIntegrationTest/*.xml'
reporter: java-junit
list-tests: 'failed'
- name: Non-Parallel Integration Tests
run: |
./gradlew -Dgradle.integrationTest=true -Dgradle.nonParallel=true \
mdm-core:integrationTest \
mdm-plugin-authentication-apikey:integrationTest \
mdm-plugin-authentication-basic:integrationTest \
mdm-plugin-dataflow:integrationTest \
mdm-plugin-datamodel:integrationTest \
mdm-plugin-email-proxy:integrationTest \
mdm-plugin-federation:integrationTest \
mdm-plugin-profile:integrationTest \
mdm-plugin-referencedata:integrationTest \
mdm-plugin-terminology:integrationTest \
mdm-security:integrationTest
- name: Non-Parallel Integration Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Non-Parallel Integration Test Results
path: '**/build/test-results/nonParallelIntegrationTest/*.xml'
reporter: java-junit
list-tests: 'failed'
- name: End-to-end testing - core
uses: ./.github/actions/e2e-composite
with:
package: core
- name: End-to-end testing - security
uses: ./.github/actions/e2e-composite
with:
package: security
- name: End-to-end testing - authentication
uses: ./.github/actions/e2e-composite
with:
package: authentication
- name: End-to-end testing - datamodel
uses: ./.github/actions/e2e-composite
with:
package: datamodel
- name: End-to-end testing - terminology
uses: ./.github/actions/e2e-composite
with:
package: terminology
- name: End-to-end testing - referencedata
uses: ./.github/actions/e2e-composite
with:
package: referencedata
- name: End-to-end testing - profile
uses: ./.github/actions/e2e-composite
with:
package: profile
- name: End-to-end testing - dataflow
uses: ./.github/actions/e2e-composite
with:
package: dataflow
- name: End-to-end testing - federation
uses: ./.github/actions/e2e-composite
with:
package: federation
- name: End-to-end testing - facet
uses: ./.github/actions/e2e-composite
with:
package: facet
- name: End-to-end testing - versionedfolder
uses: ./.github/actions/e2e-composite
with:
package: versionedfolder
# - name: Archive test report
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: test-report
# path: '**/build/test-results/**/*.xml'
- name: MegaLinter
uses: oxsecurity/megalinter/flavors/ci_light@v7
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: true
ENABLE_LINTERS: GROOVY_NPM_GROOVY_LINT
LINTER_RULES_PATH: 'config/codenarc'
DISABLE_ERRORS: true #Flag to have the linter complete with exit code 0 even if errors were detected.
SARIF_REPORTER: true
# This is currently too big for the security tab
# - name: Upload MegaLinter scan results to GitHub Security tab
# if: success() || failure()
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: 'megalinter-reports/megalinter-report.sarif'
# Upload MegaLinter artifacts
# - name: Archive lint reports
# if: ${{ success() }} || ${{ failure() }}
# uses: actions/upload-artifact@v3
# with:
# name: MegaLinter reports
# path: |
# megalinter-reports
# mega-linter.log
- name: Publish Snapshot to Mauro Snapshot Repository
if: success() && github.ref == 'refs/heads/develop'
run: |
./gradlew --stacktrace -PMauroSnapshotRepositoryUsername=${{secrets.MAURO_SNAPSHOT_REPOSITORY_USERNAME}} -PMauroSnapshotRepositoryPassword=${{secrets.MAURO_SNAPSHOT_REPOSITORY_PASSWORD}} publishAllPublicationsToMauroSnapshotRepositoryRepository
- name: Send a stream message
if: success() || failure()
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: "[email protected]"
organization-url: "https://maurodatamapper.zulipchat.com"
to: "build/github-actions"
type: "stream"
topic: "${{github.repository}}"
content: "${{ job.status == 'success' && ':check_mark:' || ':cross_mark:' }} ${{github.repository}} : **${{github.ref}}**\nGitHub Actions build result: **${{ job.status }}**\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"