From af1000ac8fef40668af31964ededc89f6f7dc55a Mon Sep 17 00:00:00 2001 From: Benjamin Eckel Date: Wed, 13 Sep 2023 14:31:37 -0500 Subject: [PATCH] ci: Add CI workflow --- .github/actions/libextism/action.yaml | 32 +++++++++++++++++++ .github/workflows/ci.yaml | 44 +++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/actions/libextism/action.yaml create mode 100644 .github/workflows/ci.yaml diff --git a/.github/actions/libextism/action.yaml b/.github/actions/libextism/action.yaml new file mode 100644 index 0000000..a94a018 --- /dev/null +++ b/.github/actions/libextism/action.yaml @@ -0,0 +1,32 @@ +on: [workflow_call] + +name: libextism +description: Installs Extism runtime from git + +runs: + using: composite + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install Extism + shell: bash + run: | + pip install poetry + pip install git+https://github.com/extism/cli + extism install git + - name: Upload libextism.so + uses: actions/upload-artifact@v2 + with: + name: libextism-so-artifact + path: /usr/local/lib/libextism.so + - name: Upload libextism.h + uses: actions/upload-artifact@v2 + with: + name: libextism-h-artifact + path: /usr/local/include/extism.h + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..b669453 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,44 @@ +name: Zig CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + zig: + name: Zig CI + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + zig_version: ["master"] # eventually use multiple versions once stable + rust: + - stable + steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Download libextism.so + uses: actions/download-artifact@v2 + with: + name: libextism-so-artifact + - name: Download libextism.h + uses: actions/download-artifact@v2 + with: + name: libextism-h-artifact + - name: Move the files because download can't sudo + run: | + ls -lah ./ + sudo mv libextism.so /usr/local/lib/ + sudo mv extism.h /usr/local/include/ + - name: Setup Zig env + uses: goto-bus-stop/setup-zig@v2 + with: + version: ${{ matrix.zig_version }} + + - name: Test Zig Host SDK + run: | + zig version + cd zig + LD_LIBRARY_PATH=/usr/local/lib zig build test