forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 3
290 lines (260 loc) · 10.3 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
##
## 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.
##
## When ghcr.io support using the GITHUB_TOKEN we should migrate
## over to use it instead as that should allow us to 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.
##
name: Build and check Erlang/OTP
on:
push:
pull_request:
jobs:
pack:
name: Pack the Erlang/OTP tar.gz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create initial pre-release tar
run: .github/scripts/init-pre-release.sh
- name: Upload source tar archive
uses: actions/upload-artifact@v2
with:
name: otp_git_archive
path: otp_src.tar.gz
build-windows:
defaults:
run:
shell: wsl-bash {0}
env:
WXWIDGETS_VERSION: 3.1.4
name: Build Erlang/OTP on Windows
runs-on: windows-2022
needs: pack
steps:
- uses: Vampire/setup-wsl@v1
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
move "c:\\Program Files\\OpenSSL-Win64" "c:\\OpenSSL-Win64"
- name: Cache wxWidgets
uses: actions/cache@v2
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
run: |
if [ -d wxWidgets ]; then
echo "::set-output name=cache-hit::true"
else
echo "::set-output name=cache-hit::false"
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@v2
with:
name: otp_git_archive
- 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=-j4
export ERLC_USE_SERVER=true
export ERTS_SKIP_DEPEND=true
eval `./otp_build env_win32 x64`
./otp_build configure
if cat erts/CONF_INFO || cat 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@v2
with:
name: otp_prebuilt_win32
path: otp/release/win32/otp*.exe
build:
name: Build Erlang/OTP
runs-on: ubuntu-latest
needs: pack
strategy:
matrix:
type: [64-bit,32-bit,cross-compile,documentation]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Download source archive
uses: actions/download-artifact@v2
with:
name: otp_git_archive
- name: Docker login
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate BASE image
id: base
run: |
BASE_TAG=$(grep "^FROM" .github/dockerfiles/Dockerfile.${{ matrix.type }} | head -1 | awk '{print $2}')
echo "::set-output name=BASE_TAG::${BASE_TAG}"
.github/scripts/base-tag "${BASE_TAG}"
- name: Pull BASE image
run: docker pull ${{ steps.base.outputs.BASE_TAG }}
- name: Build BASE image
run: |
docker build --pull --tag ${{ steps.base.outputs.BASE_TAG }} \
--cache-from ${{ steps.base.outputs.BASE_TAG }} \
--file .github/dockerfiles/Dockerfile.${{ steps.base.outputs.BASE_TYPE }} \
--build-arg BASE=${{ steps.base.outputs.BASE }} .
- name: Build ${{ matrix.type }} image
run: |
docker build --tag otp --file .github/dockerfiles/Dockerfile.${{ matrix.type }} \
--build-arg ARCHIVE=otp_src.tar.gz .
## Smoke build tests
- if: matrix.type == '32-bit' || matrix.type == '64-bit' || matrix.type == 'cross-compile'
name: Run smoke test
run: docker run -v $PWD/scripts:/scripts otp "cd /tests && /scripts/run-smoke-tests"
## Documentation checks
- if: matrix.type == 'documentation'
name: Run xmllimt
run: docker run otp "make xmllint"
- if: matrix.type == 'documentation'
name: Run html link check
run: docker run -v $PWD/scripts:/scripts otp "/scripts/otp_html_check /otp doc/index.html"
- if: matrix.type == 'documentation'
name: Release docs to publish
run: .github/scripts/release-docs.sh
- if: matrix.type == 'documentation'
name: Upload html documentation archive
uses: actions/upload-artifact@v2
with:
name: otp_doc_html
path: otp_doc_html.tar.gz
- if: matrix.type == 'documentation'
name: Upload man documentation archive
uses: actions/upload-artifact@v2
with:
name: otp_doc_man
path: otp_doc_man.tar.gz
## Check formatting of cpp code
- if: matrix.type == '64-bit'
name: Check format
run: docker run -v $PWD/scripts:/scripts otp "make format-check"
## Run dialyzer
- if: matrix.type == '64-bit'
name: Run dialyzer
run: docker run -v $PWD/scripts:/scripts otp "/scripts/run-dialyzer"
## Build pre-built tar archives
- if: matrix.type == '32-bit'
name: Build pre-built tar archives
run: |
docker run -v $PWD:/github otp \
"scripts/build-otp-tar -o /github/otp_clean_src.tar.gz /github/otp_src.tar.gz -b /buildroot/otp/ /buildroot/otp.tar.gz"
- if: matrix.type == '32-bit'
name: Upload pre-built tar archive
uses: actions/upload-artifact@v2
with:
name: otp_prebuilt
path: otp_src.tar.gz
## If this is a tag that has been pushed we do some release work
release:
name: Release Erlang/OTP
runs-on: ubuntu-latest
needs: build
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/}
IS_RELEASE=`$(echo $TAG | grep -E '^OTP-[0-9]+\.[0-9]+$' > /dev/null) \
&& echo "true" || echo "false"`
VSN=${TAG#OTP-}
echo "::set-output name=tag::${TAG}"
echo "::set-output name=release::${IS_RELEASE}"
echo "::set-output name=vsn::${VSN}"
- uses: actions/checkout@v2
## Publish the pre-built archive and docs
- name: Download source archive
uses: actions/download-artifact@v2
with:
name: otp_prebuilt
- name: Download html docs
uses: actions/download-artifact@v2
with:
name: otp_doc_html
- name: Download man docs
uses: actions/download-artifact@v2
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 }}
- name: Build OTP Bundle
if: steps.tag.outputs.release == 'true'
run: |
scripts/bundle-otp ${{ steps.tag.outputs.tag }}
## Create hash files
- name: Create pre-build and doc archives
run: |
shopt -s nullglob
cd artifacts
md5sum {*.tar.gz,*.txt} > MD5.txt
sha256sum {*.tar.gz,*.txt} > 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"}'