-
Notifications
You must be signed in to change notification settings - Fork 13
466 lines (452 loc) · 16 KB
/
snapshot-master.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
466
name: snapshot-master
on:
schedule:
- cron: '30 18 * * *' # Daily at 18:30 UTC
repository_dispatch:
types:
- "make-snapshot"
- "snapshot-master"
workflow_dispatch:
inputs:
RUBY_PATCH_URL:
description: Patch URL
required: false
jobs:
make-snapshot:
runs-on: ubuntu-latest
env:
archname: snapshot-master
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/make-snapshot
- uses: actions/upload-artifact@master
with:
name: Packages
path: pkg
- uses: actions/upload-artifact@master
with:
name: Info
path: pkg/info
- name: Check pkg
run: |
set -x
ls -al pkg
7z x pkg/*.zip $archname/revision.h
cat $archname/revision.h
7z l pkg/*.zip $archname/ChangeLog
- name: Upload s3
run: |
set -x
for ext in .tar.gz .tar.xz .zip; do
aws s3 cp "pkg/$archname$ext" "s3://ftp.r-l.o/pub/ruby/snapshot/$archname$ext" --no-progress
curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/pub/ruby/snapshot/$archname$ext"
done
for ext in .json .yml; do
aws s3 cp "pkg/info/info$ext" "s3://ftp.r-l.o/pub/ruby/snapshot/$archname$ext" --no-progress
curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/pub/ruby/snapshot/$archname$ext"
done
env:
AWS_ACCESS_KEY_ID: ${{ secrets.FTP_R_L_O_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.FTP_R_L_O_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: make-snapshot <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
ubuntu:
needs: make-snapshot
strategy:
matrix:
test_task: [check, test-bundler-parallel, test-bundled-gems]
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/download-artifact@master
with:
name: Packages
path: pkg
- name: Extract
run: tar xf pkg/*.tar.xz
- name: Apply patch
run: |
set -x
curl -sSL "${RUBY_PATCH_URL}" -o ruby.patch
cd snapshot-*/
git apply ../ruby.patch
shell: bash
env:
RUBY_PATCH_URL: "${{ github.event.inputs.RUBY_PATCH_URL }}"
if: "${{ github.event.inputs.RUBY_PATCH_URL != '' }}"
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
# postfix `-` means `uninstall`
APT_INSTALL_RUBY=ruby-
APT_INSTALL_GIT=git-
case "${{ matrix.test_task }}" in
test-bundled-gems)
# test-bundled-gems requires executable host ruby
APT_INSTALL_RUBY=ruby
# test-bundled-gems-fetch requires git
unset APT_INSTALL_GIT
;;
test-bundler*)
# avoid Bundler::Source::Git::GitNotInstalledError
unset APT_INSTALL_GIT
;;
*)
;;
esac
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev bison- autoconf- $APT_INSTALL_RUBY $APT_INSTALL_GIT
- name: Fixed world writable dirs
run: |
mkdir -p $HOME/.local
chmod -v a-w $HOME $HOME/.config
sudo chmod -R a-w /usr/share
sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v a-w $d; done' || :
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- name: configure
run: cd snapshot-*/ && ./configure
- name: make
run: cd snapshot-*/ && make $JOBS
- name: Tests
run: cd snapshot-*/ && make $JOBS -s ${{ matrix.test_task }}
env:
RUBY_TESTOPTS: "-q --tty=no"
# leaked-globals since 2.7
- name: Leaked Globals
run: cd snapshot-*/ && make -s leaked-globals
if: matrix.test_task == 'check'
- name: make install without root privilege
run: cd snapshot-*/ && make $JOBS install DESTDIR="/tmp/destdir"
if: matrix.test_task == 'check'
- name: make install
run: cd snapshot-*/ && sudo make $JOBS install
if: matrix.test_task == 'check'
- name: ruby -v
run: ruby -v
if: matrix.test_task == 'check'
- name: Show .local
run: find $HOME/.local -ls
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
macos:
needs: make-snapshot
strategy:
matrix:
test_task: [check, test-bundler-parallel, test-bundled-gems]
os: [macos-11, macos-12]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/download-artifact@master
with:
name: Packages
path: pkg
- name: Extract
run: tar xf pkg/*.tar.xz
- name: Apply patch
run: |
set -x
curl -sSL "${RUBY_PATCH_URL}" -o ruby.patch
cd snapshot-*/
git apply ../ruby.patch
shell: bash
env:
RUBY_PATCH_URL: "${{ github.event.inputs.RUBY_PATCH_URL }}"
if: "${{ github.event.inputs.RUBY_PATCH_URL != '' }}"
- name: Install libraries
run: |
with_retry () {
"$@" || { sleep 5 && "$@"; } || { sleep 60 && "$@"; }
}
set -x
with_retry brew update
with_retry brew upgrade
with_retry brew install gmp libffi openssl@1.1 zlib autoconf automake libtool readline libyaml
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
- name: configure
run: cd snapshot-*/ && ./configure --with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml)
- name: make
run: cd snapshot-*/ && make $JOBS
- name: Remove .bundle for workaround
# ./tool/test-bundled-gems.rb:10:in `realpath': Not a directory @ rb_check_realpath_internal - ./tool/test-bundled-gems.rb/../../.bundle/bin/rake (Errno::ENOTDIR)
# from ./tool/test-bundled-gems.rb:10:in `<main>'
run: |
cd snapshot-*/
if [ ! -e .bundle/bin/rake ]; then
rm -rf .bundle
fi
if: matrix.test_task == 'test-bundled-gems'
- name: Tests
run: cd snapshot-*/ && make $JOBS -s ${{ matrix.test_task }}
env:
RUBY_TESTOPTS: "-q --tty=no"
# leaked-globals since 2.7
- name: Leaked Globals
run: cd snapshot-*/ && make -s leaked-globals
if: matrix.test_task == 'check'
- name: make install without root privilege
run: cd snapshot-*/ && make $JOBS install DESTDIR="/tmp/destdir"
if: matrix.test_task == 'check'
- name: make install
run: cd snapshot-*/ && sudo make $JOBS install
if: matrix.test_task == 'check'
- name: ruby -v
run: /usr/local/bin/ruby -v
if: matrix.test_task == 'check'
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
windows:
needs: make-snapshot
strategy:
matrix:
include:
- vs: 2019
- vs: 2022
fail-fast: false
runs-on: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
defaults:
run:
shell: cmd
working-directory: build
name: VisualStudio ${{ matrix.vs }}
env:
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
PATCH: C:\msys64\usr\bin\patch.exe
OS_VER: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
steps:
- run: md build
working-directory:
- run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: msys2/setup-msys2@v2
id: setup-msys2
with:
update: true
install: >-
patch
if: ${{ env.OS_VER != 'windows-2019' }}
- name: patch path
shell: msys2 {0}
run: echo PATCH=$(cygpath -wa $(command -v patch)) >> $GITHUB_ENV
if: ${{ steps.setup-msys2.outcome == 'success' }}
- uses: actions/cache@v3
with:
path: C:\vcpkg\downloads
key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-
${{ runner.os }}-vcpkg-download-
- uses: actions/cache@v3
with:
path: C:\vcpkg\installed
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-
${{ runner.os }}-vcpkg-installed-
- name: Install libraries with vcpkg
run: |
vcpkg --triplet x64-windows install libffi libyaml openssl readline zlib
- uses: actions/cache@v3
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
key: ${{ runner.os }}-chocolatey-${{ env.OS_VER }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-chocolatey-${{ env.OS_VER }}-
${{ runner.os }}-chocolatey-
- name: Install libraries with chocolatey
run: |
# Using Choco-Install for retries, but it doesn't detect failures properly
# if you pass multiple package names in a single command.
Choco-Install -PackageName winflexbison3
shell: pwsh
- uses: actions/download-artifact@master
with:
name: Packages
path: pkg
- name: Extract
run: 7z x pkg/*.zip
working-directory:
- name: Apply patch
run: |
set -x
curl -sSL "${RUBY_PATCH_URL}" -o ruby.patch
cd snapshot-master/
git apply ../ruby.patch
shell: bash
env:
RUBY_PATCH_URL: "${{ github.event.inputs.RUBY_PATCH_URL }}"
if: "${{ github.event.inputs.RUBY_PATCH_URL != '' }}"
working-directory:
- uses: actions/cache@v3
with:
path: snapshot-*/.downloaded-cache
key: downloaded-cache
- name: setup env
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
run: |
set VS=${{ matrix.vs }}
set VCVARS=${{ matrix.vcvars }}
if not "%VCVARS%" == "" goto :vcset
set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
:vcset
set | C:\msys64\usr\bin\sort > old.env
call %VCVARS%
set TMP=%USERPROFILE%\AppData\Local\Temp
set TEMP=%USERPROFILE%\AppData\Local\Temp
set /a TEST_JOBS=(15 * %NUMBER_OF_PROCESSORS% / 10) > nul
set | C:\msys64\usr\bin\sort > new.env
C:\msys64\usr\bin\comm -13 old.env new.env >> %GITHUB_ENV%
del *.env
- name: link libraries
run: |
for %%I in (C:\vcpkg\installed\x64-windows\bin\*.dll) do (
if not %%~nI == readline mklink %%~nxI %%I
)
for %%I in (libcrypto-1_1-x64 libssl-1_1-x64) do (
ren c:\Windows\System32\%%I.dll %%I.dll_
)
- name: Configure
run: >-
../snapshot-master/win32/configure.bat --disable-install-doc
--with-opt-dir=C:/vcpkg/installed/x64-windows
- run: nmake incs
- run: nmake extract-extlibs
- run: nmake
env:
YACC: win_bison
- name: ruby -v
run: |
.\ruby -v
- run: nmake test
timeout-minutes: 5
- run: nmake test-all
env:
RUBY_TESTOPTS: -j${{env.TEST_JOBS}} --job-status=normal
timeout-minutes: 60
continue-on-error: ${{ matrix.continue-on-error || false }}
- run: nmake test-spec
timeout-minutes: 10
continue-on-error: ${{ matrix.continue-on-error || false }}
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} (vs${{ matrix.vs }}) <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()