File tree Expand file tree Collapse file tree 4 files changed +165
-0
lines changed Expand file tree Collapse file tree 4 files changed +165
-0
lines changed Original file line number Diff line number Diff line change 1+ # Misc Docs  
2+ 
3+ ## Configuration Files  
4+ 
5+ ### ` plugins.json `  
6+ 
7+ ``` json 
8+ {
9+   "plugins" : {
10+     "<plugin-name>" : {
11+       "dir" : " <path-to-plugin>" 
12+       "target" : " <cmake-target-for-plugin>" 
13+       "test" : " <cmake-target-for-test>" 
14+       "options" : " <cmake-options>" 
15+       "platforms" : [
16+         {
17+           "key" : " <platform-key>" 
18+         },
19+         {
20+           "key" : " <platform-key>" 
21+           "options" : <extra-cmake-options>" 
22+         },
23+         {
24+           "key" : " <platform-key>" 
25+           "options" : <extra-cmake-options>", 
26+           "plugin_tag" : " <extra-tag-for-plugin>" 
27+         }
28+       } 
29+     } 
30+   }, 
31+   "platforms" : {
32+     "<platform-key>" : {
33+       "runner" : " <github-runner>" 
34+       "docker_tag" : " <docker-tag>" 
35+       "asset_tag" : " <asset-tag>" 
36+     }
37+   }
38+ } 
39+ ``` 
Original file line number Diff line number Diff line change 1+ {
2+   "plugins" : {
3+     "wasi_crypto" : {
4+       "dir" : " wasi_crypto" 
5+       "target" : " wasmedgePluginWasiCrypto" 
6+       "test" : " wasiCryptoTests" 
7+       "options" : " -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON" 
8+       "platforms" : [
9+         {"key" :" manylinux_2_28_x86_64" 
10+         {"key" :" ubuntu_2004_x86_64" 
11+       ]
12+     },
13+     "wasi_nn-openvino" : {
14+       "dir" : " wasi_nn" 
15+       "target" : " wasmedgePluginWasiNN" 
16+       "test" : " wasiNNTests" 
17+       "options" : " -DWASMEDGE_PLUGIN_WASI_NN_BACKEND=OpenVINO" 
18+       "platforms" : [
19+         {"key" :" ubuntu_2004_x86_64" 
20+       ]
21+     },
22+     "wasmedge_stablediffusion" : {
23+       "dir" : " wasmedge_stablediffusion" 
24+       "target" : " wasmedgePluginWasmEdgeStableDiffusion" 
25+       "test" : " wasmedgeStableDiffusionTests" 
26+       "options" : " -DWASMEDGE_PLUGIN_STABLEDIFFUSION=ON" 
27+       "platforms" : [
28+         {
29+           "key" : " macos_arm64" 
30+           "options" : " -DWASMEDGE_PLUGIN_STABLEDIFFUSION_METAL=ON" 
31+           "plugin_tag" : " metal" 
32+         },
33+         {"key" :" manylinux_2_28_x86_64" 
34+       ]
35+     }
36+   },
37+   "platforms" : {
38+     "macos_arm64" : {
39+       "runner" : " macos-14" 
40+       "asset_tag" : " darwin_23-arm64" 
41+     },
42+     "manylinux_2_28_x86_64" : {
43+       "runner" : " ubuntu-latest" 
44+       "docker_tag" : " manylinux_2_28_x86_64-plugins-deps" 
45+       "asset_tag" : " manylinux_2_28_x86_64" 
46+     }
47+   }
48+ }
Original file line number Diff line number Diff line change 1+ module . exports . parse  =  ( config )  =>  { 
2+   let  map  =  new  Map ( ) ; 
3+   for  ( const  platform_key  of  Object . keys ( config . platforms ) )  { 
4+     map . set ( platform_key ,  [ ] ) ; 
5+   } 
6+   for  ( const  [ plugin_key ,  plugin ]  of  Object . entries ( config . plugins ) )  { 
7+     for  ( const  platform  of  plugin . platforms )  { 
8+       if  ( ! ( platform . key  in  config . platforms ) ) 
9+         continue ; 
10+       let  copy  =  {  ...plugin ,  ...config . platforms [ platform . key ]  } ; 
11+       delete  copy . platforms ; 
12+       copy . plugin  =  plugin_key ; 
13+       copy . plugin_tag  =  platform . plugin_tag ; 
14+       copy . options  =  [ plugin . options ,  platform . options ] . join ( " " ) ; 
15+       map . get ( platform . key ) . push ( copy ) ; 
16+   } 
17+   return  Object . fromEntries ( map ) ; 
18+ } ; 
19+ 
20+ if  ( require . main  ===  module )  { 
21+   const  {  parse }  =  module . exports ; 
22+   const  fs  =  require ( "fs" ) ; 
23+   const  s  =  fs . readFileSync ( "plugins.json" ) ; 
24+   const  o  =  JSON . parse ( s ) ; 
25+   console . log ( JSON . stringify ( parse ( o ) ) ) ; 
26+ } 
Original file line number Diff line number Diff line change 1+ ---
2+ name : Parse 
3+ 
4+ on :
5+   pull_request :
6+     branches : [main] 
7+     paths :
8+       - ' .github/plugins.json' 
9+       - ' .github/scripts/parse-plugins.js' 
10+       - ' .github/workflows/parse-plugins.yml' 
11+ 
12+   workflow_call :
13+     inputs :
14+       workflow_call : #  workaround to distinguish ${{ github.event }}
15+         type : boolean 
16+         default : true 
17+     outputs :
18+       plugins :
19+         value : ${{ jobs.parse.outputs.plugins }} 
20+ 
21+ jobs :
22+   parse :
23+     name : Parse configuration file 
24+     runs-on : ubuntu-latest 
25+     outputs :
26+       plugins : ${{ steps.readfile.outputs.plugins }} 
27+     steps :
28+       - uses : actions/checkout@v4 
29+       - id : readfile 
30+         uses : actions/github-script@v7 
31+         with :
32+           result-encoding : string 
33+           script : | 
34+             const { parse } = require(".github/scripts/parse-plugins.js"); 
35+             const fs = require("fs"); 
36+             const s = fs.readFileSync(".github/plugins.json"); 
37+             const config = parse(JSON.parse(s)); 
38+             core.setOutput("plugins", config); 
39+ 
40+ test :
41+     if : ${{ !inputs.workflow_call }} 
42+     needs : parse 
43+     name : Self-testing 
44+     runs-on : ubuntu-latest 
45+     steps :
46+       - name : Get wasi_crypto target 
47+         run : | 
48+           echo "target=$(echo '${{ needs.parse.outputs.plugins }}' | jq '.manylinux_2_28_x86_64[] | select(.plugin == "wasi_crypto") | .target')" >> "${GITHUB_ENV}" 
49+ name : Check wasi_crypto target 
50+         run : | 
51+           echo "${target}" 
52+           test "${target}" = '"wasmedgePluginWasiCrypto"' 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments