Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
rgl committed Feb 10, 2024
0 parents commit de2e4d6
Show file tree
Hide file tree
Showing 16 changed files with 2,199 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = ["wasm32-wasi"]
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: build
on:
- push
jobs:
build:
runs-on: ubuntu-22.04
name: Build
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: '1.76.0'
target: wasm32-wasi
- name: Install WasmEdge
run: ./.github/workflows/install-wasmedge.sh
- name: Install build dependencies
run: ./build.sh dependencies
- name: Build
run: ./build.sh build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
dist/*
release:
if: startsWith(github.ref, 'refs/tags/v')
name: Release
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Install crane
run: ./.github/workflows/install-crane.sh
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Release
run: ./build.sh release
- name: Release binary artifact
uses: ncipollo/release-action@v1
with:
bodyFile: dist/release-notes.md
artifacts: dist/*.tgz
token: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/install-crane.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -euxo pipefail

# see https://github.com/google/go-containerregistry/releases
version="${CRANE_VERSION:-0.19.0}"

# bail when already installed.
if [ -x "/usr/local/bin/crane" ]; then
# e.g. 0.19.0
actual_version="$(/usr/local/bin/crane version)"
if [ "$actual_version" == "$version" ]; then
echo 'ANSIBLE CHANGED NO'
exit 0
fi
fi

# download and install.
url="https://github.com/google/go-containerregistry/releases/download/v$version/go-containerregistry_Linux_x86_64.tar.gz"
t="$(mktemp -q -d --suffix=.crane)"
wget -qO- "$url" | tar xzf - -C "$t" --strip-components=0 crane
install -m 755 "$t/crane" /usr/local/bin/crane
rm -rf "$t"
22 changes: 22 additions & 0 deletions .github/workflows/install-wasmedge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -euxo pipefail

# see https://github.com/WasmEdge/WasmEdge/releases
WASMEDGE_VERSION="${WASMEDGE_VERSION:-0.13.5}"

# bail when already installed.
if [ -x /usr/local/bin/wasmedge ]; then
# e.g. wasmedge version 0.13.5
actual_version="$(/usr/local/bin/wasmedge --version | perl -ne '/([^ ]+)$/ && print $1')"
if [ "$actual_version" == "$WASMEDGE_VERSION" ]; then
echo 'ANSIBLE CHANGED NO'
exit 0
fi
fi

# download and install.
wasmedge_url="https://github.com/WasmEdge/WasmEdge/releases/download/${WASMEDGE_VERSION}/WasmEdge-${WASMEDGE_VERSION}-ubuntu20.04_x86_64.tar.gz"
rm -rf /opt/wasmedge
install -d /opt/wasmedge
wget -qO- "$wasmedge_url" | tar xzf - -C /opt/wasmedge --strip-components 1
ln -fs /opt/wasmedge/bin/wasmedge /usr/local/bin/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
dist/
tmp/
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cSpell.words": [
"askama",
"wasi",
"wasmedge"
]
}
Loading

0 comments on commit de2e4d6

Please sign in to comment.