Skip to content

v0.1.1

v0.1.1 #14

Workflow file for this run

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: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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@v4
with:
name: engine
path: lib/target/wasm32-wasi/release/core.wasm
- name: Upload wasi-deps
uses: actions/upload-artifact@v4
with:
name: wasi-deps
path: lib/target/wasm32-wasi/wasi-deps/
compile_cli:
name: Compile CLI
needs: compile_core
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-latest
path: bin/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: bin/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: bin/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: bin/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: bin\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: bin\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@v4
with:
name: engine
path: bin
- uses: actions/download-artifact@v4
with:
name: wasi-deps
path: wasi-deps
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
target: ${{ matrix.target }}
default: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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: cd bin && cargo build --release --target ${{ matrix.target }} --package extism-py
- name: Create directory structure
run: mkdir -p extism-py/bin extism-py/share && mv wasi-deps/usr extism-py/share/extism-py && mv ${{ matrix.path }} extism-py/bin/
- name: Archive assets
run: tar czf ${{ matrix.asset_name }}.tar.gz extism-py
- name: Upload assets to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}.tar.gz
path: ${{ matrix.asset_name }}.tar.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 }}.tar.gz
asset_name: ${{ matrix.asset_name }}.tar.gz
asset_content_type: application/gzip
- name: Generate asset hash (Linux/MacOS)
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.tar.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.tar.gz.sha256
if: runner.os != 'Windows'
- name: Generate asset hash (Windows)
run: Get-FileHash -Path ${{ matrix.asset_name }}.tar.gz -Algorithm SHA256 | Select-Object -ExpandProperty Hash > ${{ matrix.asset_name }}.tar.gz.sha256
shell: pwsh
if: runner.os == 'Windows'
- name: Upload asset hash to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}.tar.gz.sha256
path: ${{ matrix.asset_name }}.tar.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 }}.tar.gz.sha256
asset_name: ${{ matrix.asset_name }}.tar.gz.sha256
asset_content_type: plain/text