-
Notifications
You must be signed in to change notification settings - Fork 7
753 lines (721 loc) · 27.1 KB
/
test.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
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
name: Build, Test & Release
# Build, Test & Release (BTR) run for:
# - pushes to the main branch
# - new tags are pushed
# - for pull requests
#
# Releases are tagged with vX.Y.Z. We determine if we are building for a release
# or not by looking if the tag name starts with 'v'.
#
# To release:
# - create new branch using name: release-vX.Y.Z
# - update version in common.mk
# - update CHANGELOG.md, second entry must equal version in common.mk
# - first entry is assumed to be "Unreleased"
# - push a tag like vX.Y.Z which is equal to version in common.mk
#
on:
pull_request:
push:
branches:
- main
tags:
- v*
schedule:
# Schedule to run daily
- cron: '4 0 * * *'
# NOTE: Jobs for version tagged releases just pattern match on any tag starting
# with 'v'. That's probably a version tag, but could be something else. Is there
# a better way to match?
jobs:
matrix_maker_macos:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
steps:
- name: "Set Matrix for PR or push"
if: github.event_name != 'schedule'
id: setmatrix_pr
run: |
MATRIX_JSON='{\"include\":[{\"os\":\"macos\",\"version\":\"13\",\"arch\":\"x86_64\",\"cache\":true},{\"os\":\"macos\",\"version\":\"14\",\"arch\":\"aarch64\",\"cache\":true}]}'
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
- name: "Set Matrix for nightly run"
if: github.event_name == 'schedule'
id: setmatrix_cron
run: |
MATRIX_JSON='{\"include\":[{\"os\":\"macos\",\"version\":\"13\",\"arch\":\"x86_64\",\"cache\":true},{\"os\":\"macos\",\"version\":\"14\",\"arch\":\"aarch64\",\"cache\":true},{\"os\":\"macos\",\"version\":\"15\",\"arch\":\"aarch64\",\"cache\":false}]}'
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
- name: "Set final matrix output"
id: setmatrix
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "matrix=${{ steps.setmatrix_cron.outputs.matrix }}" >> $GITHUB_OUTPUT
else
echo "matrix=${{ steps.setmatrix_pr.outputs.matrix }}" >> $GITHUB_OUTPUT
fi
- name: "Debug: Print matrix JSON"
run: |
echo "Matrix JSON:"
echo '${{ toJson(fromJson(steps.setmatrix.outputs.matrix)) }}'
echo "Event name: ${{ github.event_name }}"
test-macos:
needs: matrix_maker_macos
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_maker_macos.outputs.matrix) }}
runs-on: ${{ matrix.os }}-${{ matrix.version }}
steps:
- name: "Show env"
run: env
- name: "Set BUILD_RELEASE when we are building for a version tag"
run: |
echo "BUILD_RELEASE=1" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: "Enable dumping core files"
run: |
sudo sysctl kern.corefile=core.%P
ulimit -c unlimited
- name: "Check out repository code"
uses: actions/checkout@v4
- name: "Cache stuff"
if: matrix.cache == true
uses: actions/cache@v4
with:
path: |
~/.cache/acton/
~/.stack
key: test-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.arch }}
- name: "Install build prerequisites"
run: brew install haskell-stack
- name: "Build Acton"
run: |
make -j2 -C ${{ github.workspace }} BUILD_RELEASE=${{ env.BUILD_RELEASE }}
- name: "Build a release"
run: make -C ${{ github.workspace }} release
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: acton-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.arch }}
path: ${{ github.workspace }}/acton-*
if-no-files-found: error
- name: "Run tests"
run: |
ulimit -c unlimited
make -C ${{ github.workspace }} test
- name: "Upload whole test dir as artifact on test failure"
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-debug-${{ matrix.os }}-${{ github.run_id }}.zip
path: |
${{ github.workspace }}/test
matrix_maker_linux:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
steps:
- name: "Set Matrix for PR or push"
if: github.event_name != 'schedule'
id: setmatrix_pr
run: |
MATRIX_JSON='{\"include\":[{\"os\":\"debian\",\"version\":\"12\",\"arch\":\"x86_64\",\"cache\":true}]}'
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
- name: "Set Matrix for nightly run"
if: github.event_name == 'schedule'
id: setmatrix_cron
run: |
MATRIX_JSON='{\"include\":[{\"os\":\"debian\",\"version\":\"11\",\"arch\":\"x86_64\",\"cache\":false},{\"os\":\"debian\",\"version\":\"12\",\"arch\":\"x86_64\",\"cache\":true},{\"os\":\"ubuntu\",\"version\":\"22.04\",\"arch\":\"x86_64\",\"cache\":false},{\"os\":\"ubuntu\",\"version\":\"24.04\",\"arch\":\"x86_64\",\"cache\":false}]}'
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
- name: "Set final matrix output"
id: setmatrix
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "matrix=${{ steps.setmatrix_cron.outputs.matrix }}" >> $GITHUB_OUTPUT
else
echo "matrix=${{ steps.setmatrix_pr.outputs.matrix }}" >> $GITHUB_OUTPUT
fi
- name: "Debug: Print matrix JSON"
run: |
echo "Matrix JSON:"
echo '${{ toJson(fromJson(steps.setmatrix.outputs.matrix)) }}'
echo "Event name: ${{ github.event_name }}"
test-linux:
needs: matrix_maker_linux
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_maker_linux.outputs.matrix) }}
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}:${{ matrix.version }}
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
steps:
- name: "Show platform and environment"
run: |
env
cat /proc/cpuinfo
- name: "Set BUILD_RELEASE when we are building for a version tag"
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "BUILD_RELEASE=1" >> $GITHUB_ENV
- name: "Check out repository code"
uses: actions/checkout@v4
- name: "Cache stuff"
if: matrix.cache == true
uses: actions/cache@v4
with:
path: |
~/.cache/acton/
~/.stack
key: test-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.arch }}
- name: "chown our home dir to avoid stack complaining"
run: chown -R root:root /github/home
- name: "Install build prerequisites"
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -qy bzip2 curl g++ gdb haskell-stack make procps zlib1g-dev
- name: "locale en_US.UTF-8"
run: |
apt-get install -qy locales
locale-gen en_US.UTF-8
echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections
echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections
rm "/etc/locale.gen"
dpkg-reconfigure --frontend noninteractive locales
- name: "Upgrade stack on old distributions"
if: ${{ (matrix.os == 'ubuntu' && (matrix.version == '20.04' || matrix.version == '22.04')) || (matrix.os == 'debian' && matrix.version == '11') }}
run: |
stack upgrade
echo "PATH=~/.local/bin:$PATH" >> $GITHUB_ENV
- name: "Build Acton"
run: |
make -j2 -C ${GITHUB_WORKSPACE} BUILD_RELEASE=${{ env.BUILD_RELEASE }}
- name: "Build a release"
run: make -C ${GITHUB_WORKSPACE} release
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: acton-${{ matrix.os }}-${{ matrix.version }}
path: ${{ github.workspace }}/acton-*
if-no-files-found: error
- name: "Run tests"
run: |
ulimit -c unlimited
make -C ${GITHUB_WORKSPACE} test
- name: "Upload whole test dir as artifact on test failure"
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-debug-${{ matrix.os }}-${{ github.run_id }}.zip
path: |
${{ github.workspace }}/test
build-debs:
runs-on: ubuntu-latest
container:
image: debian:12
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
steps:
- name: "Show platform and environment"
run: |
env
cat /proc/cpuinfo
- name: "Set BUILD_RELEASE when we are building for a version tag"
run: |
echo "BUILD_RELEASE=1" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: "Install build prerequisites"
run: |
apt-get update
apt-get install -qy bzip2 curl g++ haskell-stack make procps zlib1g-dev
apt-get install -qy bash-completion build-essential debhelper devscripts
- name: "Check out repository code"
uses: actions/checkout@v4
- name: "Cache stuff"
uses: actions/cache@v4
with:
path: |
./debian/.debhelper/
~/.stack
key: build-debs
- name: "locale en_US.UTF-8"
run: |
apt-get install -qy locales
locale-gen en_US.UTF-8
echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections
echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections
rm "/etc/locale.gen"
dpkg-reconfigure --frontend noninteractive locales
- name: "Upgrade stack on old distributions"
if: ${{ (matrix.os == 'ubuntu' && (matrix.version == '20.04' || matrix.version == '22.04')) || (matrix.os == 'debian' && matrix.version == '11') }}
run: |
stack upgrade
echo "PATH=~/.local/bin:$PATH" >> $GITHUB_ENV
- name: "Build Debian packages"
run: |
make -C ${GITHUB_WORKSPACE} debs BUILD_RELEASE=${{ env.BUILD_RELEASE }}
- name: "Compute variables"
id: vars
run: |
echo "debdir=$(realpath ${GITHUB_WORKSPACE}/../deb)" >> $GITHUB_OUTPUT
echo "artifact_dir=$(dirname ${{ github.workspace }})" >> $GITHUB_OUTPUT
- name: "Move deb files into place for easy artifact extraction"
run: |
mkdir -p ${{ steps.vars.outputs.debdir }}
ls ${{ steps.vars.outputs.debdir }}/../
mv ${{ steps.vars.outputs.debdir }}/../acton_* ${{ steps.vars.outputs.debdir }}/
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: acton-debs
# Using a wildcard and then deb here to force the entire directory to
# be part of resulting artifact.
path: ${{ steps.vars.outputs.artifact_dir }}/*deb/
if-no-files-found: error
run-macos:
needs: test-macos
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, macos-15]
runs-on: ${{ matrix.os }}
steps:
- name: "Machine info"
run: |
uname -a
system_profiler SPHardwareDataType
- name: "Download artifacts for Macos x86_64, built on macos-13"
if: ${{ matrix.os == 'macos-13' }}
uses: actions/download-artifact@v3
with:
name: acton-macos-13-x86_64
- name: "Download artifacts for Macos arm64, built on macos-14"
if: ${{ matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
uses: actions/download-artifact@v3
with:
name: acton-macos-14-aarch64
- name: "Extract acton"
run: |
tar Jxf $(ls acton-macos-*.tar.xz | tail -n1)
- name: "Compile acton program"
run: |
export PATH=$(pwd)/acton/bin:$PATH
acton version --full
echo '#!/usr/bin/env runacton' > test-runtime.act
echo 'actor main(env):' >> test-runtime.act
echo ' print("Hello, world")' >> test-runtime.act
echo ' env.exit(0)' >> test-runtime.act
chmod a+x test-runtime.act
./test-runtime.act
./test-runtime.act | grep "Hello, world"
run-linux:
needs: build-debs
strategy:
fail-fast: false
matrix:
include:
- os: "debian"
version: "10"
- os: "debian"
version: "11"
- os: "debian"
version: "12"
- os: "ubuntu"
version: "18.04"
- os: "ubuntu"
version: "20.04"
- os: "ubuntu"
version: "22.04"
- os: "ubuntu"
version: "24.04"
env:
# This makes it possible for the GitHub Action itself to run using an
# older version of node, which is the only possibility to get it running
# on Ubuntu 18.04 (in the matrix above)
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}:${{ matrix.version }}
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- name: "Show platform and environment"
run: |
env
cat /proc/cpuinfo
- name: "Download .deb files"
uses: actions/download-artifact@v3 # Ubuntu 18.04 doesn't support v4 which uses Node 20 which depends on glibc 2.28
with:
name: acton-debs
- name: "Install acton from .deb"
run: |
apt update
apt install -y ./deb/acton_*.deb
acton --version
- name: "Enable dumping core files to /tmp/core..."
run: |
apt install -qy procps
cat /proc/sys/kernel/core_pattern
sysctl kernel.core_pattern='/tmp/core.%h.%e.%t' || true
cat /proc/sys/kernel/core_pattern
ulimit -c unlimited
- name: "Compile acton program"
run: |
echo '#!/usr/bin/env runacton' > acton-test.act
echo 'actor main(env):' >> acton-test.act
echo ' print("Hello, world")' >> acton-test.act
echo ' env.exit(0)' >> acton-test.act
chmod a+x acton-test.act
./acton-test.act
./acton-test.act | grep "Hello, world"
- name: "ls core"
if: failure()
run: |
pwd
ls
find /tmp
mv /tmp/core* .
- name: "Upload core file & binaries as artifacts on test failure"
if: failure()
uses: actions/upload-artifact@v3
with:
name: coredumps-${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}.zip
path: |
${{ github.workspace }}/core*
perf-vs-main:
needs: build-debs
# Use our own runner to get more deterministic results
runs-on: [self-hosted, linux, X64]
steps:
- name: "Check out repository code"
uses: actions/checkout@v4
- name: "Remove any currently install Acton to ensure clean slate"
run: |
sudo apt-get purge -qy acton
- name: "Install Acton from APT tip repo"
run: |
wget -q -O - https://apt.acton-lang.io/acton.gpg | sudo apt-key add -
echo "deb [arch=amd64] http://aptip.acton-lang.io/ tip main" | sudo tee /etc/apt/sources.list.d/acton.list
sudo apt-get update
sudo apt-get install -qy acton
acton --version
- name: "Run perf tests and record"
run: |
acton --version
cd test/stdlib_tests
acton test perf --record
cd ../perf
acton test perf --record
- name: "Download .deb files"
uses: actions/download-artifact@v3
with:
name: acton-debs
- name: "Install acton from .deb"
run: |
sudo dpkg -i ./deb/acton_*.deb
acton --version
- name: "Run perf tests to compare"
run: |
cd test/stdlib_tests
rm -rf out
acton test perf
cd ../perf
rm -rf out
acton test perf
# Telemetrify is the largest application written in Acton, we want to make
# sure we don't break it..
test-telemetrify:
needs: build-debs
runs-on: ubuntu-latest
container:
image: debian:experimental
steps:
- name: "Cache stuff"
uses: actions/cache@v4
with:
path: |
~/.cache/acton/
key: test-telemetrify
- name: "Download .deb files"
uses: actions/download-artifact@v3
with:
name: acton-debs
- name: "Install acton from .deb"
run: |
apt update
apt install -qy make netcat-openbsd
apt install -y ./deb/acton_*.deb
acton --version
- name: "Clone Telemetrify and check out acton-next branch"
uses: actions/checkout@v4
with:
repository: telemetrify-collector/telemetrify
path: telemetrify
ref: 'acton-next'
- name: "Compile acton program"
run: |
cd telemetrify
make build
make test
cd tests/nso-replay
make start
make test
test-app-orchestron:
needs: build-debs
uses: "./.github/workflows/test-app.yml"
with:
repo_url: "orchestron-orchestrator/orchestron"
test-app-snappy:
needs: build-debs
uses: "./.github/workflows/test-app.yml"
with:
repo_url: "actonlang/acton-snappy"
test-app-yang:
needs: build-debs
uses: "./.github/workflows/test-app.yml"
with:
repo_url: "orchestron-orchestrator/acton-yang"
# If we are on the main branch, we'll create or update a pre-release called
# 'tip' which holds the latest build output from the main branch! We upload
# artifacts twice, first with the version number held in the filename and a
# second time after being renamed to remove the version number in the
# filename, thus providing a stable URL for downloading the tip tar balls.
pre-release-tip:
# Only run on the main branch
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [test-macos, test-linux, build-debs]
steps:
- name: "Delete current tip release & tag"
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: tip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Check out repository code"
uses: actions/checkout@v4
- name: "Download artifacts for Macos x86_64, built on macos-13"
uses: actions/download-artifact@v3
with:
name: acton-macos-13-x86_64
- name: "Download artifacts for Linux x86_64, built on Debian:12"
uses: actions/download-artifact@v3
with:
name: acton-debian-12
- name: "Download artifacts for Debian Linux x86_64"
uses: actions/download-artifact@v3
with:
name: acton-debs
- name: "List downloaded artifacts"
run: |
ls
ls deb
- name: "Workaround for changelog extractor that looks for number versions in headlines, which won't work for 'Unreleased'"
run: sed -i -e 's/^## Unreleased/## [999.9] Unreleased\nThis is an unreleased snapshot built from the main branch. Like a nightly but more up to date./' CHANGELOG.md
- name: "Extract release notes"
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
- name: "(re-)create 'tip' release notes and upload artifacts as assets"
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "acton*.tar*,deb/*deb"
body: ${{ steps.extract-release-notes.outputs.release_notes }}
draft: false
prerelease: true
name: "tip"
tag: "tip"
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
- name: "Remove version number from macos tar ball"
run: mv $(ls acton-macos-x86_64*.tar.xz | tail -n1) acton-macos-x86_64-tip.tar.xz
- name: "Remove version number from linux tar ball"
run: mv $(ls acton-linux-x86_64*.tar.xz | tail -n1) acton-linux-x86_64-tip.tar.xz
- name: "Remove version number from debian package"
run: mv $(ls deb/acton_*.deb | tail -n1) deb/acton_tip_amd64.deb
- name: "List files for debug"
run: |
ls
ls deb
- name: "Upload artifacts without version number for stable links"
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "acton*.tar*,deb/acton_*.deb"
body: ${{ steps.extract-release-notes.outputs.release_notes }}
draft: false
prerelease: true
name: "tip"
tag: "tip"
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
# Release job, only run for version tagged releases.
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [test-macos, test-linux, build-debs]
steps:
- name: "Check out repository code"
uses: actions/checkout@v4
- name: "Download artifacts for Macos, built on macos-13"
uses: actions/download-artifact@v3
with:
name: acton-macos-13-x86_64
- name: "Download artifacts for Linux, built on Debian:12"
uses: actions/download-artifact@v3
with:
name: acton-debian-12
- name: "Download artifacts for Debian Linux"
uses: actions/download-artifact@v3
with:
name: acton-debs
- name: "List downloaded artifacts"
run: ls
- name: "Extract release notes"
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
- name: "Create release"
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "acton*.tar*,deb/*deb"
body: ${{ steps.extract-release-notes.outputs.release_notes }}
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
# Update apt repo
update-apt-repo:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
container:
image: debian:experimental
needs: [test-macos, test-linux, build-debs]
steps:
- name: Install build prerequisites
run: |
apt-get update
apt-get install -qy -t experimental reprepro
apt-get install -qy git gnupg
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.APT_GPG_PRIVATE_KEY }}
- name: Check out code of apt.acton-lang.io repo
uses: actions/checkout@v4
with:
repository: actonlang/apt.acton-lang.io
path: apt
ssh-key: ${{ secrets.APT_DEPLOY_KEY }}
- name: "Download artifacts for Debian Linux"
uses: actions/download-artifact@v3
with:
name: acton-debs
- name: "Get the version"
id: get_version
run: |
echo ::set-output name=version::$(ls ../deb/*.changes | sed -e 's/.*acton_//' -e 's/_amd64.*//')
- name: "Include new deb in Apt repository"
run: |
cd apt
reprepro include stable ../deb/*.changes
- name: "Push updates to git repository for apt.acton-lang.io"
run: |
cd apt
git config user.name "Apt Bot"
git config user.email [email protected]
git add .
git status
git diff
git commit -a -m "Add Acton v${{steps.get_version.outputs.version}}"
git push
# Update apt tip repo
update-apt-tip-repo:
# Only run on the main branch
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
container:
image: debian:experimental
permissions:
contents: write
needs: [test-macos, test-linux, build-debs]
steps:
- name: Install build prerequisites
run: |
apt-get update
apt-get install -qy -t experimental reprepro
apt-get install -qy git gnupg
- name: Check out code of aptip.acton-lang.io repo
uses: actions/checkout@v4
with:
repository: actonlang/aptip.acton-lang.io
path: apt
ssh-key: ${{ secrets.APT_TIP_DEPLOY_KEY }}
- name: "Download artifacts for Debian Linux"
uses: actions/download-artifact@v3
with:
name: acton-debs
- name: "Get the version"
id: get_version
run: |
echo "VERSION=$(ls deb/*.changes | sed -e 's/.*acton_//' -e 's/_amd64.*//')" >> $GITHUB_ENV
echo ::set-output name=version::$(ls deb/*.changes | sed -e 's/.*acton_//' -e 's/_amd64.*//')
- name: "Move .deb files in place"
run: |
cd apt
mv -v ../deb/* deb/
- name: "Configure git"
run: |
cd apt
git config user.name "Apt Bot"
git config user.email [email protected]
- name: "Push updates to git repository for aptip.acton-lang.io"
run: |
cd apt
git add deb/*
git status
git commit -a -m "Add Acton tip v${VERSION}"
git push
# Update our homebrew tap
update-homebrew:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
# Depend on all test jobs so we don't update brew repo in case anything fails
needs: [test-macos, test-linux, build-debs]
steps:
- name: "Check out code of main acton repo"
uses: actions/checkout@v4
- name: "Get the version from common.mk"
id: get_version
run: echo "version=$(grep VERSION= common.mk | cut -d = -f 2)" >> $GITHUB_OUTPUT
- run: wget https://github.com/actonlang/acton/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz
- run: sha256sum v${{ steps.get_version.outputs.version }}.tar.gz
- id: shasum
run: echo "sum=$(sha256sum v${{ steps.get_version.outputs.version }}.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
- name: "Check out code of our brew repo"
uses: actions/checkout@v4
with:
repository: actonlang/homebrew-acton
path: homebrew-acton
- name: "Update formula in homebrew-acton from acton repo"
run: |
cp homebrew/Formula/acton.rb homebrew-acton/Formula/acton.rb
- name: "Update brew formula for acton with new version"
run: |
sed -i -e 's,^ url.*, url "https://github.com/actonlang/acton/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz",' -e 's/^ sha256.*/ sha256 "${{ steps.shasum.outputs.sum }}"/' homebrew-acton/Formula/acton.rb
- name: "Create Pull Request"
uses: peter-evans/create-pull-request@v7
with:
path: homebrew-acton
token: ${{ secrets.ACTBOT_PAT }}
branch: acton-v${{ steps.get_version.outputs.version }}
title: "acton v${{ steps.get_version.outputs.version }}"
body: |
Automatic update triggered by release on actonlang/acton.
committer: Acton Bot <[email protected]>
commit-message: "acton v${{ steps.get_version.outputs.version }}"
signoff: false