-
Notifications
You must be signed in to change notification settings - Fork 82
196 lines (163 loc) · 7.13 KB
/
build-pr.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
name: Build PR
on:
workflow_dispatch:
pull_request:
env:
test_container_name_oss: hazelcast-oss-test
test_container_name_ee: hazelcast-ee-test
docker_log_file_oss: docker-hazelcast-oss-test.log
docker_log_file_ee: docker-hazelcast-ee-test.log
jobs:
prepare:
runs-on: ubuntu-latest
name: Prepare environment
outputs:
HZ_VERSION_OSS: ${{ steps.get_oss_vars.outputs.HZ_VERSION_OSS }}
HZ_VERSION_EE: ${{ steps.get_ee_vars.outputs.HZ_VERSION_EE }}
HAZELCAST_EE_ZIP_URL: ${{ steps.get_ee_vars.outputs.HAZELCAST_EE_ZIP_URL }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Forbid .github/release_type file
run: |
if [ -f ".github/release_type" ]; then
echo "Error: .github/release_type file is not allowed in the PRs. It's used only during release creation"
exit 1
fi
- name: Test scripts
run: |
.github/scripts/test_scripts.sh
- name: Setup OSS variables
id: get_oss_vars
run: |
HZ_VERSION_OSS=$(awk -F '=' '/^ARG HZ_VERSION=/ {print $2}' hazelcast-oss/Dockerfile)
echo "HZ_VERSION_OSS=$HZ_VERSION_OSS" >> $GITHUB_OUTPUT
- name: Setup EE variables
id: get_ee_vars
run: |
HZ_VERSION_EE=$(awk -F '=' '/^ARG HZ_VERSION=/ {print $2}' hazelcast-enterprise/Dockerfile)
. .github/scripts/ee-build.functions.sh
echo "HZ_VERSION_EE=$HZ_VERSION_EE" >> $GITHUB_OUTPUT
echo "HAZELCAST_EE_ZIP_URL=$(get_hz_dist_zip "" ${HZ_VERSION_EE})" >> $GITHUB_OUTPUT
build-pr:
runs-on: ubuntu-latest
name: Build with default JDK
needs: [ prepare ]
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Build OSS image
run: |
DOCKER_PATH=hazelcast-oss
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_OSS }}"
# duplicated block as GH doesn't support passing sensitive data between jobs
. .github/scripts/oss-build.functions.sh
export HZ_SNAPSHOT_INTERNAL_PASSWORD=${{ secrets.HZ_SNAPSHOT_INTERNAL_PASSWORD }}
export HZ_SNAPSHOT_INTERNAL_USERNAME=${{ secrets.HZ_SNAPSHOT_INTERNAL_USERNAME }}
HAZELCAST_OSS_ZIP_URL=$(get_hz_dist_zip "" "${HZ_VERSION}")
curl --fail --silent --show-error --location "$HAZELCAST_OSS_ZIP_URL" --output $DOCKER_PATH/hazelcast-distribution.zip;
docker buildx build --load \
--build-arg HZ_VERSION=${HZ_VERSION} \
--tag hazelcast-oss:test \
${DOCKER_PATH}
- name: Run smoke test against OSS image
timeout-minutes: 2
run: |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }}
- name: Build Test EE image
run: |
DOCKER_PATH=hazelcast-enterprise
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_EE }}"
curl --fail --silent --show-error --location "${{ needs.prepare.outputs.HAZELCAST_EE_ZIP_URL }}" --output $DOCKER_PATH/hazelcast-enterprise-distribution.zip;
docker buildx build --load \
--build-arg HZ_VERSION=${HZ_VERSION} \
--tag hazelcast-ee:test \
${DOCKER_PATH}
- name: Run smoke test against EE image
timeout-minutes: 2
run: |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }}
- name: Get docker logs
if: ${{ always() }}
run: |
docker logs ${{ env.test_container_name_oss }} > ${{ env.docker_log_file_oss }}
docker logs ${{ env.test_container_name_ee }} > ${{ env.docker_log_file_ee }}
- name: Store docker logs as artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: docker-logs
path: |
${{ env.docker_log_file_oss }}
${{ env.docker_log_file_ee }}
jdks:
uses: ./.github/workflows/get-supported-jdks.yaml
build-pr-custom-jdk:
runs-on: ubuntu-latest
needs: [ jdks, prepare ]
name: Build with jdk-${{ matrix.jdk }}
strategy:
fail-fast: false
matrix:
jdk: ${{ fromJSON(needs.jdks.outputs.jdks) }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Build OSS image
run: |
DOCKER_PATH=hazelcast-oss
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_OSS }}"
# duplicated block as GH doesn't support passing sensitive data between jobs
. .github/scripts/oss-build.functions.sh
export HZ_SNAPSHOT_INTERNAL_PASSWORD=${{ secrets.HZ_SNAPSHOT_INTERNAL_PASSWORD }}
export HZ_SNAPSHOT_INTERNAL_USERNAME=${{ secrets.HZ_SNAPSHOT_INTERNAL_USERNAME }}
HAZELCAST_OSS_ZIP_URL=$(get_hz_dist_zip "" "${HZ_VERSION}")
curl --fail --silent --show-error --location "$HAZELCAST_OSS_ZIP_URL" --output $DOCKER_PATH/hazelcast-distribution.zip;
docker buildx build --load \
--build-arg JDK_VERSION=${{ matrix.jdk }} \
--build-arg HZ_VERSION=${HZ_VERSION} \
--tag hazelcast-oss:test \
${DOCKER_PATH}
- name: Run smoke test against OSS image
timeout-minutes: 2
run: |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }}
- name: Build Test EE image
run: |
DOCKER_PATH=hazelcast-enterprise
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_EE }}"
curl --fail --silent --show-error --location "${{ needs.prepare.outputs.HAZELCAST_EE_ZIP_URL }}" --output $DOCKER_PATH/hazelcast-enterprise-distribution.zip;
docker buildx build --load \
--build-arg JDK_VERSION=${{ matrix.jdk }} \
--build-arg HZ_VERSION=${HZ_VERSION} \
--tag hazelcast-ee:test \
${DOCKER_PATH}
- name: Run smoke test against EE image
timeout-minutes: 2
run: |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }}
- name: Get docker logs
if: ${{ always() }}
run: |
docker logs ${{ env.test_container_name_oss }} > ${{ env.docker_log_file_oss }}
docker logs ${{ env.test_container_name_ee }} > ${{ env.docker_log_file_ee }}
- name: Store docker logs as artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: docker-logs-jdk${{ matrix.jdk }}
path: |
${{ env.docker_log_file_oss }}
${{ env.docker_log_file_ee }}