forked from WasmEdge/WasmEdge
-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (204 loc) · 7.62 KB
/
bindings-java.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
name: binding-java
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths:
- ".github/workflows/bindings-java.yml"
- "bindings/java/**"
- "include/api/wasmedge/**"
- "lib/api/**"
pull_request:
branches:
- master
paths:
- ".github/workflows/bindings-java.yml"
- "bindings/java/**"
- "include/api/wasmedge/**"
- "lib/api/**"
jobs:
build_ubuntu:
name: Ubuntu 22.04
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
container:
image: wasmedge/wasmedge:ubuntu-build-clang
steps:
- uses: actions/checkout@v3
- name: Ensure git safe directory
run: |
git config --global --add safe.directory $(pwd)
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "11"
cache: "gradle"
- name: Install clang-format-15
run: |
apt-get update
apt-get install -y clang-format-15
- name: Lint
run: |
find bindings/java/wasmedge-jni/lib -type f -iname "*.[ch]" | xargs -n1 `which clang-format-15` -i -style=file -Werror --dry-run
- name: Build & Install WasmEdge
run: |
apt-get update
apt-get install -y make
mkdir -p build
cd build
cmake -DWASMEDGE_BUILD_TESTS=ON ..
make -j
make install
- name: Build WasmEdge Java
run: |
export WasmEdge_ROOT=$(pwd)/build
cd bindings/java/wasmedge-java
./gradlew clean
./gradlew platformJar
- name: Upload Jar
uses: actions/upload-artifact@v3
with:
name: java-libs
path: |
bindings/java/wasmedge-java/build/libs/wasmedge-java-*.jar
build_macos:
name: MacOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install build tools
run: |
brew install llvm ninja cmake
- name: Build WasmEdge with Release mode
run: |
export LLVM_DIR="/usr/local/opt/llvm/lib/cmake"
export CC=clang
export CXX=clang++
rm -rf build
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release .
cmake --build build
- name: Test WasmEdge
run: |
export DYLD_LIBRARY_PATH="$(pwd)/build/lib/api:$DYLD_LIBRARY_PATH"
cd build
./tools/wasmedge/wasmedge -v
ctest
cd -
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "11"
cache: "gradle"
- name: Build WasmEdge Java
run: |
export WasmEdge_ROOT=$(pwd)/build
cd bindings/java/wasmedge-java
./gradlew clean
./gradlew platformJar
- name: Run Tests
if: ${{ false }}
run: |
export LIB_JNI_PATH=$(pwd)/bindings/java/wasmedge-jni/build
cd bindings/java/wasmedge-java
./gradlew test
- name: Upload JNI lib
uses: actions/upload-artifact@v3
with:
name: java-libs
path: |
bindings/java/wasmedge-java/build/libs/wasmedge-java-*.jar
build_windows:
name: Windows
runs-on: windows-2022
env:
WASMEDGE_DIR: ${{ github.workspace }}
WASMEDGE_BUILD_DIR: ${{ github.workspace }}\build
WASMEDGE_PLUGIN_PATH: ${{ github.workspace }}\build\wasmedge\plugins\wasmedge_process
LD_LIBRARY_PATH: ${{ github.workspace }}\build\lib\api
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependency
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install cmake ninja vswhere
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v1
with:
sdk-version: 19041
- name: Set up java
uses: actions/setup-java@v3
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "11"
cache: "gradle"
- name: Build WasmEdge with Release mode
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-16.0.6-win64-MultiThreadedDLL.zip"
curl -sLO https://github.com/WasmEdge/llvm-windows/releases/download/llvmorg-16.0.6/LLVM-16.0.6-win64-MultiThreadedDLL.zip -o $llvm
Expand-Archive -Path $llvm
$llvm_dir = "$pwd\\LLVM-16.0.6-win64-MultiThreadedDLL\\LLVM-16.0.6-win64\\lib\\cmake\\llvm"
$Env:CC = "clang-cl"
$Env:CXX = "clang-cl"
$cmake_sys_version = "10.0.19041.0"
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release "-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
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
tools\wasmedge\wasmedge -v
ctest
cd -
- name: Build WasmEdge JNI
run: |
$Env:WasmEdge_ROOT="$pwd\\build"
cd bindings/java/wasmedge-java/
$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-16.0.6-win64-MultiThreadedDLL.zip"
curl -sLO https://github.com/WasmEdge/llvm-windows/releases/download/llvmorg-16.0.6/LLVM-16.0.6-win64-MultiThreadedDLL.zip -o $llvm
Expand-Archive -Path $llvm
$llvm_dir = "$pwd\\LLVM-16.0.6-win64-MultiThreadedDLL\\LLVM-16.0.6-win64\\lib\\cmake\\llvm"
$Env:CC = "clang-cl"
$Env:CXX = "clang-cl"
$cmake_sys_version = "10.0.19041.0"
$Env:PATH += ";$pwd\\build\\lib\\api"
./gradlew clean
./gradlew platformJar
- name: Run Tests
if: ${{ false }}
run: |
$env:Path="$env:Path;$pwd\\build\\lib\\api"
$Env:LIB_JNI_PATH="$pwd\\bindings\\java\\wasmedge-jni\\build"
$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"
cd bindings/java/wasmedge-java
./gradlew test
- name: Upload JNI lib
uses: actions/upload-artifact@v3
with:
name: java-libs
path: |
bindings/java/wasmedge-java/build/libs/wasmedge-java-*.jar