Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP ci: build plugins #3

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"plugins": [
{
"plugin": "wasi_crypto",
"dir": "wasi_crypto",
"target": "wasmedgePluginWasiCrypto",
"test": "wasiCryptoTests",
"options": {
"base": "-DWASMEDGE_PLUGIN_WASI_CRYPTO=ON",
"manylinux_2_28_x86_64": {},
"ubuntu_2004_x86_64": {}
}
},
{
"plugin": "wasi_nn-openvino",
"dir": "wasi_nn",
"target": "wasmedgePluginWasiNN",
"test": "wasiNNTests",
"options": {
"base": "-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=OpenVINO",
"ubuntu_2004_x86_64": {}
}
},
{
"plugin": "wasmedge_stablediffusion",
"dir": "wasmedge_stablediffusion",
"target": "wasmedgePluginWasmEdgeStableDiffusion",
"test": "wasmedgeStableDiffusionTests",
"options": {
"base": "-DWASMEDGE_PLUGIN_STABLEDIFFUSION=ON",
"macos_arm64": {
"options": "-DWASMEDGE_PLUGIN_STABLEDIFFUSION_METAL=ON"
},
"manylinux_2_28_x86_64": {}
}
}
],
"platforms": {
"macos_arm64": {
"runner": "macos-14",
"asset_tag": "darwin_23-arm64"
},
"manylinux_2_28_x86_64": {
"runner": "ubuntu-latest",
"docker_tag": "manylinux_2_28_x86_64-plugins-deps",
"asset_tag": "manylinux_2_28_x86_64"
}
}
}
26 changes: 26 additions & 0 deletions .github/scripts/parse-plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports.parse = (config) => {
let map = new Map();
for (const [key, platform] of Object.entries(config.platforms)) {
map.set(key, config.plugins
.map((plugin) => {
let specific = plugin.options[key];
if (undefined == specific)
return undefined;
let copy = { ...plugin, ...platform };
delete copy.platforms;
copy.options = [plugin.options.base, specific.options].join(" ");
return copy;
})
.filter((plugin) => undefined != plugin));
}
return Object.fromEntries(map);
};

if (require.main === module) {
const { parse } = module.exports;
const fs = require("fs");
const s = fs.readFileSync("plugins.json");
const o = JSON.parse(s);
let config = parse(o);
console.log(JSON.stringify(config));
}
18 changes: 18 additions & 0 deletions .github/workflows/build-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Build on Linux

on:
workflow_call:
inputs:
plugin:
type: string
required: true

permissions: {}

jobs:
echo:
runs-on: ubuntu-latest
steps:
- run: |
echo "${{ inputs.plugin }}"
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Build

on:
pull_request:
branches: [main]

permissions: {}

jobs:
parse:
uses: ./.github/workflows/parse-plugins.yml

echo:
needs: parse
runs-on: ubuntu-latest
steps:
- run: |
echo "${{ needs.parse.outputs.plugins }}"

manylinux_2_28:
needs: parse
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.parse.outputs.plugins).manylinux_2_28_x86_64 }}
uses: ./.github/workflows/build-on-linux.yml
with:
plugin: ${{ matrix.plugin }}
secrets: inherit
27 changes: 27 additions & 0 deletions .github/workflows/parse-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Parse plugins

on:
workflow_call:
outputs:
plugins:
value: ${{ jobs.parse.outputs.plugins }}

jobs:
parse:
runs-on: ubuntu-latest
outputs:
plugins: ${{ steps.readfile.outputs.plugins }}
steps:
- uses: actions/checkout@v4
- id: readfile
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { parse } = require(".github/scripts/parse-plugins.js");
const fs = require("fs");
const s = fs.readFileSync(".github/plugins.json");
const config = parse(JSON.parse(s));
console.log(JSON.stringify(config));
core.setOutput("plugins", config);
Loading