Skip to content

Commit

Permalink
Merge pull request #3 from extism/add-arm-builds
Browse files Browse the repository at this point in the history
feat: Add arm builds, install script
  • Loading branch information
bhelx authored Jan 20, 2023
2 parents 70be822 + 636c142 commit 550c074
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build]
rustflags = ["-C", "relocation-model=pic", "--emit=obj"]
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
28 changes: 25 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,28 @@ jobs:
include:
- name: linux
os: ubuntu-latest
path: target/release/extism-js
path: target/x86_64-unknown-linux-gnu/release/extism-js
asset_name: extism-js-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-js
asset_name: extism-js-aarch64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: aarch64-unknown-linux-gnu
- name: macos
os: macos-latest
path: target/release/extism-js
path: target/x86_64-apple-darwin/release/extism-js
asset_name: extism-js-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-js
asset_name: extism-js-aarch64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: aarch64-apple-darwin
# - name: windows
# os: windows-latest
# path: target\release\extism-js.exe
Expand All @@ -71,14 +85,22 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
profile: default
toolchain: 1.66.0
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: js_pdk_core.wasm
run: cargo build --release --package js-pdk-cli
run: cargo build --release --target ${{ matrix.target }} --package js-pdk-cli

- name: Archive assets
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
]

[workspace.package]
version = "0.2.0"
version = "0.3.1"
edition = "2021"
authors = ["The Extism Authors"]
license = "BSD-Clause-3"
Expand Down
26 changes: 4 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,15 @@ This new Wasm file can be used just like any other Extism plugin.

We now have released binaries. Check the [releases](https://github.com/extism/js-pdk/releases) page for the latest.

> **Note**: Windows is not currently a supported platform.
> **Note**: Windows is not currently a supported platform, only mac and linux
### Installing on a Mac

Run the script below to install on Mac:
## Install Script

```bash
export TAG=v0.3.0
curl -O "https://github.com/extism/js-pdk/releases/download/$TAG/extism-js-x86_64-macos-$TAG.gz"
gunzip extism-js*.gz
sudo mv extism-js-* /usr/local/bin/extism-js
chmod +x /usr/local/bin/extism-js
curl -O https://raw.githubusercontent.com/extism/js-pdk/main/install.sh
sh install.sh
```

### Installing on Linux

Run the script below to install on Linux:

```bash
export TAG=v0.3.0
curl -O "https://github.com/extism/js-pdk/releases/download/$TAG/extism-js-x86_64-linux-$TAG.gz"
gunzip extism-js*.gz
sudo mv extism-js-* /usr/local/bin/extism-js
chmod +x /usr/local/bin/extism-js
```


Then run command with no args to see the help:

```
Expand Down
20 changes: 20 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
OS=''
case "$OSTYPE" in
darwin*) OS="macos" ;;
linux*) OS="linux" ;;
*) echo "unknown os: $OSTYPE" && exit 1 ;;
esac

ARCH=`uname -m`
case "$ARCH" in
ix86*) ARCH="x86_64" ;;
arm64*) ARCH="aarch64" ;;
*) echo "unknown arch: $ARCH" && exit 1 ;;
esac


export TAG="v0.3.1"
curl -O "https://github.com/extism/js-pdk/releases/download/$TAG/extism-js-$ARCH-$OS-$TAG.gz"
gunzip extism-js*.gz
sudo mv extism-js-* /usr/local/bin/extism-js
chmod +x /usr/local/bin/extism-js

0 comments on commit 550c074

Please sign in to comment.