Skip to content

Commit da9aa9d

Browse files
committed
ci: build plugins
- add entry workflow - implement `get-versions` - implement `build-on-linux` Signed-off-by: Yi Huang <[email protected]>
1 parent c7052eb commit da9aa9d

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: Build on Linux
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
plugins:
8+
type: string
9+
required: true
10+
version:
11+
type: string
12+
required: true
13+
14+
permissions: {}
15+
16+
jobs:
17+
build:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include: ${{ fromJSON(inputs.plugins) }}
22+
name: ${{ matrix.plugin }}
23+
runs-on: ${{ matrix.runner }}
24+
container:
25+
image: wasmedge/wasmedge:${{ matrix.docker_tag }}
26+
env:
27+
bin: lib${{ matrix.target }}.so
28+
target: ${{ matrix.test }} # TODO: use matrix.target on release
29+
test_dir: build/test/plugins/${{ matrix.dir }}
30+
output_dir: build/plugins/${{ matrix.dir }}
31+
defaults:
32+
run:
33+
shell: bash
34+
steps:
35+
- id: var
36+
run: |
37+
prefix="WasmEdge-plugin-${{ matrix.plugin }}"
38+
if [[ -n "${{ matrix.plugin_tag }}" ]]; then
39+
prefix="${prefix}-${{ matrix.plugin_tag }}"
40+
fi
41+
echo "artifact=${prefix}-${{ inputs.version }}-${{ matrix.asset_tag }}.tar.gz" >> "${GITHUB_OUTPUT}"
42+
- uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
repository: 'WasmEdge/WasmEdge' # TODO: checkout plugins from this repository
46+
- name: Ensure git safe directory
47+
run: |
48+
git config --global --add safe.directory "$(pwd)"
49+
- name: Build ${{ matrix.plugin }}
50+
run: |
51+
# TODO: Disable BUILD_TESTS on release
52+
# TODO: Enable CXX11_ABI if not manylinux_2_28
53+
cmake -Bbuild -GNinja \
54+
-DCMAKE_BUILD_TYPE=Release \
55+
-DWASMEDGE_BUILD_TESTS=ON \
56+
-DWASMEDGE_BUILD_TOOLS=OFF \
57+
-DWASMEDGE_USE_LLVM=OFF \
58+
-DWASMEDGE_USE_CXX11_ABI=OFF \
59+
"-DOPENSSL_ROOT_DIR=${OpenSSL_DIR}" \
60+
${{ matrix.options }}
61+
cmake --build build --target "${target}"
62+
63+
cp -f "${output_dir}/${bin}" "${bin}"
64+
tar -zcvf "${{ steps.var.outputs.artifact }}" "${bin}"
65+
- name: Test ${{ matrix.plugin }}
66+
run: |
67+
cd "${test_dir}" && "./${target}"
68+
- name: Upload ${{ steps.var.outputs.artifact }}
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: ${{ steps.var.outputs.artifact }}
72+
path: ${{ steps.var.outputs.artifact }}

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Build
3+
4+
on:
5+
pull_request:
6+
branches: [main]
7+
8+
permissions: {}
9+
10+
jobs:
11+
get-versions:
12+
uses: ./.github/workflows/get-versions.yml
13+
14+
parse-plugins:
15+
uses: ./.github/workflows/parse-plugins.yml
16+
17+
linux:
18+
needs:
19+
- get-versions
20+
- parse-plugins
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- name: manylinux_2_28 (x86_64)
26+
plugins: ${{ fromJSON(needs.parse-plugins.outputs.plugins).manylinux_2_28_x86_64 }}
27+
name: ${{ matrix.name }}
28+
uses: ./.github/workflows/build-on-linux.yml
29+
with:
30+
plugins: ${{ toJSON(matrix.plugins) }}
31+
version: ${{ needs.get-versions.outputs.version }}
32+
secrets: inherit

.github/workflows/get-versions.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Get versions
3+
4+
on:
5+
workflow_call:
6+
outputs:
7+
version:
8+
value: ${{ jobs.get-versions.outputs.version }}
9+
10+
jobs:
11+
get-versions:
12+
name: Retrieve version information
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.parse.outputs.version }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
repository: 'WasmEdge/WasmEdge' # TODO: checkout plugins from this repository
21+
- id: parse
22+
run: |
23+
git fetch --tags --force
24+
VERSION=$(git describe --match '[0-9].[0-9]*' --tag)
25+
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"

0 commit comments

Comments
 (0)