diff --git a/.github/scripts/wasi_nn-ggml/ubuntu2004.sh b/.github/scripts/wasi_nn-ggml/ubuntu2004.sh new file mode 100644 index 0000000..b9a5dd8 --- /dev/null +++ b/.github/scripts/wasi_nn-ggml/ubuntu2004.sh @@ -0,0 +1,22 @@ +ARCH=$(uname -m) +ARTIFACT="WasmEdge-plugin-wasi_nn-ggml-${WASMEDGE_GGML_BUILD}-${WASMEDGE_VERSION}-ubuntu20.04-${ARCH}.tar.gz" +IS_NATIVE=OFF + +if [[ "${ARCH}" == "x86_64" ]; then + IS_NATIVE=ON +fi + +cmake -B${OUTPUT_DIR} -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DWASMEDGE_BUILD_AOT_RUNTIME=OFF \ + -DWASMEDGE_BUILD_TOOLS=OFF \ + -DWASMEDGE_PLUGIN_WASI_NN_BACKEND=GGML \ + -DWASMEDGE_PLUGIN_WASI_NN_GGML_LLAMA_BLAS=OFF \ + -DWASMEDGE_PLUGIN_WASI_NN_GGML_LLAMA_NATIVE=${IS_NATIVE} \ + -DWASMEDGE_USE_LLVM=OFF +cmake --build ${OUTPUT_DIR} + +cp -f "${OUTPUT_DIR}/${OUTPUT_BIN}" "${OUTPUT_BIN}" +tar zcvf "${ARTIFACT}" "${OUTPUT_BIN}" + +echo "artifact=${ARTIFACT}" >> "${GITHUB_OUTPUT}" diff --git a/.github/workflows/build-wasi_nn-ggml.yml b/.github/workflows/build-wasi_nn-ggml.yml new file mode 100644 index 0000000..4776458 --- /dev/null +++ b/.github/workflows/build-wasi_nn-ggml.yml @@ -0,0 +1,65 @@ +--- +name: WASI-NN GGML + +on: + pull_request: + branches: [main] + paths: + - '.github/workflows/build-wasi_nn-ggml.yml' + - 'plugins/wasi_nn/**' + - 'test/plugins/wasi_nn/**' + +permissions: {} + +jobs: + build: + permissions: + contents: write + + strategy: + fail-fast: false + matrix: + include: + - platform: ubuntu20.04 + arch: x86_64 + runner: ubuntu-latest + image: wasmedge/wasmedge:ubuntu-20.04-build-gcc-plugins-deps + script: ubuntu2004.sh + + runs-on: ${{ matrix.runner }} + container: ${{ matrix.image }} + + name: ${{ matrix.platform }} (${{ matrix.arch }}) + + env: + OUTPUT_DIR: build + OUTPUT_BIN: libwasmedgePluginWasiNN.so + WASMEDGE_GGML_BUILD: b5640 + WASMEDGE_VERSION: 0.14.1_plugin_lts + + steps: + - name: Checkout WasmEdge + uses: actions/checkout@v4 + with: + repository: WasmEdge/WasmEdge + ref: ${{ env.WASMEDGE_VERSION }} + fetch-depth: 0 + + - name: Checkout this repository + uses: actions/checkout@v4 + with: + path: this + + - id: build + name: Build + run: | + git config --global --add safe.directory "$(pwd)" + rm -rf "${OUTPUT_DIR}" + bash -e "this/.github/scripts/wasi_nn-ggml/${{ matrix.script }}" + shell: bash + + - name: Upload ${{ steps.build.outputs.artifact }} + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.build.outputs.artifact }} + path: ${{ steps.build.outputs.artifact }}