From 18b50768d9744dfe7ef9c891183f565f9f304404 Mon Sep 17 00:00:00 2001 From: tusharad Date: Fri, 8 Sep 2023 21:42:04 +0530 Subject: [PATCH] cached wasmedge c lib in pipeline --- .github/workflows/haskell.yml | 9 ++++++- src/WasmEdge/Internal/FFI/ValueTypes.chs | 32 +++++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 4a96b5c..f334114 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -22,19 +22,26 @@ jobs: cabal-version: '3.6' - name: cache + id: cache-wasmedge uses: actions/cache@v3 with: path: | ~/.cabal/packages ~/.cabal/store dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project*') }} + ~/.wasmedge + key: | + ${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project*') }} restore-keys: | ${{ runner.os }}-${{ matrix.ghc }}-v1- - name: Install dependencies run: | cabal build all --only-dependencies + + - name: Install WasmEdge C library + if: steps.cache-wasmedge.outputs.cache-hit != 'true' + run: | VERSION=0.13.3 curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v $VERSION diff --git a/src/WasmEdge/Internal/FFI/ValueTypes.chs b/src/WasmEdge/Internal/FFI/ValueTypes.chs index 35edfec..9d5d5ba 100644 --- a/src/WasmEdge/Internal/FFI/ValueTypes.chs +++ b/src/WasmEdge/Internal/FFI/ValueTypes.chs @@ -17,6 +17,7 @@ module WasmEdge.Internal.FFI.ValueTypes ( --pointer HsRefPtr + ,fromHsRefAsVoidPtrIn ,WasmVal ( WasmInt32, WasmInt64, WasmFloat, WasmDouble, WasmInt128, WasmExternRef , WasmFuncRef, WasmNullExternRef, WasmNullFuncRef ) @@ -1106,6 +1107,9 @@ int Driver_UniTool(const char *Argv[], int Argc) HsRef -} {#pointer *HsRef as HsRefPtr foreign newtype #} +{-| + WasmVal +-} {#pointer *WasmVal as WasmVal foreign newtype #} {-| WasmEdge string struct. @@ -1114,18 +1118,38 @@ int Driver_UniTool(const char *Argv[], int Argc) instance HasFinalizer WasmString where getFinalizer = deleteString +{-| + WasmEdge Result construct +-} {#pointer *WasmEdge_Result as WasmResult foreign newtype #} + +{-| + Struct of WASM limit. +-} {#pointer *WasmEdge_Limit as Limit foreign newtype #} --- | Program option for plugins. + +{- | +Program option for plugins. +-} {#pointer *WasmEdge_ProgramOption as ProgramOption foreign newtype #} --- | Module descriptor for plugins. + +{- | Module descriptor for plugins. +-} {#pointer *WasmEdge_ModuleDescriptor as ModuleDescriptor foreign newtype #} --- | Version data for plugins. + +{- | Version data for plugins. +-} {#pointer *WasmEdge_PluginVersionData as PluginVersionData foreign newtype #} --- | Plugin descriptor for plugins. + +{-| + Plugin descriptor for plugins. +-} {#pointer *WasmEdge_PluginDescriptor as PluginDescriptor foreign newtype #} --- +{-| + fromHsRefIn +-} fromHsRefIn :: HsRef -> (Ptr HsRefPtr -> IO a) -> IO a fromHsRefIn = fromHsRefGenIn