Skip to content

Commit

Permalink
Enable arm64 workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hydai committed Oct 20, 2022
1 parent d10cb77 commit 1866137
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 33 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI

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

on:
push:
branches: [main]
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: examples

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

on:
workflow_dispatch:
inputs:
Expand Down
107 changes: 74 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
name: release

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

on:
push:
tags:
- 'v[0-9]+.[0-9]+.*'
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
name: Build on ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: arm64
- arch: amd64
runner: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -14,61 +30,86 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup WasmEdge build env
run: |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
echo "LD_LIBRARY_PATH=$HOME/.wasmedge/lib" >> $GITHUB_ENV
rustup default nightly
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
release:
permissions:
contents: write
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set RELEASE_VERSION ENV var
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
key: ${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: lowercase the runner OS name
shell: bash
run: |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- name: Setup WasmEdge build env
run: |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --os=${{ matrix.os }} --arch=${{ matrix.warch }}
echo "LD_LIBRARY_PATH=$HOME/.wasmedge/lib" >> $GITHUB_ENV
- name: Install nightly Rust toolchain
- name: Install deps on arm64
run: |
sudo apt update
sudo apt install -y clang llvm
- name: Install nightly Rust Toolchain
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: nightly
default: true
- name: Build release
run: cargo build --verbose --release
- name: package release assets

- name: Build
run: |
cargo build --verbose --release
- name: package assets
run: |
mkdir _dist
cp target/release/containerd-shim-wasmedge-v1 _dist/
cd _dist
tar czf containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz containerd-shim-wasmedge-v1
tar czf containerd-shim-wasmedge-v1-${{ env.RUNNER_OS }}-${{ matrix.arch }}.tar.gz containerd-shim-wasmedge-v1
- name: upload binary as GitHub artifact
uses: actions/upload-artifact@v3
with:
name: containerd-shim-wasmedge-v1
path: _dist/containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz
name: containerd-shim-wasmedge-v1-${{ matrix.arch }}
path: _dist/containerd-shim-wasmedge-v1-${{ env.RUNNER_OS }}-${{ matrix.arch }}.tar.gz

- name: Test
run: |
cargo test --verbose
release:
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: arm64
- arch: amd64
runner: ubuntu-latest
steps:
- name: Set RELEASE_VERSION ENV var
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: lowercase the runner OS name
shell: bash
run: |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
name: containerd-shim-wasmedge-v1-${{ matrix.arch }}
- name: Apply version
run: mv containerd-shim-wasmedge-v1-${{ env.RUNNER_OS }}-${{ matrix.arch }}.tar.gz containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.arch }}.tar.gz
- name: upload binary to GitHub release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: _dist/containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz
asset_name: containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz
file: containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.arch }}.tar.gz
asset_name: containerd-shim-wasmedge-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.arch }}.tar.gz
overwrite: true
prerelease: true
tag: ${{ github.ref }}
body: |
Release of containerd-shim-wasmedge-v1:${{ env.RELEASE_VERSION }} for amd64
Release of containerd-shim-wasmedge-v1:${{ env.RELEASE_VERSION }} for amd64 and arm64

0 comments on commit 1866137

Please sign in to comment.