-
Notifications
You must be signed in to change notification settings - Fork 2
274 lines (229 loc) · 9.43 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
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: Build
on:
push:
paths-ignore:
- README.md
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }}
cancel-in-progress: true
jobs:
configure:
runs-on: ubuntu-latest
outputs:
matrix_rpms: ${{ steps.set-matrix.outputs.matrix_rpms }}
matrix_debs: ${{ steps.set-matrix.outputs.matrix_debs }}
steps:
- name: Checkout to repository
uses: actions/checkout@v4
- name: Set matrix data
id: set-matrix
run: |
echo "matrix_rpms=$(jq -c . < ./rpms/config.json)" >> $GITHUB_OUTPUT
echo "matrix_debs=$(jq -c . < ./debs/config.json)" >> $GITHUB_OUTPUT
build_rpms:
name: Build ${{ matrix.base_image }} ${{ matrix.target_arch }}
runs-on: ${{ matrix.target_arch == 'aarch64' && 'ubuntu-latest-arm64-small' || 'ubuntu-latest' }}
needs:
- configure
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix_rpms) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set build variables
id: variables
run: |
echo "imagemagick_version=$(cat ./imagemagick-version)" >> $GITHUB_OUTPUT
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Prepare image
run: docker build . -t buildenv --build-arg BASE_IMAGE=${{ matrix.base_image }}
working-directory: rpms
- name: Build and Install
run: docker run --name build buildenv ${{ steps.variables.outputs.imagemagick_version }} ${{ matrix.target_arch }}
- name: Retrieve built packages
env:
IMAGEMAGICK_VERSION: ${{ steps.variables.outputs.imagemagick_version }}
run: |
docker cp build:/root/rpmbuild/RPMS/ .
ls -l RPMS/${{ matrix.target_arch }}/
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.nexus_classifier }}-rpm
path: RPMS/${{ matrix.target_arch }}/*.rpm
test_rpms:
name: Test ${{ matrix.base_image }} ${{ matrix.target_arch }}
runs-on: ${{ matrix.target_arch == 'aarch64' && 'ubuntu-latest-arm64-small' || 'ubuntu-latest' }}
needs:
- configure
- build_rpms
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix_rpms) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set build variables
id: variables
run: |
echo "imagemagick_version=$(cat ./imagemagick-version)" >> $GITHUB_OUTPUT
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Download RPMs
uses: actions/download-artifact@v4
with:
name: ${{ matrix.nexus_classifier }}-rpm
path: rpms/tests/
- name: List RPMs
run: ls -R rpms/tests/*.rpm
- name: Prepare image
run: docker build . -t testenv --build-arg BASE_IMAGE=${{ matrix.base_image }}
working-directory: rpms/tests/
- name: Install & Test Packages
run: docker run --name buildtest testenv ${{ steps.variables.outputs.imagemagick_version }} ${{ matrix.target_arch }}
deploy_rpms:
name: Deploy ${{ matrix.base_image }} ${{ matrix.target_arch }}
runs-on: ubuntu-latest
needs:
- configure
- build_rpms
- test_rpms
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix_rpms) }}
fail-fast: false
max-parallel: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set build variables
id: variables
run: |
echo "imagemagick_version=$(cat ./imagemagick-version)" >> $GITHUB_OUTPUT
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Download RPMs
uses: actions/download-artifact@v4
with:
name: ${{ matrix.nexus_classifier }}-rpm
- name: List RPMs
run: ls -R *.rpm
- name: Deploy to nexus
uses: Alfresco/alfresco-build-tools/.github/actions/maven-deploy-file@1713976b6d7dc48dfe74f441c9bf1ae9481cbb45
if: startsWith(github.ref, 'refs/tags/v')
with:
group-id: org.imagemagick
artifact-id: imagemagick-distribution
repository-url: https://nexus.alfresco.com/nexus/content/repositories/thirdparty/
version: ${{ steps.variables.outputs.imagemagick_version }}-ci-${{ steps.variables.outputs.imagemagick_release }}
generate-pom: false
file: ImageMagick-${{ steps.variables.outputs.imagemagick_version }}.${{ matrix.target_arch }}.rpm
classifier: ${{ matrix.nexus_classifier }}
files: ImageMagick-libs-${{ steps.variables.outputs.imagemagick_version }}.${{ matrix.target_arch }}.rpm
classifiers: libs-${{ matrix.nexus_classifier }}
types: rpm
maven-username: ${{ secrets.NEXUS_USERNAME }}
maven-password: ${{ secrets.NEXUS_PASSWORD }}
build_deb:
name: Build ${{ matrix.base_image }} ${{ matrix.target_arch }}
runs-on: ${{ matrix.target_arch == 'aarch64' && 'ubuntu-latest-arm64-small' || 'ubuntu-latest' }}
needs:
- configure
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix_debs) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set build variables
id: variables
run: |
echo "imagemagick_version=$(cat ./imagemagick-version)" >> $GITHUB_OUTPUT
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Prepare image
run: docker build . -t buildenv --build-arg BASE_IMAGE=${{ matrix.base_image }}
working-directory: debs
- name: Build and Install
run: docker run --name build buildenv ${{ steps.variables.outputs.imagemagick_version }} ${{ matrix.target_arch }}
- name: Retrieve built packages
env:
IMAGEMAGICK_VERSION: ${{ steps.variables.outputs.imagemagick_version }}
PKG_ARCH: ${{ matrix.target_arch == 'aarch64' && 'arm64' || 'amd64' }}
run: |
docker cp build:/build/imagemagick-alfresco_${IMAGEMAGICK_VERSION}_${PKG_ARCH}.deb .
docker cp build:/build/imagemagick-alfresco-dev_${IMAGEMAGICK_VERSION}_${PKG_ARCH}.deb .
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.nexus_classifier }}-deb
path: "*.deb"
test_deb:
name: Test ${{ matrix.base_image }} ${{ matrix.target_arch }}
runs-on: ${{ matrix.target_arch == 'aarch64' && 'ubuntu-latest-arm64-small' || 'ubuntu-latest' }}
needs:
- configure
- build_deb
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix_debs) }}
fail-fast: false
env:
PKG_ARCH: ${{ matrix.target_arch == 'aarch64' && 'arm64' || 'amd64' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set build variables
id: variables
run: |
echo "imagemagick_version=$(cat ./imagemagick-version)" >> $GITHUB_OUTPUT
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Download DEBs
uses: actions/download-artifact@v4
with:
name: ${{ matrix.nexus_classifier }}-deb
path: debs/tests/
- name: List Debs
run: ls -R debs/tests/*.deb
- name: Prepare test image
run: docker build . -t testenv --build-arg BASE_IMAGE=${{ matrix.base_image }}
working-directory: debs/tests/
- name: Install & Test Packages
run: docker run --name buildtest testenv ${{ steps.variables.outputs.imagemagick_version }} ${{ env.PKG_ARCH }}
deploy_deb:
name: Deploy ${{ matrix.base_image }} ${{ matrix.target_arch }}
runs-on: ubuntu-latest
needs:
- configure
- build_deb
- test_deb
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix_debs) }}
fail-fast: false
max-parallel: 1
env:
PKG_ARCH: ${{ matrix.target_arch == 'aarch64' && 'arm64' || 'amd64' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set build variables
id: variables
run: |
echo "imagemagick_version=$(cat ./imagemagick-version)" >> $GITHUB_OUTPUT
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Download DEBs
uses: actions/download-artifact@v4
with:
name: ${{ matrix.nexus_classifier }}-deb
- name: List Debs
run: ls -R *.deb
- name: Deploy to nexus
uses: Alfresco/alfresco-build-tools/.github/actions/maven-deploy-file@1713976b6d7dc48dfe74f441c9bf1ae9481cbb45
if: startsWith(github.ref, 'refs/tags/v')
with:
group-id: org.imagemagick
artifact-id: imagemagick-distribution
repository-url: https://nexus.alfresco.com/nexus/content/repositories/thirdparty/
version: ${{ steps.variables.outputs.imagemagick_version }}-ci-${{ steps.variables.outputs.imagemagick_release }}
generate-pom: false
file: imagemagick-alfresco_${{ steps.variables.outputs.imagemagick_version }}_${{ env.PKG_ARCH }}.deb
classifier: ${{ matrix.nexus_classifier }}
files: imagemagick-alfresco-dev_${{ steps.variables.outputs.imagemagick_version }}_${{ env.PKG_ARCH }}.deb
classifiers: ${{ matrix.nexus_classifier }}-dev
types: deb
maven-username: ${{ secrets.NEXUS_USERNAME }}
maven-password: ${{ secrets.NEXUS_PASSWORD }}