forked from WasmEdge/WasmEdge
-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (183 loc) · 7.25 KB
/
build-extensions.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
name: Test WasmEdge extensions
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths:
- ".github/extensions.paths-filter.yml"
- ".github/workflows/build-extensions.yml"
- ".github/workflows/matrix-extensions.json"
- ".github/workflows/reusable-build-extensions**"
- ".github/workflows/reusable-call-linter.yml"
- "plugins/**"
- "test/plugins/**"
- "thirdparty/**"
- "tools/**"
- "CMakeLists.txt"
- "cmake/**"
pull_request:
branches:
- master
- "proposal/**"
paths:
- ".github/extensions.paths-filter.yml"
- ".github/workflows/build-extensions.yml"
- ".github/workflows/matrix-extensions.json"
- ".github/workflows/reusable-build-extensions**"
- ".github/workflows/reusable-call-linter.yml"
- "plugins/**"
- "test/plugins/**"
- "thirdparty/**"
- "tools/**"
- "CMakeLists.txt"
- "cmake/**"
permissions:
contents: read
jobs:
# TODO: Refactor `lint` with `on.workflow_run`
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow
lint:
uses: ./.github/workflows/reusable-call-linter.yml
get_version:
name: Retrieve version information
needs: lint
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prep.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure git safe directory
run: |
git config --global --add safe.directory $(pwd)
- 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 "version=$(git describe --match '[0-9].[0-9]*' --tag)" >> $GITHUB_OUTPUT
test_wasi_nn_ggml_rpc:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- name: g++
docker_tag: ubuntu-22.04-build-gcc-plugins-deps
build_type: Release
- name: clang++
docker_tag: ubuntu-22.04-build-clang-plugins-deps
build_type: Release
name: WASI-NN GGML RPC (${{ matrix.name }})
runs-on: ubuntu-latest
needs: [ get_version ]
container:
image: wasmedge/wasmedge:${{ matrix.docker_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure git safe directory
run: |
git config --global --add safe.directory $(pwd)
- name: Test WASI-NN RPC mode with GGML
shell: bash
run: |
set -eux
# wasi_nn_rpcserver is built in a clean "build_rpc" dir
export nnrpc_test_dir=build_rpc/test/plugins/wasi_nn
cmake -Bbuild_rpc -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DWASMEDGE_BUILD_TESTS=ON \
-DWASMEDGE_USE_LLVM=OFF \
-DWASMEDGE_BUILD_TOOLS=ON \
-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=GGML \
-DWASMEDGE_BUILD_WASI_NN_RPC=ON
cmake --build build_rpc
export test_bin=wasiNNTests
export WASI_NN_RPC_TEST_URI=unix:///tmp/wasi_nn_rpc.sock
export WASMEDGE_PLUGIN_PATH=build_rpc/plugins/wasi_nn
build_rpc/tools/wasmedge/wasi_nn_rpcserver \
--nn-rpc-uri $WASI_NN_RPC_TEST_URI \
--nn-preload default:GGML:AUTO:build_rpc/test/plugins/wasi_nn/wasinn_ggml_fixtures/orca_mini.gguf &
RPC_SERVER_PID=$!
sleep 3
# The test binary consumes $WASI_NN_RPC_TEST_URI
(cd ${nnrpc_test_dir} && ./${test_bin} --gtest_filter=WasiNNTest.GGMLBackendWithRPC)
kill -9 "$RPC_SERVER_PID"
# Restart the server for the compute single test
build_rpc/tools/wasmedge/wasi_nn_rpcserver \
--nn-rpc-uri $WASI_NN_RPC_TEST_URI \
--nn-preload default:GGML:AUTO:build_rpc/test/plugins/wasi_nn/wasinn_ggml_fixtures/orca_mini.gguf &
RPC_SERVER_PID=$!
sleep 3
(cd ${nnrpc_test_dir} && ./${test_bin} --gtest_filter=WasiNNTest.GGMLBackendComputeSingleWithRPC)
kill -9 "$RPC_SERVER_PID"
build_windows_wasi_nn:
permissions:
contents: write
name: WASI-NN (Windows Server 2022)
runs-on: windows-2022
env:
output_dir: build/plugins/wasi_nn
test_dir: build/test/plugins/wasi_nn
build_options: -DWASMEDGE_PLUGIN_WASI_NN_BACKEND=GGML
tar_names: wasi_nn-ggml
test_bin: wasiNNTests
output_bin: wasmedgePluginWasiNN.dll
needs: [ get_version ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure git safe directory
run: |
git config --global --add safe.directory $(pwd)
- name: Install dependency
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install cmake ninja vswhere
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- 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.22621.0"
$llvm = "LLVM-17.0.6-win64-MultiThreadedDLL.zip"
curl -sLO https://github.com/WasmEdge/llvm-windows/releases/download/llvmorg-17.0.6/LLVM-17.0.6-win64-MultiThreadedDLL.zip -o $llvm
Expand-Archive -Path $llvm
$llvm_dir = "$pwd\\LLVM-17.0.6-win64-MultiThreadedDLL\\LLVM-17.0.6-win64\\lib\\cmake\\llvm"
$cmake_sys_version = "10.0.22621.0"
cmake -Bbuild -GNinja "-DCMAKE_SYSTEM_VERSION=$cmake_sys_version" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL "-DLLVM_DIR=$llvm_dir" -DWASMEDGE_BUILD_TESTS=ON -DWASMEDGE_USE_LLVM=OFF -DWASMEDGE_BUILD_TOOLS=OFF
Write-Output "Building $Env:tar_names backend:"
cmake -Bbuild -GNinja "$Env:build_options"
cmake --build build --target "$Env:test_bin"
$Env:PATH += ";$pwd\\build\\lib\\api"
Write-Output "Testing $Env:tar_names backend:"
cmake -E chdir "$Env:test_dir" "$Env:test_bin"
Write-Output "Copying $Env:tar_names backend:"
Copy-Item "$Env:output_dir/$Env:output_bin" -Destination "./$Env:output_bin"
Write-Output "Compress-Archive -Path $Env:output_bin -DestinationPath plugin_${Env:tar_names}.zip -CompressionLevel Optimal"
Compress-Archive -Path "$Env:output_bin" -DestinationPath "plugin_${Env:tar_names}.zip" -CompressionLevel Optimal
ls "plugin_${Env:tar_names}.zip"
- name: Upload artifact - wasi_nn-ggml
uses: actions/upload-artifact@v4
with:
name: WasmEdge-plugin-wasi_nn-ggml-${{ needs.get_version.outputs.version }}-windows.zip
path: plugin_wasi_nn-ggml.zip
build_plugins:
permissions:
contents: write
name: Build and Test
needs: get_version
uses: ./.github/workflows/reusable-build-extensions.yml
with:
version: ${{ needs.get_version.outputs.version }}