-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from cpuguy83/fixup_for_publishing
More publishing cleanup
- Loading branch information
Showing
26 changed files
with
180 additions
and
169 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ LICENSE | |
.dockerignore | ||
docs | ||
bin/ | ||
Dockerfile | ||
docker-bake.hcl | ||
release/ |
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,137 +1,83 @@ | ||
name: release | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
group: release-${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.*' | ||
- '**/v[0-9]+.[0-9]+.*' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
REPO_SLUG: "deislabs/runwasi" | ||
|
||
jobs: | ||
hub: | ||
generate: | ||
runs-on: ubuntu-latest | ||
name: Generate | ||
outputs: | ||
crate: ${{ steps.parse-ref.outputs.crate }} | ||
version: ${{ steps.parse-ref.outputs.version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- id: parse-ref | ||
run: | | ||
echo "CRATE=$(cut -d/ -f1 <<<"${GITHUB_REF#refs/*/}")" >> $GITHUB_OUTPUT | ||
echo "VERSION=$(cut -d/ -f2 <<<"${GITHUB_REF#refs/*/}")" >> $GITHUB_OUTPUT | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REPO_SLUG }} | ||
### frontend versioning | ||
### on semver tag: | ||
# deislabs/runwasi:1.2.3 | ||
# deislabs/runwasi:1.2 | ||
# deislabs/runwasi:1 | ||
# deislabs/runwasi:latest | ||
### on pre-release tag: | ||
# deislabs/runwasi:1.1.0-rc.1 | ||
### on push default branch (main): | ||
# deislabs/runwasi:main | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=ref,event=branch | ||
type=raw,value=latest | ||
type=ref,event=pr | ||
bake-target: meta-helper | ||
flavor: | | ||
latest=false | ||
- name: Login to DockerHub | ||
if: ${{ github.event_name != 'pull_request' }} | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USER }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/bake-action@v2 | ||
with: | ||
files: | | ||
./docker-bake.hcl | ||
${{ steps.meta.outputs.bake-file }} | ||
targets: image-cross | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- generate | ||
strategy: | ||
matrix: | ||
os: ["ubuntu-20.04", "ubuntu-22.04"] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: "check cgroup version" | ||
run: "mount | grep cgroup" | ||
- uses: actions/checkout@v3 | ||
- name: Install rust | ||
run: | | ||
set -e | ||
toolchain="$(grep "ARG RUST_VERSION" Dockerfile | cut -d = -f2)" | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${toolchain:-stable} | ||
- name: Setup WasmEdge build env | ||
if: ${{ contains(needs.generate.outputs.crate, 'wasmedge' ) }} | ||
run: | | ||
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --version=0.11.2 | ||
echo "LD_LIBRARY_PATH=$HOME/.wasmedge/lib" >> $GITHUB_ENV | ||
- name: Install deps on arm64 | ||
run: | | ||
sudo apt update | ||
sudo apt install -y clang llvm | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
run: cargo build --verbose --package ${{ needs.generate.outputs.crate }} | ||
- name: Test | ||
run: cargo test --verbose --package ${{ needs.generate.outputs.crate }} | ||
|
||
release: | ||
permissions: | ||
contents: write | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: | ||
- build | ||
- generate | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup WasmEdge build env | ||
run: | | ||
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --version=0.11.2 | ||
echo "LD_LIBRARY_PATH=$HOME/.wasmedge/lib" >> $GITHUB_ENV | ||
- name: Install deps on arm64 | ||
run: | | ||
sudo apt update | ||
sudo apt install -y clang llvm | ||
- 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 | ||
- name: Install latest Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
- name: build release | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release | ||
- name: package release assets | ||
run: | | ||
mkdir _dist | ||
cp target/release/containerd-shim-wasmtime-v1 _dist/ | ||
cp target/release/containerd-shim-wasmedge-v1 _dist/ | ||
cd _dist | ||
tar czf containerd-shim-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz containerd-shim-wasmtime-v1 containerd-shim-wasmedge-v1 | ||
- uses: actions/checkout@v3 | ||
- name: Setup buildx | ||
run: docker buildx create --use | ||
- name: build binaries | ||
run: docker buildx bake --set *.cache-from=type=gha --set *.cache-to=type=gha release-tars | ||
env: | ||
CRATE: ${{ needs.generate.outputs.crate }} | ||
- name: upload binary as GitHub artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: containerd-shim-v1 | ||
path: _dist/containerd-shim-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz | ||
- name: upload binary to GitHub release | ||
uses: svenstaro/[email protected] | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: _dist/containerd-shim-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz | ||
asset_name: containerd-shim-v1-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-amd64.tar.gz | ||
overwrite: true | ||
prerelease: true | ||
tag: ${{ github.ref }} | ||
body: | | ||
Release of containerd-shim-v1:${{ env.RELEASE_VERSION }} for amd64 | ||
path: release/ | ||
name: ${{ needs.generate.outputs.crate }}-${{ needs.generate.outputs.version }} | ||
- name: Create release | ||
run: | | ||
gh release create ${{ github.ref }} --generate-notes --prerelease | ||
for i in release/*/*; do | ||
gh release upload ${RELEASE_NAME} $i | ||
done | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
RELEASE_NAME: ${{ needs.generate.outputs.crate }}/${{ needs.generate.outputs.version }} |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ test/out/img.tar | |
!crates/wasmedge/src/bin/ | ||
!crates/wasmtime/src/bin/ | ||
test/k8s/_out | ||
release/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.