Skip to content

Commit e76c3fa

Browse files
committed
ci: build plugins
- add entry workflow - implement `get-versions` - implement `build-on-linux` Signed-off-by: Yi Huang <yi@secondstate.io>
1 parent ac0d5ab commit e76c3fa

3 files changed

Lines changed: 126 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
steps:
32+
- id: var
33+
run: |
34+
prefix="WasmEdge-plugin-${{ matrix.plugin }}"
35+
if [[ ! -z "${{ matrix.plugin_tag }}" ]]; then
36+
prefix="${prefix}-${{ matrix.plugin_tag }}"
37+
fi
38+
echo "artifact=${prefix}-${{ inputs.version }}-${{ matrix.asset_tag }}.tar.gz" >> "${GITHUB_OUTPUT}"
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
repository: 'WasmEdge/WasmEdge' # TODO: checkout plugins from this repository
43+
- name: Ensure git safe directory
44+
run: |
45+
git config --global --add safe.directory "$(pwd)"
46+
- name: Build ${{ matrix.plugin }}
47+
run: |
48+
# TODO: Disable BUILD_TESTS on release
49+
# TODO: Enable CXX11_ABI if not manylinux_2_28
50+
cmake -Bbuild -GNinja \
51+
-DCMAKE_BUILD_TYPE=Release \
52+
-DWASMEDGE_BUILD_TESTS=ON \
53+
-DWASMEDGE_BUILD_TOOLS=OFF \
54+
-DWASMEDGE_USE_LLVM=OFF \
55+
-DWASMEDGE_USE_CXX11_ABI=OFF \
56+
"-DOPENSSL_ROOT_DIR=${OpenSSL_DIR}" \
57+
${{ matrix.options }}
58+
cmake --build build --target "${target}"
59+
60+
cp -f "${output_dir}/${bin}" "${bin}"
61+
tar -zcvf "${{ steps.var.outputs.artifact }}" "${bin}"
62+
- name: Test ${{ matrix.plugin }}
63+
run: |
64+
cd "${test_dir}" && "./${target}"
65+
- name: Upload ${{ steps.var.outputs.artifact }}
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ steps.var.outputs.artifact }}
69+
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)