-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (191 loc) · 6.01 KB
/
setup-erlang.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
name: Setup Erlang
on:
push:
branches:
- master
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
libc: [glibc, musl]
exclude:
- arch: arm64
libc: musl
container: ${{ matrix.libc == 'musl' && 'alpine:3' || 'debian:12' }}
steps:
- uses: actions/checkout@v4
- uses: ./
# On Alpine, we need to install the dependencies for the Erlang runtime
# as they are not included in the base image.
- run: apk update && apk add --no-cache libstdc++ libgcc ncurses-libs
if: matrix.libc == 'musl'
# We also need to install the dependencies of rebar3 (compilers, curl and
# git).
- run: apt-get update && apt-get install -y autoconf gcc g++ make git curl
if: matrix.libc == 'glibc'
- run: apk add --no-cache autoconf gcc g++ make git curl
if: matrix.libc == 'musl'
- run: cd dummy-release && ./rebar3 as prod release
- run: cd dummy-escript && ./rebar3 escriptize
build-ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
version: [25, 26, 27]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
erlang-version: ${{ matrix.version }}
- run: cd dummy-release && ./rebar3 as prod release
- run: cd dummy-escript && ./rebar3 escriptize
- run: |
mv dummy-release/_build/prod/rel/hello_world server
mkdir client
mv dummy-escript/_build/default/* client
tar -czf ubuntu-applications.tar.gz client server
- uses: actions/upload-artifact@v4
with:
name: erlang-${{ matrix.version }}-ubuntu-applications
path: ubuntu-applications.tar.gz
test-ubuntu:
runs-on: ubuntu-latest
needs: build-ubuntu
strategy:
matrix:
version: [25, 26, 27]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: erlang-${{ matrix.version }}-ubuntu-applications
- run: |
tar -xzf ubuntu-applications.tar.gz
./server/bin/hello_world daemon
sleep 1
./server/bin/hello_world ping | grep -q "pong" || exit 1
- uses: ./
with:
erlang-version: ${{ matrix.version }}
- run: |
./client/bin/hello_world world | grep -q "Hello world!" || exit 1
build-macos:
runs-on: macos-latest
strategy:
matrix:
version: [25, 26, 27]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
erlang-version: ${{ matrix.version }}
- run: cd dummy-release && ./rebar3 as prod release
- run: cd dummy-escript && ./rebar3 escriptize
- run: |
mv dummy-release/_build/prod/rel/hello_world server
mkdir client
mv dummy-escript/_build/default/* client
tar -czf macos-applications.tar.gz client server
- uses: actions/upload-artifact@v4
with:
name: erlang-${{ matrix.version }}-macos-applications
path: macos-applications.tar.gz
test-macos:
runs-on: macos-latest
needs: build-macos
strategy:
matrix:
version: [25, 26, 27]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: erlang-${{ matrix.version }}-macos-applications
- run: |
tar -xzf macos-applications.tar.gz
./server/bin/hello_world daemon
sleep 1
./server/bin/hello_world ping | grep -q "pong" || exit 1
- uses: ./
with:
erlang-version: ${{ matrix.version }}
- run: |
./client/bin/hello_world world | grep -q "Hello world!" || exit 1
build-windows:
runs-on: windows-latest
strategy:
matrix:
version: [25, 26, 27]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
erlang-version: ${{ matrix.version }}
- run: cd dummy-release && ./rebar3 as prod release
- run: cd dummy-escript && ./rebar3 escriptize
# XXX: This needs to be implemented. On Windows, it requires admin level to
# start the Erlang application.
# - run: |
# mv dummy-release/_build/prod/rel/hello_world server
# mkdir client
# mv dummy-escript/_build/default/* client
# tar -czf windows-applications.tar.gz client server
# - uses: actions/upload-artifact@v4
# with:
# name: erlang-${{ matrix.version }}-windows-applications
# path: windows-applications.tar.gz
# test-windows:
# runs-on: windows-latest
# needs: build-windows
# strategy:
# matrix:
# version: [25]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# name: erlang-${{ matrix.version }}-windows-applications
# - run: |
# tar -xzf windows-applications.tar.gz
# ./server/bin/hello_world start
# sleep 1
# ./server/bin/hello_world ping | grep -q "pong" || exit 1
# - uses: ./
# with:
# erlang-version: ${{ matrix.version }}
# - run: |
# ./client/bin/hello_world world | grep -q "Hello world!" || exit 1
test-rebar3:
strategy:
matrix:
platform: [ubuntu, macos, windows]
runs-on: ${{ matrix.platform }}-latest
steps:
- uses: actions/checkout@v4
# We remove the provided rebar3 scripts so we can test if the action
# actually install rebar3.
- run: |
rm dummy-release/rebar3*
rm dummy-escript/rebar3*
- uses: ./
with:
install-rebar3: true
- run: cd dummy-release && rebar3 as prod release
- run: cd dummy-escript && rebar3 escriptize
test-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
id: setup-erlang
with:
erlang-version: 25
# Check if the installed version of Erlang is correct.
- run: |
if [ "${{ steps.setup-erlang.outputs.erlang-version }}" != "25.3.2.15" ]; then
echo "Unexpected Erlang version: ${{ steps.setup-erlang.outputs.erlang-version }}"
exit 1
fi
echo "Erlang version: ${{ steps.setup-erlang.outputs.erlang-version }} was installed."