[CI] Bump llvm 11 to 18 for static code analysis (#3861) #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |