-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add imports, use decorator for exports (#7)
- Loading branch information
Showing
19 changed files
with
866 additions
and
104 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "cargo" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
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,71 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- name: linux | ||
os: ubuntu-latest | ||
# - name: windows | ||
# os: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: stable | ||
target: wasm32-wasi | ||
default: true | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.x' | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Update deps (Linux) | ||
run: | | ||
go install github.com/extism/cli/extism@c1eb1fc | ||
cd /tmp | ||
# get just wasm-merge and wasm-opt | ||
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-linux.tar.gz > binaryen.tar.gz | ||
tar xvzf binaryen.tar.gz | ||
sudo cp binaryen-version_116/bin/wasm-merge /usr/local/bin | ||
sudo cp binaryen-version_116/bin/wasm-opt /usr/local/bin | ||
if: runner.os != 'Windows' | ||
|
||
- name: Update deps (Windows) | ||
run: | | ||
powershell -executionpolicy bypass -File .\install-wasi-sdk.ps1 | ||
go install github.com/extism/cli/extism@c1eb1fc | ||
Remove-Item -Recurse -Path "c:\Program files\Binaryen" -Force -ErrorAction SilentlyContinue > $null 2>&1 | ||
New-Item -ItemType Directory -Force -Path "c:\Program files\Binaryen" -ErrorAction Stop > $null 2>&1 | ||
Invoke-WebRequest -Uri "https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-windows.tar.gz" -OutFile "$env:TMP\binaryen-version_116-x86_64-windows.tar.gz" | ||
7z x "$env:TMP\binaryen-version_116-x86_64-windows.tar.gz" -o"$env:TMP\" >$null 2>&1 | ||
7z x -ttar "$env:TMP\binaryen-version_116-x86_64-windows.tar" -o"$env:TMP\" >$null 2>&1 | ||
Copy-Item -Path "$env:TMP\binaryen-version_116\bin\wasm-opt.exe" -Destination "c:\Program files\Binaryen" -ErrorAction Stop > $null 2>&1 | ||
Copy-Item -Path "$env:TMP\binaryen-version_116\bin\wasm-merge.exe" -Destination "c:\Program files\Binaryen" -ErrorAction Stop > $null 2>&1 | ||
if: runner.os == 'Windows' | ||
|
||
- name: Run Tests (Linux) | ||
run: | | ||
make | ||
make test | ||
if: runner.os != 'Windows' | ||
|
||
- name: Run Tests (Windows) | ||
run: | | ||
set PATH="c:\Program files\Binaryen\";%PATH% | ||
make | ||
make test | ||
shell: cmd | ||
if: runner.os == 'Windows' | ||
|
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,160 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
compile_core: | ||
name: Compile Core | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: stable | ||
target: wasm32-wasi | ||
default: true | ||
|
||
- name: Get wasm-opt | ||
run: | | ||
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-linux.tar.gz > binaryen.tar.gz | ||
tar xvzf binaryen.tar.gz | ||
sudo cp binaryen-version_116/bin/wasm-opt /usr/local/bin | ||
sudo chmod +x /usr/local/bin/wasm-opt | ||
- name: Make core | ||
run: make core | ||
|
||
- name: Opt core | ||
run: wasm-opt --enable-reference-types --enable-bulk-memory --strip -O3 lib/target/wasm32-wasi/release/core.wasm -o lib/target/wasm32-wasi/release/core.wasm | ||
|
||
- name: Upload core binary to artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: engine | ||
path: lib/target/wasm32-wasi/release/core.wasm | ||
|
||
compile_cli: | ||
name: Compile CLI | ||
needs: compile_core | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- name: linux | ||
os: ubuntu-latest | ||
path: target/x86_64-unknown-linux-gnu/release/extism-py | ||
asset_name: extism-py-x86_64-linux-${{ github.event.release.tag_name }} | ||
shasum_cmd: sha256sum | ||
target: x86_64-unknown-linux-gnu | ||
- name: linux-arm64 | ||
os: ubuntu-latest | ||
path: target/aarch64-unknown-linux-gnu/release/extism-py | ||
asset_name: extism-py-aarch64-linux-${{ github.event.release.tag_name }} | ||
shasum_cmd: sha256sum | ||
target: aarch64-unknown-linux-gnu | ||
- name: macos | ||
os: macos-latest | ||
path: target/x86_64-apple-darwin/release/extism-py | ||
asset_name: extism-py-x86_64-macos-${{ github.event.release.tag_name }} | ||
shasum_cmd: shasum -a 256 | ||
target: x86_64-apple-darwin | ||
- name: macos-arm64 | ||
os: macos-latest | ||
path: target/aarch64-apple-darwin/release/extism-py | ||
asset_name: extism-py-aarch64-macos-${{ github.event.release.tag_name }} | ||
shasum_cmd: shasum -a 256 | ||
target: aarch64-apple-darwin | ||
# - name: windows | ||
# os: windows-latest | ||
# path: target\x86_64-pc-windows-msvc\release\extism-py.exe | ||
# asset_name: extism-py-x86_64-windows-${{ github.event.release.tag_name }} | ||
# target: x86_64-pc-windows-msvc | ||
# - name: windows-arm64 | ||
# os: windows-latest | ||
# path: target\aarch64-pc-windows-msvc\release\extism-py.exe | ||
# asset_name: extism-py-aarch64-windows-${{ github.event.release.tag_name }} | ||
# target: aarch64-pc-windows-msvc | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: engine | ||
path: bin | ||
|
||
- name: ls | ||
run: ls -R | ||
working-directory: bin | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
default: true | ||
|
||
- name: Install gnu gcc | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install g++-aarch64-linux-gnu | ||
sudo apt-get install gcc-aarch64-linux-gnu | ||
if: matrix.os == 'ubuntu-latest' | ||
|
||
- name: Build CLI ${{ matrix.os }} | ||
env: | ||
EXTISM_ENGINE_PATH: core.wasm | ||
run: cargo build --release --target ${{ matrix.target }} --package extism-py | ||
|
||
- name: Archive assets | ||
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz | ||
|
||
- name: Upload assets to artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.asset_name }}.gz | ||
path: ${{ matrix.asset_name }}.gz | ||
|
||
- name: Upload assets to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./${{ matrix.asset_name }}.gz | ||
asset_name: ${{ matrix.asset_name }}.gz | ||
asset_content_type: application/gzip | ||
|
||
- name: Generate asset hash (Linux/MacOS) | ||
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256 | ||
if: runner.os != 'Windows' | ||
|
||
- name: Generate asset hash (Windows) | ||
run: Get-FileHash -Path ${{ matrix.asset_name }}.gz -Algorithm SHA256 | Select-Object -ExpandProperty Hash > ${{ matrix.asset_name }}.gz.sha256 | ||
shell: pwsh | ||
if: runner.os == 'Windows' | ||
|
||
- name: Upload asset hash to artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.asset_name }}.gz.sha256 | ||
path: ${{ matrix.asset_name }}.gz.sha256 | ||
|
||
- name: Upload asset hash to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./${{ matrix.asset_name }}.gz.sha256 | ||
asset_name: ${{ matrix.asset_name }}.gz.sha256 | ||
asset_content_type: plain/text | ||
|
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,3 +1,4 @@ | ||
target | ||
Cargo.lock | ||
extism-py | ||
examples/*.wasm |
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
Oops, something went wrong.