forked from extism/extism
-
Notifications
You must be signed in to change notification settings - Fork 0
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
22 changed files
with
579 additions
and
374 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
on: | ||
pull_request: | ||
paths: | ||
- .github/actions/extism/** | ||
- .github/workflows/ci-rust.yml | ||
- convert/** | ||
- manifest/** | ||
- runtime/** | ||
- rust/** | ||
- libextism/** | ||
workflow_dispatch: | ||
|
||
name: Rust CI | ||
|
||
env: | ||
RUNTIME_CRATE: extism | ||
LIBEXTISM_CRATE: libextism | ||
|
||
jobs: | ||
lib: | ||
name: Extism runtime lib | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
rust: | ||
- stable | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: Cache Rust environment | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Cache libextism | ||
id: cache-libextism | ||
uses: actions/cache@v3 | ||
with: | ||
path: target/release/libextism.* | ||
key: ${{ runner.os }}-libextism-${{ hashFiles('runtime/**') }}-${{ hashFiles('manifest/**') }}-${{ hashFiles('convert/**') }} | ||
- name: Cache target | ||
id: cache-target | ||
uses: actions/cache@v3 | ||
with: | ||
path: target/** | ||
key: ${{ runner.os }}-target-${{ github.sha }} | ||
- name: Build | ||
if: steps.cache-libextism.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: cargo build --release -p ${{ env.LIBEXTISM_CRATE }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: libextism-${{ matrix.os }} | ||
path: | | ||
target/release/libextism.* | ||
lint_and_test: | ||
name: Extism runtime lint and test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
rust: | ||
- stable | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: Cache Rust environment | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Cache target | ||
id: cache-target | ||
uses: actions/cache@v3 | ||
with: | ||
path: target/** | ||
key: ${{ runner.os }}-target-${{ github.sha }} | ||
- name: Format | ||
run: cargo fmt --check | ||
- name: Lint | ||
run: cargo clippy --all --release --all-features --no-deps -- -D "clippy::all" | ||
- name: Test | ||
run: cargo test --release | ||
- name: Test all features | ||
run: cargo test --all-features --release | ||
- name: Test no features | ||
run: cargo test --no-default-features --release | ||
bench: | ||
name: Benchmarking | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
rust: | ||
- stable | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: Cache Rust environment | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Cache target | ||
id: cache-target | ||
uses: actions/cache@v3 | ||
with: | ||
path: target/** | ||
key: ${{ runner.os }}-target-${{ github.sha }} | ||
- run: cargo install cargo-criterion | ||
- run: cargo criterion |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- kernel/** | ||
|
||
name: Kernel | ||
|
||
jobs: | ||
kernel: | ||
name: Build extism-runtime.wasm | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
target: wasm32-unknown-unknown | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Install deps | ||
run: | | ||
sudo apt install wabt --yes | ||
- name: Build kernel | ||
shell: bash | ||
continue-on-error: true | ||
run: | | ||
cd kernel | ||
sh build.sh | ||
git diff --exit-code | ||
export GIT_EXIT_CODE=$? | ||
- uses: peter-evans/create-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: ${{ env.GIT_EXIT_CODE }} != 0 | ||
with: | ||
author: "zshipko <[email protected]>" | ||
title: "update(kernel): extism-runtime.wasm in ${{ github.event.pull_request.head.ref }}" | ||
body: "Automated PR to update `runtime/src/extism-runtime.wasm` in PR #${{ github.event.number }}" | ||
base: "${{ github.event.pull_request.head.ref }}" | ||
branch: "update-kernel--${{ github.event.pull_request.head.ref }}" | ||
commit-message: "update(kernel): extism-runtime.wasm in ${{ github.event.pull_request.head.ref }}" | ||
delete-branch: true |
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
name: Release .NET Native NuGet Packages | ||
|
||
jobs: | ||
release-runtimes: | ||
name: release-dotnet-native | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
filter: tree:0 | ||
|
||
- name: Setup .NET Core SDK | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 7.x | ||
- uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: release.yml | ||
name: release-artifacts | ||
- name: Extract Archive | ||
run: | | ||
extract_archive() { | ||
# Check if both pattern and destination are provided | ||
if [ -z "$1" ] || [ -z "$2" ]; then | ||
echo "Usage: $0 <filename_pattern> <destination_directory>" | ||
return 1 | ||
fi | ||
# Set the filename pattern and destination directory | ||
filename_pattern="$1" | ||
destination_directory="$2" | ||
# Find the archive file with the specified pattern | ||
archive_file=$(ls $filename_pattern 2>/dev/null) | ||
# Check if an archive file is found | ||
if [ -n "$archive_file" ]; then | ||
echo "Found archive file: $archive_file" | ||
# Create the destination directory if it doesn't exist | ||
mkdir -p "$destination_directory" | ||
# Extract the archive to the specified destination | ||
tar -xzvf "$archive_file" -C "$destination_directory" | ||
echo "Extraction complete. Contents placed in: $destination_directory" | ||
else | ||
echo "No matching archive file found with the pattern: $filename_pattern" | ||
fi | ||
} | ||
extract_archive "libextism-x86_64-pc-windows-msvc-*.tar.gz" "nuget/runtimes/win-x64/native/" | ||
extract_archive "libextism-aarch64-apple-darwin-*.tar.gz" "nuget/runtimes/osx-arm64/native/" | ||
extract_archive "libextism-x86_64-apple-darwin-*.tar.gz" "nuget/runtimes/osx-x64/native/" | ||
extract_archive "libextism-x86_64-unknown-linux-gnu-*.tar.gz" "nuget/runtimes/linux-x64/native/" | ||
extract_archive "libextism-aarch64-unknown-linux-gnu-*.tar.gz" "nuget/runtimes/linux-arm64/native/" | ||
extract_archive "libextism-aarch64-unknown-linux-musl-*.tar.gz" "nuget/runtimes/linux-musl-arm64/native/" | ||
- name: Pack NuGet packages | ||
run: | | ||
find ./nuget -type f -name "*.csproj" -exec dotnet pack {} -o release-artifacts \; | ||
- name: Publish NuGet packages | ||
run: | | ||
dotnet nuget push --source https://api.nuget.org/v3/index.json ./release-artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Release Python SDK | ||
|
||
on: | ||
release: | ||
types: [published, edited] | ||
|
||
jobs: | ||
release-sdks: | ||
name: release-python | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: install twine | ||
run: | | ||
pip install twine | ||
- name: download release | ||
run: | | ||
tag='${{ github.ref }}' | ||
tag="${tag/refs\/tags\//}" | ||
mkdir dist | ||
cd dist | ||
gh release download "$tag" -p 'extism_sys-*' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: upload release | ||
run: | | ||
twine upload dist/* | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_API_USER }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
on: | ||
release: | ||
types: [published, edited] | ||
workflow_dispatch: | ||
|
||
name: Release Runtime/Rust SDK | ||
|
||
jobs: | ||
release-runtime: | ||
name: release-rust | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: '${{ github.ref }}' | ||
|
||
- name: Set version | ||
shell: bash | ||
run: | | ||
version="${{ github.ref }}" | ||
if [[ "$version" = "refs/heads/main" ]]; then | ||
version="0.0.0-dev" | ||
else | ||
version="${version/refs\/tags\/v/}" | ||
fi | ||
sed -i -e "s/0.0.0+replaced-by-ci/${version}/g" Cargo.toml | ||
pyproject="$(cat extism-maturin/pyproject.toml)" | ||
<<<"$pyproject" >extism-maturin/pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g' | ||
- name: Setup Rust env | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
target: ${{ matrix.target }} | ||
|
||
- name: Release Rust Convert Crate | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }} | ||
run: | | ||
version=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "extism") | .version') | ||
if ! &>/dev/null curl -sLIf https://crates.io/api/v1/crates/extism-convert/${version}/download; then | ||
cargo publish --manifest-path convert/Cargo.toml --allow-dirty | ||
else | ||
echo "already published ${version}" | ||
fi | ||
- name: Release Rust Manifest Crate | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }} | ||
run: | | ||
version=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "extism") | .version') | ||
if ! &>/dev/null curl -sLIf https://crates.io/api/v1/crates/extism-manifest/${version}/download; then | ||
cargo publish --manifest-path manifest/Cargo.toml --allow-dirty | ||
else | ||
echo "already published ${version}" | ||
fi | ||
- name: Release Runtime | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }} | ||
run: | | ||
version=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "extism") | .version') | ||
if ! &>/dev/null curl -sLIf https://crates.io/api/v1/crates/extism/${version}/download; then | ||
cargo publish --manifest-path runtime/Cargo.toml --allow-dirty | ||
else | ||
echo "already published ${version}" | ||
fi |
Oops, something went wrong.