-
Notifications
You must be signed in to change notification settings - Fork 9
309 lines (302 loc) · 9.45 KB
/
Copy pathpackage.yml
File metadata and controls
309 lines (302 loc) · 9.45 KB
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
name: Package
on:
push:
pull_request:
schedule:
- cron: |
0 0 * * *
jobs:
source:
name: Source
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Build archive
run: |
rake dist
version=$(grep 'VERSION ".*"' CMakeLists.txt | grep -o '[0-9.]*')
for sha in sha256 sha512; do
${sha}sum groonga-normalizer-mysql-${version}.tar.gz > \
groonga-normalizer-mysql-${version}.tar.gz.${sha}
${sha}sum groonga-normalizer-mysql-${version}.zip > \
groonga-normalizer-mysql-${version}.zip.${sha}
done
- uses: actions/upload-artifact@v7
with:
name: release-source
path: |
groonga-normalizer-mysql-*.tar.gz
groonga-normalizer-mysql-*.zip
build:
name: Build
needs: source
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
id:
- debian-bookworm-amd64
- debian-bookworm-arm64
- debian-trixie-amd64
- debian-trixie-arm64
- ubuntu-jammy-amd64
- ubuntu-jammy-arm64
- ubuntu-noble-amd64
- ubuntu-noble-arm64
- almalinux-8-x86_64
- almalinux-8-aarch64
- almalinux-9-x86_64
- almalinux-9-aarch64
- almalinux-10-x86_64
- almalinux-10-aarch64
- amazon-linux-2023-x86_64
- amazon-linux-2023-aarch64
# condition && true-case || false-case
# ==
# condition ? true-case : false-case
runs-on: >-
${{ (contains(matrix.id, 'arm64') ||
contains(matrix.id, 'aarch64')) && 'ubuntu-24.04-arm' ||
'ubuntu-latest' }}
env:
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow
steps:
- name: Prepare environment variables
run: |
set -eux
id=${{ matrix.id }}
os_version=${id%-*}
os=${os_version%-*}
# amazon-linux -> amazonlinux
docker_os=${os/-/}
version=${os_version##*-}
architecture=${id##*-}
if [ "${os}" = "debian" ] || [ "${os}" = "ubuntu" ]; then
echo "APT_TARGETS=${id%-amd64}" >> ${GITHUB_ENV}
echo "TASK_NAMESPACE=apt" >> ${GITHUB_ENV}
else
echo "YUM_TARGETS=${id%-x86_64}" >> ${GITHUB_ENV}
echo "TASK_NAMESPACE=yum" >> ${GITHUB_ENV}
fi
TEST_DOCKER_IMAGE="${docker_os}:${version}"
if [ "${architecture}" = "arm64" ] || \
[ "${architecture}" = "aarch64" ]; then
TEST_DOCKER_IMAGE="arm64v8/${TEST_DOCKER_IMAGE}"
fi
echo "TEST_DOCKER_IMAGE=${TEST_DOCKER_IMAGE}" >> ${GITHUB_ENV}
- name: Install dependencies
run: |
sudo apt update
sudo apt -V install \
devscripts \
ruby
- uses: actions/checkout@v6
- uses: actions/checkout@v6
with:
path: groonga
repository: groonga/groonga
submodules: recursive
- uses: actions/checkout@v6
with:
path: apache-arrow
repository: apache/arrow
- uses: actions/download-artifact@v8
with:
name: release-source
- name: Update version
if: |
github.ref_type != 'tag'
run: |
cd packages
rake version:update
env:
GROONGA_REPOSITORY: ../groonga
- name: Login to GitHub Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build with docker
run: |
cd packages
rake docker:pull || :
rake ${TASK_NAMESPACE}:build
env:
GROONGA_REPOSITORY: ../groonga
- name: Push the built Docker image
continue-on-error: true
run: |
cd packages
rake docker:push
env:
GROONGA_REPOSITORY: ../groonga
- uses: actions/upload-artifact@v7
with:
name: packages-${{ matrix.id }}
path: packages/${{ env.TASK_NAMESPACE }}/repositories/
- name: Test
run: |
case "${TEST_DOCKER_IMAGE}" in
arm64v8/*)
platform=linux/arm64
;;
*)
platform=linux/amd64
;;
esac
docker run \
--platform ${platform} \
--rm \
--volume ${PWD}:/host:ro \
${TEST_DOCKER_IMAGE} \
/host/packages/${TASK_NAMESPACE}/test.sh
prepare-for-release:
name: Prepare for release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/download-artifact@v8
with:
path: packages
pattern: packages-*
- name: Group by distribution and version
run: |
set -x
for packages_path in packages/*; do
# packages/packages-debian-bookworm-amd64 ->
# debian-bookworm
os=$(echo ${packages_path} | \
grep -E -o '(almalinux|amazon-linux|debian|ubuntu)-[^-]+')
mkdir -p release/${os}/
# packages/packages-debian-bookworm-amd64/debian/bookworm/source/ ->
# release/debian-bookworm/debian/bookworm/source/
rsync -a ${packages_path}/ release/${os}/
done
for release_os_path in release/*; do
# release/debian-bookworm ->
# debian-bookworm
os=$(basename ${release_os_path})
# release/debian-bookworm/debian/... ->
# debian-bookworm/debian/...
tar czf ${os}.tar.gz -C $(dirname ${release_os_path}) ${os}
done
- uses: actions/upload-artifact@v7
with:
name: release-packages
path: "*.tar.gz"
arch-linux:
name: Arch Linux
needs: source
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: release-source
- name: Cache ccache
uses: actions/cache@v5
with:
path: ccache
key: arch-linux-ccache-${{ hashFiles('normalizers/**') }}
restore-keys: arch-linux-ccache-
- name: Login to GitHub Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull
continue-on-error: true
run: |
docker compose pull arch-linux
- name: Build
run: |
docker compose build arch-linux
- name: Run
run: |
mkdir -p ccache
chmod -R go+rwx ccache
docker compose run \
-e CCACHE_DIR=/source/ccache \
arch-linux
- name: Push
if: github.ref_name == 'main'
continue-on-error: true
run: |
docker compose push arch-linux
- uses: actions/upload-artifact@v7
with:
name: release-arch-linux
path: "*.pkg.tar.*"
release:
name: Release
needs:
- prepare-for-release
- arch-linux
runs-on: ubuntu-latest
timeout-minutes: 10
environment: release
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
path: release-artifacts
pattern: release-*
merge-multiple: true
- name: Show files
run: find ./release-artifacts -type f
- name: Generate release note
run: |
ruby \
-e 'print("## groonga-normalizer-mysql "); \
puts(ARGF.read.split(/^## /)[1].strip)' \
doc/text/news.md | tee release-note.md
tail -n +2 release-note.md | tee release-note-without-version.md
- name: Publish release page
if: |
github.ref_type == 'tag'
env:
GH_TOKEN: ${{ github.token }}
run: |
title="$(head -n1 release-note.md | sed -e 's/^## //')"
gh release create ${GITHUB_REF_NAME} \
--discussion-category Announcements \
--notes-file release-note-without-version.md \
--title "${title}" \
release-artifacts/*
- name: Prepare for Launchpad publishing
run: |
cp release-artifacts/groonga-normalizer-mysql-*.tar.gz ./
sudo apt update
sudo apt install -y \
build-essential \
debhelper \
devscripts
- uses: actions/checkout@v6
if: |
github.ref_type == 'tag'
with:
path: apache-arrow
repository: apache/arrow
- uses: actions/checkout@v6
if: |
github.ref_type == 'tag'
with:
path: groonga
repository: groonga/groonga
- name: Publish to Launchpad
if: |
github.ref_type == 'tag'
env:
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow
GROONGA_REPOSITORY: ${{ github.workspace }}/groonga
LAUNCHPAD_DEPLOY_KEY: ${{ secrets.LAUNCHPAD_DEPLOY_KEY }}
LAUNCHPAD_UPLOADER_PGP_KEY: "0x32862FBCD63D72C152EFF3A9BD481CAA9168EA87"
run: |
echo "${LAUNCHPAD_DEPLOY_KEY}" | gpg --import
echo "trusted-key ${LAUNCHPAD_UPLOADER_PGP_KEY}" > ~/.gnupg/gpg.conf
rake -C packages ubuntu