Skip to content

Commit

Permalink
ci: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
G4Vi committed Aug 22, 2024
1 parent 77ad382 commit 6180b52
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/actions/libextism/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on: [workflow_call]

name: libextism

runs:
using: composite
steps:
- uses: actions/checkout@v3
with:
repository: extism/cli
path: .extism-cli
- uses: ./.extism-cli/.github/actions/extism-cli
- name: Install
shell: bash
run: sudo extism lib install --version git
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test-example:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libextism

- name: Install WASI SDK
run: |
bash install-wasi-sdk.sh
echo '$WASI_SDK_PATH="'$(pwd)'"/wasi-sdk' >> $GITHUB_ENV
- name: Example
run: |
cd examples/count-vowels
TEST=$(make run)
echo $TEST | grep '"count": 4'
- name: Tests
if: matrix.os != 'macos-latest'
run: |
cd tests
make test
18 changes: 18 additions & 0 deletions install-wasi-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Orignal from: https://github.com/Shopify/javy

set -euo pipefail

PATH_TO_SDK="./wasi-sdk"
if [[ ! -d $PATH_TO_SDK ]]; then
TMPGZ=$(mktemp)
VERSION_MAJOR="22"
VERSION_MINOR="0"
if [[ "$(uname -s)" == "Darwin" ]]; then
curl --fail --location --silent https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${VERSION_MAJOR}/wasi-sdk-${VERSION_MAJOR}.${VERSION_MINOR}-macos.tar.gz --output $TMPGZ
else
curl --fail --location --silent https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${VERSION_MAJOR}/wasi-sdk-${VERSION_MAJOR}.${VERSION_MINOR}-linux.tar.gz --output $TMPGZ
fi
mkdir $PATH_TO_SDK
tar xf $TMPGZ -C $PATH_TO_SDK --strip-components=1
fi

0 comments on commit 6180b52

Please sign in to comment.