forked from WasmEdge/WasmEdge
-
Notifications
You must be signed in to change notification settings - Fork 0
389 lines (379 loc) · 14.1 KB
/
build.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
name: Build and Test WasmEdge on multiple platforms
concurrency:
group: build-${{ github.head_ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths-ignore:
- '.github/workflows/rust*.yml'
- 'docs/**'
- 'bindings/**'
- 'rpm/**'
- '**/*.md'
pull_request:
branches:
- master
- 'proposal/**'
paths-ignore:
- '.github/workflows/rust*.yml'
- 'docs/**'
- 'bindings/**'
- 'rpm/**'
- '**/*.md'
jobs:
get_version_v1:
name: Retrieve version information (v1)
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prep.outputs.version }}
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Get version
id: prep
run: |
# Retrieve annotated tags. Details: https://github.com/actions/checkout/issues/290
git fetch --tags --force
echo "Set version: $(git describe --match "[0-9].[0-9]*" --tag)"
echo ::set-output name=version::$(git describe --match "[0-9].[0-9]*" --tag)
get_version_v2:
name: Retrieve version information (v2)
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prep.outputs.version }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get version
id: prep
run: |
# Retrieve annotated tags. Details: https://github.com/actions/checkout/issues/290
git fetch --tags --force
echo "Set version: $(git describe --match "[0-9].[0-9]*" --tag)"
echo ::set-output name=version::$(git describe --match "[0-9].[0-9]*" --tag)
create_source_tarball:
name: Create source tarball
runs-on: ubuntu-latest
needs: get_version_v2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Propagate version information for tarball
run: |
echo $VERSION | tee VERSION
env:
VERSION: ${{ needs.get_version_v2.outputs.version }}
- name: Create source tarball
run: |
echo "Get version: $VERSION"
TEMPDIR=$(mktemp -d)
SRCDIR="$TEMPDIR/wasmedge/"
mkdir -p "$SRCDIR"
git checkout-index -a --prefix="$SRCDIR"
cp -v VERSION $SRCDIR
tar --owner 0 --group 0 -czf "$GITHUB_WORKSPACE/WasmEdge-$VERSION.tar.gz" -C "$TEMPDIR" "wasmedge"
env:
VERSION: ${{ needs.get_version_v2.outputs.version }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: WasmEdge-${{ needs.get_version_v2.outputs.version }}-src.tar.gz
path: WasmEdge-${{ needs.get_version_v2.outputs.version }}.tar.gz
build_fedora:
name: Fedora 35
needs: get_version_v2
runs-on: ubuntu-latest
container:
image: fedora:latest
steps:
- name: Install requirment
run: |
dnf update -y
dnf install -y cmake ninja-build boost llvm llvm-devel lld-devel clang git file rpm-build dpkg-dev
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build WasmEdge with Release mode
run: |
git config --global --add safe.directory $(pwd)
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_TESTS=ON -DWASMEDGE_BUILD_PACKAGE="TGZ;DEB;RPM" .
cmake --build build
- name: Test WasmEdge
run: |
export LD_LIBRARY_PATH="$(pwd)/build/lib/api:$LD_LIBRARY_PATH"
cd build
ctest
cd -
- name: Test WasmEdge Package
run: |
cmake --build build --target package
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: WasmEdge-${{ needs.get_version_v2.outputs.version }}-fedora35.tar.gz
path: build/WasmEdge-${{ needs.get_version_v2.outputs.version }}-Linux.tar.gz
build_ubuntu:
strategy:
matrix:
include:
- name: g++ debug
compiler: g++
docker_tag: ubuntu-build-gcc
build_type: Debug
coverage: false
- name: g++ release
compiler: g++
docker_tag: ubuntu-build-gcc
build_type: Release
coverage: false
- name: clang++ debug
compiler: clang++
docker_tag: ubuntu-build-clang
build_type: Debug
coverage: false
- name: clang++ release
compiler: clang++
docker_tag: ubuntu-build-clang
build_type: Release
coverage: false
- name: g++ coverage
compiler: g++
docker_tag: ubuntu-build-gcc
build_type: Debug
coverage: true
name: Ubuntu 20.04 with ${{ matrix.name }}
runs-on: ubuntu-latest
container:
image: wasmedge/wasmedge:${{ matrix.docker_tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build WasmEdge using ${{ matrix.compiler }} with ${{ matrix.build_type }} mode
if: ${{ ! matrix.coverage }}
env:
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
run: |
git config --global --add safe.directory $(pwd)
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DWASMEDGE_BUILD_TESTS=ON .
cmake --build build
- name: Test WasmEdge
if: ${{ ! matrix.coverage }}
run: |
export LD_LIBRARY_PATH="$(pwd)/build/lib/api:$LD_LIBRARY_PATH"
cd build
ctest
cd -
- name: Build WasmEdge using ${{ matrix.compiler }} with Coverage mode
if: ${{ matrix.coverage }}
run: |
apt update
apt install -y gcovr
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --target wasm32-wasi
git config --global --add safe.directory $(pwd)
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug -DWASMEDGE_BUILD_TESTS=ON -DWASMEDGE_BUILD_COVERAGE=ON .
cmake --build build
LD_LIBRARY_PATH=$(pwd)/build/lib/api cmake --build build --target codecov
- name: Create and upload coverage report to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/codecov.xml
name: codecov-wasmedge
fail_ci_if_error: true
path_to_write_report: ./build/codecov_report.gz
build_manylinux:
strategy:
matrix:
include:
- name: manylinux2014 x86_64
host_runner: ubuntu-latest
docker_tag: manylinux2014_x86_64
checkout_version: v2
- name: manylinux2010 x86_64
host_runner: ubuntu-latest
docker_tag: manylinux2010_x86_64
checkout_version: v1
- name: manylinux1 x86_64
host_runner: ubuntu-latest
docker_tag: manylinux1_x86_64
checkout_version: v1
- name: manylinux2014 aarch64
host_runner: ARM64
docker_tag: manylinux2014_aarch64
checkout_version: v2
name: ${{ matrix.name }} platform
runs-on: ${{ matrix.host_runner }}
needs: [get_version_v1, get_version_v2]
container:
image: wasmedge/wasmedge:${{ matrix.docker_tag }}
steps:
- uses: actions/checkout@v1
if: ${{ matrix.checkout_version == 'v1' }}
- uses: actions/checkout@v2
if: ${{ matrix.checkout_version == 'v2' }}
with:
fetch-depth: 0
- name: Build ${{ matrix.name }} package
run: |
bash utils/docker/build-manylinux.sh
- name: Upload artifact (v1)
uses: actions/upload-artifact@v1
if: ${{ matrix.checkout_version == 'v1' }}
with:
name: WasmEdge-${{ needs.get_version_v1.outputs.version }}-${{ matrix.docker_tag }}.tar.gz
path: build/WasmEdge-${{ needs.get_version_v1.outputs.version }}-Linux.tar.gz
- name: Upload artifact (v2)
uses: actions/upload-artifact@v2
if: ${{ matrix.checkout_version == 'v2' }}
with:
name: WasmEdge-${{ needs.get_version_v2.outputs.version }}-${{ matrix.docker_tag }}.tar.gz
path: build/WasmEdge-${{ needs.get_version_v2.outputs.version }}-Linux.tar.gz
build_macos:
strategy:
matrix:
include:
- name: MacOS 10.15
host_runner: macos-10.15
darwin_version: darwin_19
- name: MacOS 11
host_runner: macos-11
darwin_version: darwin_20
- name: MacOS 12
host_runner: macos-12
darwin_version: darwin_21
name: ${{ matrix.name }}
runs-on: ${{ matrix.host_runner }}
needs: get_version_v2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build WasmEdge
run: |
brew install llvm ninja boost cmake
export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
export CC=clang
export CXX=clang++
cmake -Bbuild -GNinja -DWASMEDGE_BUILD_TESTS=ON .
cmake -Bbuild -GNinja -DWASMEDGE_BUILD_TESTS=ON -DWASMEDGE_BUILD_PACKAGE="TGZ" .
cmake --build build
- name: Test WasmEdge
continue-on-error: true
run: |
export DYLD_LIBRARY_PATH="$(pwd)/build/lib/api:$DYLD_LIBRARY_PATH"
cd build
ctest
cd -
- name: Test WasmEdge Package
run: |
cmake --build build --target package
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: WasmEdge-${{ needs.get_version_v2.outputs.version }}-${{ matrix.darwin_version }}_x86_64.tar.gz
path: build/WasmEdge-${{ needs.get_version_v2.outputs.version }}-Darwin.tar.gz
build_windows:
name: Windows Server 2022
runs-on: windows-2022
needs: get_version_v2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependency
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install cmake ninja vswhere
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v1
with:
sdk-version: 19041
- name: Build WasmEdge
run: |
$vsPath = (vswhere -latest -property installationPath)
Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64 -winsdk=10.0.19041.0"
$llvm = "LLVM-13.0.1-win64.zip"
curl -sLO https://github.com/WasmEdge/llvm-windows/releases/download/llvmorg-13.0.1/LLVM-13.0.1-win64.zip -o $llvm
Expand-Archive -Path $llvm
$llvm_dir = "$pwd\\LLVM-13.0.1-win64\\LLVM-13.0.1-win64\\lib\\cmake\\llvm"
$Env:CC = "clang-cl"
$Env:CXX = "clang-cl"
$cmake_sys_version = "10.0.19041.0"
cmake -Bbuild -GNinja "-DCMAKE_SYSTEM_VERSION=$cmake_sys_version" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL "-DLLVM_DIR=$llvm_dir" -DWASMEDGE_BUILD_TESTS=ON -DWASMEDGE_BUILD_PACKAGE="ZIP" .
cmake --build build
- name: Test WasmEdge
continue-on-error: true
run: |
$vsPath = (vswhere -latest -property installationPath)
Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64 -winsdk=10.0.19041.0"
$Env:PATH += ";$pwd\\build\\lib\\api"
cd build
ctest
cd -
- name: Test WasmEdge Package
run: |
$vsPath = (vswhere -latest -property installationPath)
Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64 -winsdk=10.0.19041.0"
cmake --build build --target package
- name: Check artifact
run: |
Get-ChildItem -Path "$pwd\\build"
- name: Upload artifact (v2)
uses: actions/upload-artifact@v2
with:
name: WasmEdge-${{ needs.get_version_v2.outputs.version }}-windows.zip
path: build\\WasmEdge-${{ needs.get_version_v2.outputs.version }}-Windows.zip
- name: Package Windows Installer
run: |
$Env:product_version = ("${{ needs.get_version_v2.outputs.version }}").split("-")[0]
. "$Env:WIX\bin\candle.exe" -arch x64 -o build\wasmedge.wixobj .github\scripts\wasmedge.wxs
. "$Env:WIX\bin\light.exe" -out build\WasmEdge-$Env:product_version-windows.msi build\wasmedge.wixobj
echo "product_version=$Env:product_version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Upload Windows Installer
uses: actions/upload-artifact@v2
with:
name: WasmEdge-${{ env.product_version }}-windows.msi
path: build\\WasmEdge-${{ env.product_version }}-windows.msi
build_android:
name: Android
runs-on: ubuntu-latest
needs: get_version_v2
container:
image: wasmedge/wasmedge:latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependency
run: |
apt update && apt install -y unzip
apt remove -y cmake
curl -sLO https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2-linux-x86_64.tar.gz
tar -zxf cmake-3.22.2-linux-x86_64.tar.gz
cp -r cmake-3.22.2-linux-x86_64/bin /usr/local
cp -r cmake-3.22.2-linux-x86_64/share /usr/local
curl -sLO https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
unzip -q android-ndk-r23b-linux.zip
- name: Build WasmEdge for Android
run: |
git config --global --add safe.directory $(pwd)
export ANDROID_NDK_HOME=$(pwd)/android-ndk-r23b/
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_PACKAGE="TGZ" -DWASMEDGE_BUILD_AOT_RUNTIME=OFF -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=23 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_ANDROID_STL_TYPE=c++_static
cmake --build build
cmake --build build --target package
- name: Upload artifact (v2)
uses: actions/upload-artifact@v2
with:
name: WasmEdge-${{ needs.get_version_v2.outputs.version }}-android_aarch64.tar.gz
path: build/WasmEdge-${{ needs.get_version_v2.outputs.version }}-Android.tar.gz