Files
wazero/.github/workflows/examples.yaml
Crypt Keeper 1e0f88bc14 deps: upgrades to TinyGo v0.28.1 (#1512)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-06-12 14:21:00 +10:00

112 lines
3.3 KiB
YAML

name: Examples
on:
pull_request:
branches: [main]
paths:
- '.github/workflows/examples.yaml'
- 'examples/**'
- 'imports/**/example/**'
- 'Makefile'
push:
branches: [main]
paths:
- '.github/workflows/examples.yaml'
- 'examples/**'
- 'imports/**/example/**'
- 'Makefile'
env:
EMSDK_VERSION: "3.1.40"
TINYGO_VERSION: "0.28.1"
ZIG_VERSION: "0.11.0-dev.3334+cd1417dbd"
concurrency:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }}
cancel-in-progress: true
jobs:
# Not all toolchains are idempotent when generating wasm, so we don't check
# in %.wasm as a part of this job.
examples:
name: Build examples
runs-on: ubuntu-22.04
strategy:
matrix: # Use versions consistent with TinyGo.
go-version:
- "1.20" # Current Go version
- "1.18" # Floor Go version of latest TinyGo
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Install TinyGo
run: | # installing via curl so commands are similar on OS/x
tinygo_version=${{ env.TINYGO_VERSION }}
curl -sSL https://github.com/tinygo-org/tinygo/releases/download/v${tinygo_version}/tinygo${tinygo_version}.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
echo "TINYGOROOT=/usr/local/tinygo" >> $GITHUB_ENV
echo "/usr/local/tinygo/bin" >> $GITHUB_PATH
- name: Install Zig
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Cache Emscripten
id: cache-emsdk
uses: actions/cache@v3
with:
path: emsdk
key: ${{ runner.os }}-emcc-${{env.EMSDK_VERSION}}
- name: Checkout Emscripten
if: steps.cache-emsdk.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: emscripten-core/emsdk
path: emsdk
- name: Install Emscripten
if: steps.cache-emsdk.outputs.cache-hit != 'true'
run: |
./emsdk/emsdk install ${{env.EMSDK_VERSION}}
- name: Install wasm32-wasi target
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-wasi
- name: Build TinyGo examples
run: make build.examples.tinygo
- name: Build AssemblyScript examples
run: make build.examples.as
- name: Build zig-cc examples
run: make build.examples.zig-cc
- name: Build Rust examples
run: make build.examples.rust
- name: Build Zig examples
run: make build.examples.zig
- name: Build Emscripten examples
run: |
./emsdk/emsdk activate ${{env.EMSDK_VERSION}}
source ./emsdk/emsdk_env.sh
make build.examples.emscripten
- name: Build bench cases
run: make build.bench
- name: Run example tests
run: make test.examples