forked from groonga/groonga
-
Notifications
You must be signed in to change notification settings - Fork 0
329 lines (323 loc) · 10.4 KB
/
package.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
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: Package
on:
push:
# Test
branches:
- '*'
tags:
- '*'
paths:
- '**/*.cmake'
- '**/*.cmake.in'
- '**/CMakeLists.txt'
- '**/Makefile.am'
- '.github/workflows/package.yml'
- 'configure.ac'
- 'cmake/**'
- 'doc/**'
- 'include/**/*.h'
- 'include/**/*.h.in'
- 'include/**/*.hpp'
- 'lib/**/*.c'
- 'lib/**/*.cpp'
- 'lib/**/*.h'
- 'lib/**/*.hpp'
- 'lib/**/*.rb'
- 'packages/**'
- 'plugins/**/*.c'
- 'plugins/**/*.cpp'
- 'plugins/**/*.h'
- 'plugins/**/*.rb'
- 'src/**/*.c'
- 'src/**/*.h'
- 'test/command/**'
- 'vendor/mruby/**'
pull_request:
paths:
- '**/*.cmake'
- '**/*.cmake.in'
- '**/CMakeLists.txt'
- '**/Makefile.am'
- '.github/workflows/package.yml'
- 'configure.ac'
- 'cmake/**'
- 'doc/**'
- 'include/**/*.h'
- 'include/**/*.h.in'
- 'include/**/*.hpp'
- 'lib/**/*.c'
- 'lib/**/*.cpp'
- 'lib/**/*.h'
- 'lib/**/*.rb'
- 'lib/**/*.rb'
- 'packages/**'
- 'plugins/**/*.c'
- 'plugins/**/*.cpp'
- 'plugins/**/*.h'
- 'plugins/**/*.rb'
- 'src/**/*.c'
- 'src/**/*.h'
- 'test/command/**'
- 'vendor/mruby/**'
schedule:
- cron: |
0 0 * * *
concurrency:
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
source:
if: >-
github.event_name != 'schedule' ||
(github.event_name == 'schedule' &&
github.repository_owner == 'groonga')
name: Source
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt update -o="APT::Acquire::Retries=3"
sudo apt install -y -V -o="APT::Acquire::Retries=3" \
autoconf-archive \
devscripts \
ruby \
zip
- uses: actions/setup-python@v5
with:
python-version: 3
- name: Install Sphinx
run: |
pip3 install -r doc/requirements.txt
- name: Clone dependencies
run: |
cd ..
git clone --depth 1 https://github.com/groonga/groonga.org.git
git clone --depth 1 https://github.com/clear-code/cutter.git
- name: Generate configure
run: |
./autogen.sh
- name: Configure for archive
run: |
./configure \
--enable-document \
--enable-mruby \
--with-cutter-source-path=../cutter \
--with-groonga-org-path=../groonga.org \
--with-ruby
- name: Build archive
run: |
make dist
- name: Create zip
run: |
version=$(cat base_version)
tar xzf groonga-${version}.tar.gz
pushd groonga-${version}/vendor
ruby download_lz4.rb
ruby download_mecab.rb
ruby download_message_pack.rb
ruby download_rapidjson.rb
ruby download.rb
popd
zip -r groonga-${version}.zip groonga-${version}
rm -rf groonga-${version}
# Artifact
- uses: actions/upload-artifact@v3
with:
name: source
path: |
groonga-*.tar.gz
groonga-*.zip
# Release
- name: Upload to release
if: |
startsWith(github.ref, 'refs/tags/')
run: |
(cd doc/source/news && \
ruby \
-e 'print("## Groonga "); \
puts(ARGF.read.split(/^## Release /)[1]. \
gsub(/^\(.+\)=$/, ""). \
gsub(/ {.+?}/, ""). \
gsub(/{doc}`(.+?)`/) { \
id = $1; \
title = id.split("\/").last; \
path = id.delete_prefix("/"); \
url = "https://groonga.org/docs/#{path}.html"; \
"[#{title}](#{url})"; \
}. \
gsub(/{ref}`(.+?)`/) {$1}.
strip)' \
$(ls *.md | sort --human-numeric-sort | tail -n1)) > \
release-note.md
echo "" >> release-note.md
echo "### Translations" >> release-note.md
echo "" >> release-note.md
version=${GITHUB_REF_NAME#v}
major_version=${version%%.*}
version_hyphen=$(echo ${version} | tr . -)
echo " * [Japanese](https://groonga.org/ja/docs/news/${major_version}.html#release-${version_hyphen})" >> release-note.md
title="$(head -n1 release-note.md | sed -e 's/^## //')"
tail -n +2 release-note.md > release-note-without-version.md
gh release create ${GITHUB_REF_NAME} \
--discussion-category Releases \
--notes-file release-note-without-version.md \
--title "${title}" \
groonga-*.tar.gz \
groonga-*.zip
env:
GH_TOKEN: ${{ github.token }}
build:
name: Build
needs: source
strategy:
fail-fast: false
matrix:
label:
# - Debian GNU/Linux bullseye amd64
# - Debian GNU/Linux bullseye arm64
# - Debian GNU/Linux bookworm amd64
# - Debian GNU/Linux bookworm arm64
# - Debian GNU/Linux trixie amd64
# - Debian GNU/Linux trixie arm64
- CentOS 7 x86_64
- AlmaLinux 8 x86_64
- AlmaLinux 8 aarch64
- AlmaLinux 9 x86_64
- AlmaLinux 9 aarch64
include:
# - label: Debian GNU/Linux bullseye amd64
# id: debian-bullseye-amd64
# task-namespace: apt
# target: debian-bullseye
# test-docker-image: debian:bullseye
# - label: Debian GNU/Linux bullseye arm64
# id: debian-bullseye-arm64
# task-namespace: apt
# target: debian-bullseye-arm64
# test-docker-image: arm64v8/debian:bullseye
# - label: Debian GNU/Linux bookworm amd64
# id: debian-bookworm-amd64
# task-namespace: apt
# target: debian-bookworm
# test-docker-image: debian:bookworm
# - label: Debian GNU/Linux bookworm arm64
# id: debian-bookworm-arm64
# task-namespace: apt
# target: debian-bookworm-arm64
# test-docker-image: arm64v8/debian:bookworm
# - label: Debian GNU/Linux trixie amd64
# id: debian-trixie-amd64
# task-namespace: apt
# target: debian-trixie
# test-docker-image: debian:trixie
# - label: Debian GNU/Linux trixie arm64
# id: debian-trixie-arm64
# task-namespace: apt
# target: debian-trixie-arm64
# test-docker-image: arm64v8/debian:trixie
- label: CentOS 7 x86_64
id: centos-7-x86_64
task-namespace: yum
target: centos-7
test-docker-image: centos:7
- label: AlmaLinux 8 x86_64
id: almalinux-8-x86_64
task-namespace: yum
target: almalinux-8
test-docker-image: almalinux:8
- label: AlmaLinux 8 aarch64
id: almalinux-8-aarch64
task-namespace: yum
target: almalinux-8-aarch64
test-docker-image: arm64v8/almalinux:8
- label: AlmaLinux 9 x86_64
id: almalinux-9-x86_64
task-namespace: yum
target: almalinux-9
test-docker-image: almalinux:9
- label: AlmaLinux 9 aarch64
id: almalinux-9-aarch64
task-namespace: yum
target: almalinux-9-aarch64
test-docker-image: arm64v8/almalinux:9
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt update -o="APT::Acquire::Retries=3"
sudo apt install -y -V -o="APT::Acquire::Retries=3" \
devscripts \
qemu-user-static \
ruby
- uses: actions/download-artifact@v3
with:
name: source
- name: Update version
if: |
!startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/heads/maintenance/')
run: |
cd packages
rake version:update RELEASE_DATE=$(date +%Y-%m-%d)
- name: Login to GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache ccache
uses: actions/cache@v4
with:
path: packages/${{ matrix.task-namespace }}/build/${{ matrix.target }}/ccache
key: package-${{ matrix.id }}-ccache-${{ hashFiles('lib/**', 'src/**', 'plugins/**', 'include/**') }}
restore-keys: package-${{ matrix.id }}-ccache-
- name: Build with docker
run: |
cd packages
rake docker:pull || :
rake ${{ matrix.task-namespace }}:build BUILD_DIR=build
env:
APT_TARGETS: ${{ matrix.target }}
YUM_TARGETS: ${{ matrix.target }}
- name: Push the built Docker image
continue-on-error: true
run: |
cd packages
rake docker:push
env:
APT_TARGETS: ${{ matrix.target }}
YUM_TARGETS: ${{ matrix.target }}
# Artifact
- uses: actions/upload-artifact@v3
with:
name: packages-${{ matrix.id }}
path: packages/${{ matrix.task-namespace }}/repositories/
# Release
- name: Create assets
if: |
startsWith(github.ref, 'refs/tags/')
run: |
tar czf ${{ matrix.id }}.tar.gz packages/${{ matrix.task-namespace }}/repositories/
- name: Upload to release
if: |
startsWith(github.ref, 'refs/tags/')
run: |
gh release upload ${GITHUB_REF_NAME} \
${{ matrix.id }}.tar.gz
env:
GH_TOKEN: ${{ github.token }}
# Test
- name: Test
run: |
docker run \
--rm \
--volume ${PWD}:/groonga:ro \
${{ matrix.test-docker-image }} \
/groonga/packages/${{ matrix.task-namespace }}/test.sh