* Move all examples to a top-level directory This commit moves all API examples (Rust and C) to a top-level `examples` directory. This is intended to make it more discoverable and conventional as to where examples are located. Additionally all examples are now available in both Rust and C to see how to execute the example in the language you're familiar with. The intention is that as more languages are supported we'd add more languages as examples here too. Each example is also accompanied by either a `*.wat` file which is parsed as input, or a Rust project in a `wasm` folder which is compiled as input. A simple driver crate was also added to `crates/misc` which executes all the examples on CI, ensuring the C and Rust examples all execute successfully.
57 lines
1.5 KiB
Bash
Executable File
57 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# A small shell script invoked from CI on the final Linux builder which actually
|
|
# assembles the release artifacts for a particular platform. This will take the
|
|
# binary artifacts of previous builders and create associated tarballs to
|
|
# publish to GitHub.
|
|
#
|
|
# The first argument of this is the "platform" name to put into the tarball, and
|
|
# the second argument is the name of the github actions platform which is where
|
|
# we source binaries from. The final third argument is ".exe" on Windows to
|
|
# handle executable extensions right.
|
|
|
|
set -ex
|
|
|
|
platform=$1
|
|
src=$2
|
|
exe=$3
|
|
|
|
rm -rf tmp
|
|
mkdir tmp
|
|
mkdir -p dist
|
|
|
|
mktarball() {
|
|
dir=$1
|
|
if [ "$exe" = "" ]; then
|
|
tar cJf dist/$dir.tar.xz -C tmp $dir
|
|
else
|
|
(cd tmp && zip -r ../dist/$dir.zip $dir)
|
|
fi
|
|
}
|
|
|
|
# Create the main tarball of binaries
|
|
bin_pkgname=wasmtime-$TAG-$platform
|
|
mkdir tmp/$bin_pkgname
|
|
cp LICENSE README.md tmp/$bin_pkgname
|
|
mv bins-$src/{wasmtime,wasm2obj}$exe tmp/$bin_pkgname
|
|
chmod +x tmp/$bin_pkgname/{wasmtime,wasm2obj}$exe
|
|
mktarball $bin_pkgname
|
|
|
|
if [ "$exe" = ".exe" ]; then
|
|
mv bins-$src/installer.msi dist/$bin_pkgname.msi
|
|
fi
|
|
|
|
# Create tarball of API libraries
|
|
api_pkgname=wasmtime-$TAG-$platform-c-api
|
|
mkdir tmp/$api_pkgname
|
|
mkdir tmp/$api_pkgname/lib
|
|
mkdir tmp/$api_pkgname/include
|
|
cp LICENSE README.md tmp/$api_pkgname
|
|
mv bins-$src/* tmp/$api_pkgname/lib
|
|
cp crates/c-api/wasm-c-api/include/wasm.h tmp/$api_pkgname/include
|
|
cp crates/c-api/include/{wasmtime,wasi}.h tmp/$api_pkgname/include
|
|
mktarball $api_pkgname
|
|
|
|
# Move wheels to dist folder
|
|
mv wheels-$src/* dist
|