-
Notifications
You must be signed in to change notification settings - Fork 41
465 lines (408 loc) · 14.5 KB
/
release.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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
name: release
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
inputs:
nightly:
description: Nightly build
type: boolean
default: false
debug:
description: Debug symbols
type: boolean
default: false
no_tests:
description: Do not run unit tests
type: boolean
default: false
no_coverage:
description: Do not run coverage job
type: boolean
default: false
tag:
description: Optional release tag (normally auto-detected)
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get-version
run: |
if [[ ${{ github.event_name }} = schedule ]]; then
version=nightly
elif [[ "${{ github.event.inputs.nightly }}" = true ]]; then
version=nightly
else
version=`grep -m1 _RELEASE core/init.lua | grep -o "[0-9.]\+[^']*" | tr ' ' '_'`
fi
echo "version=$version">> "$GITHUB_OUTPUT"
build:
strategy:
matrix:
include:
- os: ubuntu-20.04
- os: windows-2019
qt: '6.7'
- os: macOS-12
qt: '6.5'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Install Qt (Windows, macOS)
if: runner.os == 'Windows' || runner.os == 'macOS'
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: 'qt5compat'
- name: Install build dependencies like Qt and GTK (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev libgtk-3-dev lua5.3 discount --no-install-recommends -y
- name: Build
shell: bash
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
type="Release"
if [[ ${{ github.event_name }} != schedule ]]; then
if [[ "${{ github.event.inputs.nightly }}" = true ]]; then nightly="-D NIGHTLY=1"; fi
if [[ "${{ github.event.inputs.debug }}" = true ]]; then type="Debug"; fi
else
nightly="-D NIGHTLY=1"
fi
if [[ ${{ runner.os }} == Linux ]]; then generate_html="-D GENERATE_HTML=1"; fi
cmake -S . -B build ${nightly} ${generate_html} -D CMAKE_INSTALL_PREFIX=build/install
cmake --build build --config ${type} -j
if [[ ${{ runner.os }} == Linux ]]; then cmake --build build --target html; fi
cmake --install build --config ${type}
cmake --build build --target archive
env:
VCINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.os }}
path: |
build/*.tgz
build/*.zip
modules:
runs-on: ubuntu-latest
needs: get-version
steps:
- name: Package modules
run: |
mkdir textadept-modules
modules="debugger export file_diff format lsp lua_repl open_file_mode scratch spellcheck"
for module in $modules; do
gh_name="`echo -n $module | sed -e 's/_/-/g;'`"
gh_prefix="https://github.com/orbitalquark/textadept-$gh_name"
wget $gh_prefix/releases/download/latest/$module.zip
unzip -d textadept-modules $module.zip
done
zip -r textadept_${{ needs.get-version.outputs.version }}.modules.zip textadept-modules
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-modules
path: '*.zip'
release:
runs-on: ubuntu-latest
needs: [get-version, build, modules]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Add HTML documentation
run: |
# Extract HTML documentation from Linux.
version=${{ needs.get-version.outputs.version }}
tar xzf textadept_$version.linux.tgz --wildcards 'textadept/docs/*.html'
# Insert it into Windows archive.
zip -r textadept_$version.win.zip textadept/docs/*.html
# Install it into macOS archive.
mkdir -p Textadept.app/Contents/Resources/docs
cp textadept/docs/*.html Textadept.app/Contents/Resources/docs
zip -r textadept_$version.macOS.zip Textadept.app/Contents/Resources/docs/*.html
continue-on-error: true
- name: Tag
if: github.ref_name == github.event.repository.default_branch
run: |
git tag textadept_${{ needs.get-version.outputs.version }}
git push -f origin textadept_${{ needs.get-version.outputs.version }}
- name: Create release log
run: |
echo -n "Textadept " > log.md
echo -n "${{ needs.get-version.outputs.version }} " | tr '_' ' ' >> log.md
echo \(`date +"%d %b %Y"`\) >> log.md
if [[ ${{ needs.get-version.outputs.version }} = nightly ]]; then exit 0; fi
prefix="https://orbitalquark.github.io/textadept"
echoing=0
while read line; do
if [[ $line == \#\#\#* ]]; then
if [[ $echoing -eq 0 ]]; then
echoing=1
else
exit 0
fi
elif [[ $echoing -eq 1 ]]; then
echo "$line" | sed "s,\(manual\|api\)\.html,$prefix/\0,;"
fi
done < docs/changelog.md >> log.md
- name: Upload release log
uses: actions/upload-artifact@v4
with:
name: artifacts-release-log
path: log.md
- name: Create release
if: github.ref_name == github.event.repository.default_branch
uses: ncipollo/release-action@v1
with:
name: ${{ needs.get-version.outputs.version }}
tag: textadept_${{ needs.get-version.outputs.version }}
prerelease: |
${{ needs.get-version.outputs.version == 'nightly' ||
contains(needs.get-version.outputs.version, 'alpha') ||
contains(needs.get-version.outputs.version, 'beta') }}
allowUpdates: true
bodyFile: log.md
artifacts: textadept_*
token: ${{ secrets.GITHUB_TOKEN }}
test:
if: ${{ ! inputs.no_tests }}
needs: [build, modules]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
exe: [textadept/textadept, textadept/textadept-curses]
include:
- os: ubuntu-latest
exe: textadept/textadept-gtk
- os: macOS-latest
exe: Textadept.app/Contents/MacOS/textadept_osx
#- os: macOS-latest
# exe: Textadept.app/Contents/MacOS/textadept-curses
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install Qt, Gtk, xterm, matchbox-window-manager, and module dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev libgtk-3-dev xterm matchbox-window-manager \
gdb lua5.4 lua-socket clang-format clangd hunspell-en-us --no-install-recommends -y
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Unpack Textadept (Windows)
if: runner.os == 'Windows'
shell: bash
run: unzip textadept_*.win.zip
- name: Unpack Textadept (macOS)
if: runner.os == 'macOS'
run: unzip textadept_*.macOS.zip
- name: Unpack Textadept (Linux)
if: runner.os == 'Linux'
run: tar xzf textadept_*.linux.tgz
- name: Unpack modules (Windows, Linux)
if: runner.os != 'macOS'
run: |
unzip textadept_*.modules.zip
mv textadept-modules/* textadept/modules
- name: Unpack modules (macOS)
if: runner.os == 'macOS'
run: |
unzip textadept_*modules.zip
mv textadept-modules/* Textadept.app/Contents/Resources/modules
- name: Run unit tests (Windows)
if: runner.os == 'Windows'
shell: cmd
run: start "" /d ${{ github.workspace }} /wait ${{ matrix.exe }}.exe -t
timeout-minutes: 2
- name: Run unit tests (macOS)
if: runner.os == 'macOS'
run: ${{ matrix.exe }} -t
#run: |
# echo "cd ${{ github.workspace }}" > run.sh
# echo "${{ matrix.exe }} -t" >> run.sh
# open -W -a Terminal run.sh # TODO: never exits since Terminal.app does not quit
timeout-minutes: 2
- name: Run unit tests (Linux)
if: runner.os == 'Linux'
run: xvfb-run -a xterm -e ${{ matrix.exe }} -t
env:
LANG: en_US.UTF-8
timeout-minutes: 2
- name: Read test output
if: success() || failure()
run: |
cat test.log
grep -q '^0 failed' test.log
smoke-test-bsd:
if: ${{ ! inputs.no_tests }}
runs-on: ubuntu-latest
env:
TEXTADEPT_HOME: ${{ github.workspace }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Install dependencies
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: false
shutdown_vm: false
run: sudo pkg install -y cmake ninja qt5 ncurses
- name: Build
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: runner-to-vm
shutdown_vm: false
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
cmake -S . -B build -D NIGHTLY=1 -G Ninja
cmake --build build
# Copy lexers.
cp -r build/_deps/scintillua-src/lexers .
- name: Test
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: false
shutdown_vm: false
run: build/textadept-curses -t
timeout-minutes: 1
- name: Read test output
if: success() || failure()
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: false
run: |
cat test.log
grep -q '^0 failed' test.log
coverage:
if: ${{ ! inputs.no_coverage }}
needs: modules
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Checkout LuaCov
uses: actions/checkout@v4
with:
repository: lunarmodules/luacov
path: luacov
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev libgtk-3-dev xterm matchbox-window-manager lua5.4 gcovr \
gdb lua-socket clang-format clangd hunspell-en-us --no-install-recommends -y
patch -d luacov -p1 < src/luacov.patch
sudo mkdir -p /usr/share/lua/5.4
sudo cp -r luacov/src/luacov* /usr/share/lua/5.4
sudo cp luacov/src/bin/luacov /usr/bin
rm -r luacov
- name: Build for coverage
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
cmake -S . -B build -D NIGHTLY=1 -D PROFILE=1
cmake --build build --config Debug -j
# Copy lexers.
cp -r build/_deps/scintillua-src/lexers .
- name: Download modules
uses: actions/download-artifact@v4
with:
name: artifacts-modules
- name: Unpack modules
run: |
unzip textadept_*.modules.zip
mv textadept-modules/* modules
- name: Run tests
run: |
xvfb-run -a build/textadept -t -T || true
xvfb-run -a build/textadept-gtk -f -t -T || true
xvfb-run -a xterm -e build/textadept-curses -t -T
env:
TEXTADEPT_HOME: ${{ github.workspace }}
LANG: en_US.UTF-8
timeout-minutes: 5
- name: Read test output
if: success() || failure()
run: cat test.log
- name: Process coverage reports
run: lua scripts/gen_cov.lua github . > coverage.md
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: artifacts-coverage
path: coverage.md
update-release-log:
if: ${{ ! inputs.no_coverage }}
needs: [release, coverage]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Append coverage table
run: cat coverage.md >> log.md
- name: Update release log with coverage info
if: github.ref_name == github.event.repository.default_branch
uses: ncipollo/release-action@v1
with:
name: nightly
tag: textadept_nightly
prerelease: true
allowUpdates: true
bodyFile: log.md
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload updated release log
uses: actions/upload-artifact@v4
with:
name: artifacts-update-release-log
path: log.md