forked from containerd/runwasi
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
82 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 |