Skip to content

Commit

Permalink
add workflow release
Browse files Browse the repository at this point in the history
Signed-off-by: dierbei <1628652790@qq.com>
  • Loading branch information
dierbei committed Sep 27, 2023
1 parent cec5440 commit 5827157
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 4 deletions.
131 changes: 131 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: release

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

on:
push:
tags:
- '**/v[0-9]+.[0-9]+.*'

env:
CARGO_TERM_COLOR: always

jobs:
vmm:
strategy:
matrix:
features: ["cloud_hypervisor"]

runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Build vmm
run: make vmm HYPERVISOR=${{ matrix.features }} RUNTIME=docker
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.features }}
path: bin/

quark:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Build quark
run: make quark
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: quark
path: bin/

wasm:
strategy:
matrix:
features: ["wasmedge"]

runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Install WasmEdge
if: ${{ matrix.features }} == 'wasmedge'
run: curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.11.2 >> /dev/null
- name: Build wasm
run: make wasm WASM_RUNTIME=${{ matrix.features }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.features }}
path: bin/

shim:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Build shim
working-directory: shim
run: make all
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: shim
path: shim/bin/

containerd:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Download and Extract Containerd
run: make install/containerd
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: containerd
path: bin/

release:
permissions:
contents: write
needs:
- vmm
- quark
- wasm
- shim
- containerd
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set RELEASE_VERSION ENV var
run: |
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "ARCHIVE_NAME=kuasar-${GITHUB_REF:10}-linux-amd64.tar.gz" >> $GITHUB_ENV
echo "VENDOR_NAME=kuasar-${GITHUB_REF:10}-vendor.tar.gz" >> $GITHUB_ENV
- name: Package vendor
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ env.RELEASE_VERSION }} --generate-notes
make vendor
mkdir ../temp
cp -r ./* ../temp/
tar -czvf ${{ env.VENDOR_NAME }} -C ../temp .
gh release upload ${{ env.RELEASE_VERSION }} ${{ env.VENDOR_NAME }}
- uses: actions/download-artifact@v3
with:
path: _artifacts
- name: Package release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p _dist
find _artifacts -type f | xargs -I {} cp {} _dist/
tar -czvf ${{ env.ARCHIVE_NAME }} -C _dist .
gh release upload ${{ env.RELEASE_VERSION }} ${{ env.ARCHIVE_NAME }}
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ BIN_DIR := /usr/local/bin
SYSTEMD_SERVICE_DIR := /usr/lib/systemd/system
SYSTEMD_CONF_DIR := /etc/sysconfig

.PHONY: vmm wasm quark clean all install-vmm install-wasm install-quark install
.PHONY: vmm wasm quark clean all install-vmm install-wasm install-quark install install/containerd vendor

all: vmm quark wasm

bin/vmm-sandboxer:
@cd vmm/sandbox && cargo build --release --features=${HYPERVISOR}
@mkdir -p bin && cp vmm/sandbox/target/release/vmm-sandboxer bin/vmm-sandboxer

bin/vmm-task:
@cd vmm/task && cargo build --release --target=${ARCH}-unknown-linux-musl
@mkdir -p bin && cp vmm/task/target/${ARCH}-unknown-linux-musl/release/vmm-task bin/vmm-task
Expand All @@ -28,11 +28,11 @@ bin/vmlinux.bin:

bin/kuasar.img:
@bash -x vmm/scripts/image/${GUESTOS_IMAGE}/build.sh image
@mkdir -p bin && cp /tmp/kuasar.img bin/kuasar.img && rm /tmp/kuasar.img
@mkdir -p bin && cp /tmp/kuasar.img bin/kuasar.img && sudo rm /tmp/kuasar.img

bin/kuasar.initrd:
@bash -x vmm/scripts/image/${GUESTOS_IMAGE}/build.sh initrd
@mkdir -p bin && cp /tmp/kuasar.initrd bin/kuasar.initrd && rm /tmp/kuasar.initrd
@mkdir -p bin && cp /tmp/kuasar.initrd bin/kuasar.initrd && sudo rm /tmp/kuasar.initrd

bin/wasm-sandboxer:
@cd wasm && cargo build --release --features=${WASM_RUNTIME}
Expand Down Expand Up @@ -86,4 +86,16 @@ install-quark:
@install -d -m 750 ${DEST_DIR}${SYSTEMD_SERVICE_DIR}
@install -p -m 640 quark/service/kuasar-quark.service ${DEST_DIR}${SYSTEMD_SERVICE_DIR}/kuasar-quark.service

install/containerd:
curl -LJO https://github.com/containerd/containerd/releases/download/v1.7.0/containerd-1.7.0-linux-amd64.tar.gz
mkdir bin && tar -C bin -xzvf containerd-1.7.0-linux-amd64.tar.gz
cp docs/config.toml bin/

install: all install-vmm install-wasm install-quark

vendor:
(cd quark && cargo vendor)
(cd shim && cargo vendor)
(cd vmm/sandbox && cargo vendor)
(cd vmm/task && cargo vendor)
(cd wasm && cargo vendor)
31 changes: 31 additions & 0 deletions docs/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version = 2

[plugins."io.containerd.grpc.v1.cri"]
disable_apparmor = true

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.vmm]
runtime_type = "io.containerd.kuasar.v1"
sandboxer = "vmm"
io_type = "hvsock"

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.quark]
runtime_type = "io.containerd.quark.v1"
sandboxer = "quark"

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasm]
runtime_type = "io.containerd.wasm.v1"
sandboxer = "wasm"

[proxy_plugins.vmm]
type = "sandbox"
address = "/run/vmm-sandboxer.sock"

[proxy_plugins.quark]
type = "sandbox"
address = "/run/quark-sandboxer.sock"

[proxy_plugins.wasm]
type = "sandbox"
address = "/run/wasm-sandboxer.sock"
4 changes: 4 additions & 0 deletions vmm/scripts/kernel/cloud_hypervisor/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ set -e

readonly version=${1:-6.1.6}
readonly base_dir="$(dirname $(readlink -f $0))"

sudo apt-get update
sudo apt-get install -y libelf-dev elfutils

# clone kernel from cloud-hypervisor github
rm -rf /tmp/linux-cloud-hypervisor
git clone --depth 1 https://github.com/cloud-hypervisor/linux.git -b ch-${version} /tmp/linux-cloud-hypervisor
Expand Down

0 comments on commit 5827157

Please sign in to comment.