Skip to content
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
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM wasmedge/wasmedge:ci-image-base
6 changes: 6 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "WasmEdge devcontainer development",
"build": {
"dockerfile": "Dockerfile"
}
}
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/debug
135 changes: 135 additions & 0 deletions .github/workflows/build_for_openwrt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Test WasmEdge on OpenWrt

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:

permissions:
contents: read

jobs:
build_openwrt:
name: OpenWrt
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
with:
egress-policy: audit

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Ensure git safe directory
run: |
git config --global --add safe.directory $(pwd)
- name: Download WasmEdge 0.18.1 source
run: |
curl -fsSL https://github.com/WasmEdge/WasmEdge/archive/refs/tags/0.18.1.tar.gz -o WasmEdge-0.18.1.tar.gz
mkdir -p WasmEdge
tar -xzf WasmEdge-0.18.1.tar.gz --strip-components=1 -C WasmEdge
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.9'
- name: Restore OpenWrt
id: restore-openwrt
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ./openwrt-x86-64-generic-rootfs.tar.gz
key: openwrt-${{ hashFiles('.github/workflows/build_for_openwrt.yml') }}
- name: Install dependency
if: steps.restore-openwrt.outputs.cache-hit != 'true'
run: |
git clone https://github.com/openwrt/openwrt.git ./openwrt
cd ./openwrt
git checkout 9dc86d19628f55bfed2048c412c5b23bda328cff
- name: Update feeds
if: steps.restore-openwrt.outputs.cache-hit != 'true'
run: |
cd ./openwrt
./scripts/feeds update -a
./scripts/feeds install -a
- name: Make WasmEdge package
if: steps.restore-openwrt.outputs.cache-hit != 'true'
run: |
cd .
mkdir -p ./openwrt/package/utils/WasmEdge
cp -r ./WasmEdge ./openwrt/package/utils/WasmEdge/src
cp ./WasmEdge/utils/openwrt/configuration/Makefile ./openwrt/package/utils/WasmEdge/
cd ./openwrt
ls ./
rm -f ./.config*
touch ./.config
cat >> .config <<EOF
CONFIG_TARGET_IMAGES_GZIP=y
CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_64=y
CONFIG_TARGET_x86_64_DEVICE_generic=y
CONFIG_HAS_SUBTARGETS=y
CONFIG_HAS_DEVICES=y
CONFIG_TARGET_BOARD="x86"
CONFIG_TARGET_SUBTARGET="64"
CONFIG_TARGET_PROFILE="DEVICE_generic"
CONFIG_TARGET_ARCH_PACKAGES="x86_64"
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_libstdcpp=y
CONFIG_PACKAGE_WasmEdge=y
EOF
sed -i 's/^[ \t]*//g' ./.config
make defconfig
make download -j8 || make download -j1 V=s
rm -rf $(find ./dl/ -size -1024c)
make -j$(nproc) || make -j1 V=s
- name: Pack OpenWrt images and WasmEdge ipk
if: steps.restore-openwrt.outputs.cache-hit != 'true'
run: |
cp -rf $(find ./openwrt/bin/ -type f -name "openwrt-x86-64-generic-rootfs.tar.gz") ./
- name: Save OpenWrt
if: steps.restore-openwrt.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ./openwrt-x86-64-generic-rootfs.tar.gz
key: ${{ steps.restore-openwrt.outputs.cache-primary-key }}
- name: Upload artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: openwrt-rootfs
path: ./openwrt-x86-64-generic-rootfs.tar.gz

build_openwrt_docker:
name: OpenWrt-docker
runs-on: ubuntu-latest
needs: build_openwrt
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
with:
egress-policy: audit

- name: Download image
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: openwrt-rootfs
path: ./
- name: make_openwrt_docker
run: |
mkdir -p ./openwrt-docker
cp openwrt-x86-64-generic-rootfs.tar.gz ./openwrt-docker/
cd openwrt-docker

touch ./Dockerfile
cat >> ./Dockerfile <<EOF
FROM scratch
ADD openwrt-x86-64-generic-rootfs.tar.gz /
EXPOSE 22 80 443
ENTRYPOINT ["/sbin/init"]
EOF

ls ./
docker build -t openwrt .
docker run --name openwrt -d --privileged openwrt:latest /sbin/init
docker exec openwrt wasmedge -v
Loading
Loading