forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 1
769 lines (725 loc) · 28.1 KB
/
main.yaml
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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
##
## This workflow handles testing of pull requests and pushes.
## It also publishes some packages to any new Erlang/OTP release
##
## To speed this up it would be nice if one could share docker
## images inbetween different jobs, but at the moment this is
## not possible so we need to rebuild all of Erlang/OTP multiple
## times.
##
## Now that we have migrated to ghcr.io we use the
## built-in caching mechanisms of docker/build-push-action@v2.
## However as things are now we use docker directly to make things
## work due to historical reasons.
##
name: Build and check Erlang/OTP
on:
push:
pull_request:
env:
## Equivalent to github.event_name == 'pull_request' ? github.base_ref : github.ref_name
BASE_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
jobs:
pack:
name: Build Erlang/OTP (64-bit)
runs-on: ubuntu-latest
outputs:
BASE_BUILD: ${{ steps.base-build.outputs.BASE_BUILD }}
changes: ${{ steps.changes.outputs.changes }}
all: ${{ steps.apps.outputs.all }}
steps:
- uses: actions/checkout@v3
- name: Get applications
id: apps
run: |
.github/scripts/path-filters.sh > .github/scripts/path-filters.yaml
ALL_APPS=$(grep '^[a-z_]*:' .github/scripts/path-filters.yaml | sed 's/:.*$//')
ALL_APPS=$(jq -n --arg inarr "${ALL_APPS}" '$inarr | split("\n")' | tr '\n' ' ')
echo "all=${ALL_APPS}" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v2
id: changes
with:
filters: .github/scripts/path-filters.yaml
- name: Create initial pre-release tar
run: .github/scripts/init-pre-release.sh otp_archive.tar.gz
- name: Upload source tar archive
uses: actions/upload-artifact@v3
with:
name: otp_git_archive
path: otp_archive.tar.gz
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache BASE image
uses: actions/cache@v3
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}-${{ hashFiles('OTP-VERSION') }}
- name: Build BASE image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" 64-bit
- name: Cache pre-built tar archives
id: pre-built-cache
uses: actions/cache@v3
with:
path: |
otp_src.tar.gz
otp_cache.tar.gz
key: prebuilt-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
prebuilt-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }}
- uses: dorny/paths-filter@v2
id: cache
with:
filters: |
no-cache:
- '.github/**'
deleted:
- deleted: '**'
bootstrap:
- 'bootstrap/**'
configure:
- '**.ac'
- '**.in'
list-files: shell
- name: Restore from cache
env:
NO_CACHE: ${{ steps.cache.outputs.no-cache }}
BOOTSTRAP: ${{ steps.cache.outputs.bootstrap }}
CONFIGURE: ${{ steps.cache.outputs.configure }}
run: |
.github/scripts/restore-from-prebuilt.sh "`pwd`" \
"`pwd`/.github/otp.tar.gz" \
"`pwd`/otp_archive.tar.gz" \
'${{ github.event_name }}' \
'${{ steps.cache.outputs.deleted_files }}' \
'${{ steps.changes.outputs.changes }}'
- name: Upload restored cache
uses: actions/upload-artifact@v3
if: runner.debug == 1
with:
name: restored-cache
path: .github/otp.tar.gz
- name: Build image
run: |
docker build --tag otp \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--file ".github/dockerfiles/Dockerfile.64-bit" \
.github/
- name: Build pre-built tar archives
run: |
docker run -v $PWD:/github --entrypoint "" otp \
scripts/build-otp-tar -o /github/otp_clean_src.tar.gz /github/otp_src.tar.gz -b /buildroot/otp/ /github/otp_src.tar.gz
- name: Build cache
run: |
if [ -f otp_cache.tar.gz ]; then
gunzip otp_cache.tar.gz
else
docker run -v $PWD:/github --entrypoint "" otp \
bash -c 'cp ../otp_cache.tar /github/'
fi
docker run -v $PWD:/github --entrypoint "" otp \
bash -c 'set -x; C_APPS=$(ls -d ./lib/*/c_src); find Makefile ./make ./erts ./bin/`erts/autoconf/config.guess` ./lib/erl_interface ./lib/jinterface ${C_APPS} `echo "${C_APPS}" | sed -e 's:c_src$:priv:'` -type f -newer README.md \! -name "*.beam" \! -path "*/doc/*" | xargs tar --transform "s:^./:otp/:" -uvf /github/otp_cache.tar'
gzip otp_cache.tar
- name: Upload pre-built tar archive
uses: actions/upload-artifact@v3
with:
name: otp_prebuilt
path: |
otp_src.tar.gz
otp_cache.tar.gz
build-macos:
name: Build Erlang/OTP (macOS)
runs-on: macos-12
needs: pack
env:
WXWIDGETS_VERSION: 3.1.5
steps:
- uses: actions/checkout@v3
- name: Download source archive
uses: actions/download-artifact@v3
with:
name: otp_prebuilt
- name: Cache wxWidgets
id: wxwidgets-cache
uses: actions/cache@v3
with:
path: wxWidgets
key: wxWidgets-${{ env.WXWIDGETS_VERSION }}-${{ runner.os }}-12
- name: Compile wxWidgets
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
run: .github/scripts/build-macos-wxwidgets.sh
- name: Compile Erlang
run: |
tar -xzf ./otp_src.tar.gz
export PATH=$PWD/wxWidgets/release/bin:$PATH
cd otp
$GITHUB_WORKSPACE/.github/scripts/build-macos.sh build_docs --disable-dynamic-ssl-lib
tar -czf otp_macos_$(cat OTP_VERSION)_x86-64.tar.gz -C release .
- name: Test Erlang
run: |
cd otp/release
./Install -sasl $PWD
./bin/erl -noshell -eval 'io:format("~s", [erlang:system_info(system_version)]), halt().'
./bin/erl -noshell -eval 'ok = crypto:start(), io:format("crypto ok~n"), halt().'
./bin/erl -noshell -eval '{wx_ref,_,_,_} = wx:new(), io:format("wx ok~n"), halt().'
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: otp_prebuilt_macos_x86-64
path: otp/otp_macos_*_x86-64.tar.gz
build-ios:
env:
RELEASE_LIBBEAM: yes
TARGET_ARCH: aarch64-apple-ios
name: Build Erlang/OTP (iOS)
runs-on: macos-12
needs: pack
steps:
- uses: actions/checkout@v3
- name: Download source archive
uses: actions/download-artifact@v3
with:
name: otp_prebuilt
- name: Compile Erlang
run: |
tar -xzf ./otp_src.tar.gz
cd otp
$GITHUB_WORKSPACE/.github/scripts/build-macos.sh --xcomp-conf=./xcomp/erl-xcomp-arm64-ios.conf --without-ssl
- name: Package .xcframework
run: |
cd otp
export BUILD_ARCH=`./erts/autoconf/config.guess`
export LIBS=`find . -not -path "*${BUILD_ARCH}*" -path "*${TARGET_ARCH}*" -not -name "*_st.a" -not -name "*_r.a" -name "*.a" | awk '{ "basename " $1 | getline name; names[name] = $1 } END { for (n in names) { print names[n] }}'`
libtool -static -o liberlang.a $LIBS
xcodebuild -create-xcframework -output ./liberlang.xcframework -library liberlang.a
- name: Upload framework
uses: actions/upload-artifact@v3
with:
name: ios_framework_${{ env.TARGET_ARCH }}
path: otp/liberlang.xcframework
build-windows:
defaults:
run:
shell: wsl-bash {0}
env:
WXWIDGETS_VERSION: 3.1.4
name: Build Erlang/OTP (Windows)
runs-on: windows-2022
needs: pack
steps:
- uses: Vampire/setup-wsl@v2
with:
distribution: Ubuntu-18.04
- name: Install WSL dependencies
run: apt update && apt install -y g++-mingw-w64 gcc-mingw-w64 make autoconf unzip
- name: Install openssl
shell: cmd
run: |
choco install openssl
IF EXIST "c:\\Program Files\\OpenSSL-Win64" (move "c:\\Program Files\\OpenSSL-Win64" "c:\\OpenSSL-Win64") ELSE (move "c:\\Program Files\\OpenSSL" "c:\\OpenSSL-Win64")
- name: Cache wxWidgets
uses: actions/cache@v3
with:
path: wxWidgets
key: wxWidgets-${{ env.WXWIDGETS_VERSION }}-${{ runner.os }}
# actions/cache on Windows sometimes does not set cache-hit even though there was one. Setting it manually.
- name: Set wxWidgets cache
id: wxwidgets-cache
env:
WSLENV: GITHUB_OUTPUT/p
run: |
if [ -d wxWidgets ]; then
echo "cache-hit=true" >> $GITHUB_OUTPUT
else
echo "cache-hit=false" >> $GITHUB_OUTPUT
fi
- name: Download wxWidgets
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WXWIDGETS_VERSION }}/wxWidgets-${{ env.WXWIDGETS_VERSION }}.zip
unzip wxWidgets-${{ env.WXWIDGETS_VERSION }}.zip -d wxWidgets
sed -i -r -e 's/wxUSE_POSTSCRIPT +0/wxUSE_POSTSCRIPT 1/' wxWidgets/include/wx/msw/setup.h
sed -i -r -e 's/wxUSE_WEBVIEW_EDGE +0/wxUSE_WEBVIEW_EDGE 1/' wxWidgets/include/wx/msw/setup.h
- name: Install WebView2
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
cd wxWidgets\\3rdparty
nuget install Microsoft.Web.WebView2 -Version 1.0.705.50 -Source https://api.nuget.org/v3/index.json
rename Microsoft.Web.WebView2.1.0.705.50 webview2
- name: Build wxWidgets
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
cd wxWidgets\\build\\msw
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\Auxiliary\\Build\\vcvars64.bat"
nmake TARGET_CPU=amd64 BUILD=release SHARED=0 DIR_SUFFIX_CPU= -f makefile.vc
- name: Download source archive
uses: actions/download-artifact@v3
with:
name: otp_prebuilt
- name: Compile Erlang
run: |
mkdir -p /mnt/c/opt/local64/pgm/
cp -R wxWidgets /mnt/c/opt/local64/pgm/wxWidgets-${{ env.WXWIDGETS_VERSION }}
tar -xzf ./otp_src.tar.gz
cd otp
export ERL_TOP=`pwd`
export MAKEFLAGS=-j$(($(nproc) + 2))
export ERLC_USE_SERVER=true
export ERTS_SKIP_DEPEND=true
eval `./otp_build env_win32 x64`
./otp_build configure
if cat erts/CONF_INFO ||
grep -v "Static linking with OpenSSL 3.0" lib/*/CONF_INFO ||
cat lib/*/SKIP ||
cat lib/SKIP-APPLICATIONS; then
exit 1
fi
./otp_build boot -a
./otp_build release -a
cp /mnt/c/opt/local64/pgm/wxWidgets-${{ env.WXWIDGETS_VERSION }}/3rdparty/webview2/runtimes/win-x64/native/WebView2Loader.dll $ERL_TOP/release/win32/erts-*/bin/
./otp_build installer_win32
- name: Upload installer
uses: actions/upload-artifact@v3
with:
name: otp_win32_installer
path: otp/release/win32/otp*.exe
build-flavors:
name: Build Erlang/OTP (Types and Flavors)
runs-on: ubuntu-latest
needs: pack
if: contains(needs.pack.outputs.changes, 'emulator')
steps:
- uses: actions/checkout@v3
## Download docker images
- name: Cache BASE image
uses: actions/cache@v3
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build BASE image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" 64-bit
- name: Cache pre-built tar archives
uses: actions/cache@v3
with:
path: |
otp_src.tar.gz
otp_cache.tar.gz
key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
prebuilt-${{ github.ref_name }}-${{ github.sha }}
- name: Build image
run: |
.github/scripts/restore-from-prebuilt.sh `pwd` .github/otp.tar.gz
rm -f otp_{src,cache}.tar.gz
docker build --tag otp \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--file ".github/dockerfiles/Dockerfile.64-bit" \
.github/
- name: Build Erlang/OTP flavors and types
run: |
TYPES="opt debug lcnt"
FLAVORS="emu jit"
for TYPE in ${TYPES}; do
for FLAVOR in ${FLAVORS}; do
echo "::group::{TYPE=$TYPE FLAVOR=$FLAVOR}"
docker run otp "make TYPE=$TYPE FLAVOR=$FLAVOR"
echo "::endgroup::"
done
done
build:
name: Build Erlang/OTP
runs-on: ubuntu-latest
needs: pack
strategy:
matrix:
type: [32-bit,cross-compile,clang]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Download source archive
uses: actions/download-artifact@v3
with:
name: otp_prebuilt
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup GH Runner
run: |
## Delete large files from runner to get more disk space
## See https://github.com/actions/runner-images/issues/2840
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Cache BASE image
uses: actions/cache@v3
if: matrix.type == 'clang'
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}
- name: Build base image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" ${{ matrix.type }}
- name: Build ${{ matrix.type }} image
run: |
mv otp_src.tar.gz .github/otp.tar.gz
docker build --tag otp --file .github/dockerfiles/Dockerfile.${{ matrix.type }} \
.github
documentation:
name: Build and check documentation
runs-on: ubuntu-latest
needs: pack
steps:
- uses: actions/checkout@v3
## Download docker images
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache BASE image
uses: actions/cache@v3
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}
- name: Build BASE image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" 64-bit
- name: Cache pre-built tar archives
uses: actions/cache@v3
with:
path: |
otp_src.tar.gz
otp_cache.tar.gz
key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
prebuilt-${{ github.ref_name }}-${{ github.sha }}
- name: Build image
run: |
.github/scripts/restore-from-prebuilt.sh `pwd` .github/otp.tar.gz
rm -f otp_{src,cache}.tar.gz
docker build --tag otp \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--file ".github/dockerfiles/Dockerfile.64-bit" \
.github/
## Build all the documentation
- name: Build documentation
run: |
docker build -t otp - <<EOF
FROM otp
RUN make release docs release_docs && sudo make install-docs
EOF
- name: Release docs to publish
run: |
docker run -v $PWD/:/github otp \
"make release_docs DOC_TARGETS='man html pdf' RELEASE_ROOT=/github/docs"
sudo chown -R `whoami` docs
cd docs
tar czf ../otp_doc_man.tar.gz man
rm -rf man
tar czf ../otp_doc_html.tar.gz *
- name: Upload html documentation archive
uses: actions/upload-artifact@v3
with:
name: otp_doc_html
path: otp_doc_html.tar.gz
- name: Upload man documentation archive
uses: actions/upload-artifact@v3
with:
name: otp_doc_man
path: otp_doc_man.tar.gz
## Documentation checks
- name: Run xmllint
run: docker run otp "make xmllint"
- name: Run html link check
run: docker run -v $PWD/:/github otp "/github/scripts/otp_html_check /github/docs doc/index.html"
static:
name: Run static analysis
runs-on: ubuntu-latest
needs: pack
steps:
- uses: actions/checkout@v3
## Download docker images
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache BASE image
uses: actions/cache@v3
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}
- name: Build BASE image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" 64-bit
- name: Cache pre-built tar archives
uses: actions/cache@v3
with:
path: |
otp_src.tar.gz
otp_cache.tar.gz
key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
prebuilt-${{ github.ref_name }}-${{ github.sha }}
- name: Build image
run: |
.github/scripts/restore-from-prebuilt.sh `pwd` .github/otp.tar.gz
rm -f otp_{src,cache}.tar.gz
docker build --tag otp \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--file ".github/dockerfiles/Dockerfile.64-bit" \
.github/
- name: Install clang-format
run: |
docker build -t otp - <<EOF
FROM otp
RUN sudo apt-get install -y clang-format
EOF
## Check formatting of cpp code
- name: Check format
run: docker run otp "make format-check"
## Run dialyzer
- name: Run dialyzer
run: docker run -v $PWD/:/github otp '/github/scripts/run-dialyzer'
test:
name: Test Erlang/OTP
runs-on: ubuntu-latest
needs: pack
if: needs.pack.outputs.changes != '[]'
strategy:
matrix:
# type: ${{ fromJson(needs.pack.outputs.all) }}
type: ${{ fromJson(needs.pack.outputs.changes) }}
# type: ["os_mon","sasl"]
fail-fast: false
steps:
- uses: actions/checkout@v3
## Download docker images
- name: Cache BASE image
uses: actions/cache@v3
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build BASE image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" 64-bit
- name: Cache pre-built tar archives
uses: actions/cache@v3
with:
path: |
otp_src.tar.gz
otp_cache.tar.gz
key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
prebuilt-${{ github.ref_name }}-${{ github.sha }}
- name: Build image
run: |
.github/scripts/restore-from-prebuilt.sh `pwd` .github/otp.tar.gz
rm -f otp_{src,cache}.tar.gz
docker build --tag otp \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--file ".github/dockerfiles/Dockerfile.64-bit" \
.github/
- name: Run tests
id: run-tests
run: |
set -x
mkdir $PWD/make_test_dir
APP="${{ matrix.type }}"
## Need to specialize for epmd, emulator and debug
case "${APP}" in
emulator) DIR=erts/emulator/ ;;
epmd) DIR=erts/epmd ;;
debug) DIR=lib/os_mon; APP=os_mon; TYPE=debug ;;
*) DIR=lib/${{ matrix.type }} ;;
esac
sudo service apport stop
sudo bash -c "echo 'core.%p' > /proc/sys/kernel/core_pattern"
docker run --ulimit core=-1 --ulimit nofile=5000:5000 --pids-limit 512 \
-e CTRUN_TIMEOUT=90 -e SPEC_POSTFIX=gh \
-e TEST_NEEDS_RELEASE=true -e "RELEASE_ROOT=/buildroot/otp/Erlang ∅⊤℞" \
-e EXTRA_ARGS="-ct_hooks cth_surefire [{path,\"/buildroot/otp/$DIR/make_test_dir/${{ matrix.type }}_junit.xml\"}]" \
-v "$PWD/make_test_dir:/buildroot/otp/$DIR/make_test_dir" \
-v "$PWD/scripts:/buildroot/otp/scripts" \
otp "make TYPE=${TYPE} && make ${APP}_test TYPE=${TYPE}"
## Rename os_mon to debug for debug build
if [ "$APP" != "${{ matrix.type }}" ]; then
mv make_test_dir/${APP}_test "make_test_dir/${{ matrix.type }}_test"
fi
- name: Cleanup tests
if: always()
run: |
rm -rf make_test_dir/otp || true
sudo bash -c "chown -R `whoami` make_test_dir && chmod -R +r make_test_dir"
tar czf ${{ matrix.type }}_test_results.tar.gz make_test_dir
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.type }}_test_results
path: ${{ matrix.type }}_test_results.tar.gz
system-test:
name: Test Erlang/OTP (system)
runs-on: ubuntu-latest
if: always() # Run even if the need has failed
needs: test
steps:
- uses: actions/checkout@v3
- name: Cache BASE image
uses: actions/cache@v3
with:
path: otp_docker_base.tar
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build BASE image
run: .github/scripts/build-base-image.sh "${BASE_BRANCH}" 64-bit
- name: Download test results
uses: actions/download-artifact@v3
- name: Cache pre-built tar archives
uses: actions/cache@v3
with:
path: |
otp_src.tar.gz
otp_cache.tar.gz
key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
prebuilt-${{ github.ref_name }}-${{ github.sha }}
- name: Build image
run: |
.github/scripts/restore-from-prebuilt.sh `pwd` .github/otp.tar.gz
rm -f otp_{src,cache}.tar.gz
docker build --tag otp \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--file ".github/dockerfiles/Dockerfile.64-bit" \
.github/
- name: Merge test results
run: |
shopt -s nullglob
mkdir -p make_test_dir
for file in *_test_results/*.tar.gz; do
tar xzf $file
done
docker run -v $PWD/make_test_dir:/buildroot/otp/erts/make_test_dir otp \
"ct_run -refresh_logs /buildroot/otp/erts/make_test_dir"
- name: Run system tests
run: |
docker run --ulimit core=-1 --ulimit nofile=5000:5000 --pids-limit 512 \
-e CTRUN_TIMEOUT=90 -e SPEC_POSTFIX=gh \
-e EXTRA_ARGS="-ct_hooks cth_surefire [{path,\"/buildroot/otp/erts/make_test_dir/system_junit.xml\"}]" \
-e OTP_DAILY_BUILD_TOP_DIR=/buildroot/otp/erts/make_test_dir \
-v $PWD/make_test_dir:/buildroot/otp/erts/make_test_dir otp \
"make system_test"
- name: Cleanup tests
if: always()
run: |
rm -rf make_test_dir/otp || true
tar czf test_results.tar.gz make_test_dir
# Translate file="/buildroot/otp/lib/os_mon/make_test_dir/os_mon_test/cpu_sup_SUITE.erl"
# to file="lib/os_mon/test/cpu_sup_SUITE.erl"
sed -i -e 's:file="/buildroot/otp/:file=":g' \
-e 's:\(file="[^/]*/[^/]*/\)make_test_dir/[^/]*:\1test:g' \
-e 's:\(file="erts/\)make_test_dir/[^/]*:\1test:g' \
make_test_dir/*_junit.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: test_results
path: test_results.tar.gz
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Unit Test Results
path: |
make_test_dir/*_junit.xml
## If this is a tag that has been pushed we do some release work
release:
name: Release Erlang/OTP
runs-on: ubuntu-latest
needs: documentation
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'erlang/otp'
steps:
## This step outputs the tag name and whether the tag is a release or patch
## (all releases have only two version identifiers, while patches have three
## or more)
- name: Get Tag Name
id: tag
run: |
TAG=${GITHUB_REF#refs/tags/}
VSN=${TAG#OTP-}
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "vsn=${VSN}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
## Publish the pre-built archive and docs
- name: Download source archive
uses: actions/download-artifact@v3
with:
name: otp_prebuilt
- name: Download html docs
uses: actions/download-artifact@v3
with:
name: otp_doc_html
- name: Download man docs
uses: actions/download-artifact@v3
with:
name: otp_doc_man
## We add the correct version name into the file names
## and create the hash files for all assets
- name: Create pre-build and doc archives
run: .github/scripts/create-artifacts.sh artifacts ${{ steps.tag.outputs.tag }}
## Create hash files
- name: Create pre-build and doc archives
run: |
shopt -s nullglob
cd artifacts
FILES=$(ls {*.tar.gz,*.txt})
md5sum $FILES > MD5.txt
sha256sum $FILES > SHA256.txt
- name: Upload pre-built and doc tar archives
uses: softprops/action-gh-release@v1
with:
name: OTP ${{ steps.tag.outputs.vsn }}
files: |
artifacts/*.tar.gz
artifacts/*.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy on erlang.org
env:
GITHUB_TOKEN: ${{ secrets.TRIGGER_ERLANG_ORG_BUILD }}
run: |
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/erlang/erlang-org/actions/workflows/update-gh-cache.yaml/dispatches" -d '{"ref":"master"}'
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}