-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (159 loc) · 5.54 KB
/
build.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
name: "Build and Test"
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
matrix_build:
name: "Matrix Build"
runs-on:
- ubuntu-latest
strategy:
fail-fast: false
max-parallel: 100
matrix:
spring_boot_version:
- 3.1.6
- 3.0.13
- 2.7.18
env:
SPRING_BOOT_VERSION: ${{ matrix.spring_boot_version }}
GRADLE_OPTS: "-Djava.security.egd=file:/dev/./urandom -Dorg.gradle.parallel=true"
IN_CI: true
MARIADB_TCP_3306: 3306
MARIADB_TCP_HOST: mysql1
TW_TKMS_KAFKA_TCP_9092: 9092
TW_TKMS_KAFKA_TCP_HOST: kafka1
ZOOKEEPER_TCP_2181: 2181
ZOOKEEPER_TCP_HOST: zookeeper1
POSTGRES_TCP_HOST: postgres1
POSTGRES_TCP_5432: 5432
container:
image: azul/zulu-openjdk:17
services:
mysql1:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: example-password-change-me
MYSQL_DATABASE: tkms
postgres1:
image: transferwiseworkspace/postgres12
env:
POSTGRES_PASSWORD: example-password-change-me
zookeeper1:
image: bitnami/zookeeper:3.7.1
env:
ALLOW_ANONYMOUS_LOGIN: "yes"
JVMFLAGS: "-Xmx512m -Xms64m"
kafka1:
image: wurstmeister/kafka:2.12-2.2.0
env:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181
KAFKA_LISTENERS: PLAINTEXT://:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_MESSAGE_MAX_BYTES: "10485760"
KAFKA_ZOOKEEPER_SESSION_TIMEOUT_MS: 20000
KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE: "true"
KAFKA_LEADER_IMBALANCE_CHECK_INTERVAL_SECONDS: 5
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
steps:
- name: "Install packages"
# We do some changes as the main ubuntu repo is currently very slow.
run: |
apt-get update && apt-get install -y git unzip
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.5
gradle-home-cache-cleanup: true
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test.
# cache-read-only: false
- name: "Assemble jar"
uses: gradle/gradle-build-action@v2
with:
arguments: assemble --console=plain --info --stacktrace --parallel
- name: "Compile tests"
uses: gradle/gradle-build-action@v2
with:
arguments: compileTest --console=plain --info --stacktrace --parallel
- name: "Run checks"
uses: gradle/gradle-build-action@v2
with:
arguments: check -x test --console=plain --stacktrace
- name: "Run tests"
uses: gradle/gradle-build-action@v2
with:
arguments: -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace
- name: "Test if publishing works"
uses: gradle/gradle-build-action@v2
with:
arguments: publishToMavenLocal --console=plain --info --stacktrace
- name: "Publish Test Report"
uses: mikepenz/action-junit-report@v3
if: always()
with:
check_name: Test Report-(${{ matrix.spring_boot_version }})
report_paths: '**/build/test-results/**/*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}
require_tests: true
- name: Publish checkstyle report
if: always()
uses: jwgmeligmeyling/checkstyle-github-action@master
with:
name: Checkstyle Report-(${{ matrix.spring_boot_version }})
path: '**/build/reports/**/*.xml'
- name: Publish spotbugs report
if: always()
uses: jwgmeligmeyling/spotbugs-github-action@master
with:
name: Spotbugs Report-(${{ matrix.spring_boot_version }})
path: '**/build/reports/**/*.xml'
- name: "Collect test reports"
run: |
tar -zcvf all-test-reports-${{ matrix.spring_boot_version }}.tar.gz **/build/reports
if: always()
- name: "Store test results"
uses: actions/upload-artifact@v3
if: always()
with:
name: all-test-reports-${{ matrix.spring_boot_version }}
path: all-test-reports-${{ matrix.spring_boot_version }}.tar.gz
retention-days: 7
build:
name: "Build and Test"
runs-on:
- ubuntu-latest
needs: matrix_build
container:
image: azul/zulu-openjdk:17
steps:
# Needed hacks to properly fail the build when one matrix build fails.
- name: Do something so that GHA is happy
run: echo "Be happy!"
- name: Verify matrix jobs succeeded
if: ${{ needs.matrix_build.result != 'success' }}
run: exit 1
- name: "Install packages"
# We do some changes as the main ubuntu repo is currently very slow.
run: |
apt-get update && apt-get install -y git unzip
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.5
gradle-home-cache-cleanup: true
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test.
# cache-read-only: false
- name: "Tag release"
if: github.ref == 'refs/heads/master'
uses: gradle/gradle-build-action@v2
with:
arguments: tagRelease --console=plain --info --stacktrace