Yield fix for trealla-js #1212
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
release: | |
types: [created] | |
jobs: | |
build: | |
name: Native | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install deps (Linux) | |
run: | | |
sudo apt-get update | |
sudo apt-get install libreadline-dev xxd libffi-dev libssl-dev | |
if: matrix.os == 'ubuntu-latest' | |
- name: Install deps (macOS) | |
run: | | |
brew update | |
brew install readline vim libffi openssl make | |
echo "$(brew --prefix)/opt/make/libexec/gnubin" >> $GITHUB_PATH | |
if: matrix.os == 'macos-latest' | |
- name: Fetch tags | |
run: git fetch --tags --force origin | |
- name: Build | |
run: make release | |
- name: Test | |
run: make test | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ format('tpl-{0}-{1}', runner.os, runner.arch) }} | |
path: | | |
tpl | |
LICENSE | |
ATTRIBUTION | |
README.md | |
windows: | |
name: Windows | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
- name: Install deps | |
run: | | |
pacman --noconfirm -S make mingw-w64-x86_64-gcc mingw-w64-x86_64-headers-git mingw-w64-x86_64-libffi mingw-w64-x86_64-dlfcn | |
pacman --noconfirm -S mingw-w64-x86_64-openssl mingw-w64-x86_64-libwinpthread vim diffutils git | |
- name: Configure line endings | |
run: git config --global core.autocrlf input | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch tags | |
run: git fetch --tags --force origin | |
- name: Build | |
run: make WIN=1 release | |
- name: Test | |
run: make test | |
- name: Make Windows-friendly | |
run: | | |
cp ${MINGW_PREFIX}/bin/{libcrypto-3-x64.dll,libssl-3-x64.dll,libffi-8.dll,libdl.dll,libwinpthread-1.dll} . | |
echo -e "\n\nOpenSSL (libcrypto-3-x64.dll, libssl-3-x64.dll):\n" >> ATTRIBUTION | |
cat ${MINGW_PREFIX}/share/licenses/openssl/LICENSE >> ATTRIBUTION | |
echo -e "\n\nlibffi: (libffi-8.dll)\n" >> ATTRIBUTION | |
cat ${MINGW_PREFIX}/share/licenses/libffi/LICENSE >> ATTRIBUTION | |
echo -e "\n\ndlfcn: (libdl.dll)\n" >> ATTRIBUTION | |
cat ${MINGW_PREFIX}/share/licenses/dlfcn/LICENSE >> ATTRIBUTION | |
echo -e "\n\nlibwinpthread:\n" >> ATTRIBUTION | |
cat ${MINGW_PREFIX}/share/licenses/libwinpthread/COPYING >> ATTRIBUTION | |
echo -e "\n\nisocline:\n" >> ATTRIBUTION | |
cat src/isocline/LICENSE >> ATTRIBUTION | |
if [ ! -f "tpl.exe" ]; then | |
mv tpl tpl.exe | |
fi | |
mv ATTRIBUTION ATTRIBUTION.txt | |
mv LICENSE LICENSE.txt | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ format('tpl-{0}-{1}', runner.os, runner.arch) }} | |
path: | | |
tpl.exe | |
LICENSE.txt | |
ATTRIBUTION.txt | |
README.md | |
libcrypto-3-x64.dll | |
libssl-3-x64.dll | |
libffi-8.dll | |
libdl.dll | |
libwinpthread-1.dll | |
# Roughly matches https://github.com/WebAssembly/wasi-sdk#install | |
wasm: | |
name: WebAssembly | |
runs-on: ubuntu-latest | |
env: | |
WASI_VERSION: 24 | |
WAPM_REGISTRY_TOKEN: ${{ secrets.WAPM_REGISTRY_TOKEN }} | |
WIZER_VERSION: "v7.0.4" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch tags | |
run: git fetch --tags --force origin | |
- name: Set environment (1/3) | |
run: | | |
echo "WASI_VERSION_FULL=${WASI_VERSION}.0-x86_64-linux" >> $GITHUB_ENV | |
echo "WIZER_VERSION_FULL=${WIZER_VERSION}-x86_64-linux" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=`git tag --points-at HEAD | head -n 1 | sed 's/^v//'`" >> $GITHUB_ENV | |
- name: Set environment (2/3) | |
run: | | |
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_VERSION_FULL}" >> $GITHUB_ENV | |
echo "WIZER=`pwd`/wizer-${WIZER_VERSION_FULL}/wizer" >> $GITHUB_ENV | |
- name: Set environment (3/3) | |
run: | | |
echo "WASI_CC=${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot" >> $GITHUB_ENV | |
- name: Add Homebrew to $PATH | |
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH | |
- name: Install WASI SDK | |
run: | | |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}.tar.gz | |
tar xvf wasi-sdk-${WASI_VERSION_FULL}.tar.gz | |
- name: Install Binaryen | |
run: | | |
brew install binaryen | |
- name: Setup wasmtime | |
uses: mwilliamson/setup-wasmtime-action@v2 | |
with: | |
wasmtime-version: "12.0.1" | |
- name: Install Wizer | |
run: | | |
wget https://github.com/bytecodealliance/wizer/releases/download/${WIZER_VERSION}/wizer-${WIZER_VERSION_FULL}.tar.xz | |
tar xvf wizer-${WIZER_VERSION_FULL}.tar.xz | |
- name: Build | |
run: | | |
rm -rf ./build | |
mkdir -p ./build | |
make clean && make -j2 wasm | |
mv tpl.wasm ./build | |
make clean && make -j2 libtpl | |
mv libtpl.wasm ./build | |
make clean && make -j2 libtpl-js | |
mv libtpl-js.wasm ./build | |
make clean && make -j2 libtpl-spin | |
mv ./build/*.wasm . | |
- name: Test | |
run: | | |
echo 'wasmtime run --max-wasm-stack 8388608 --dir . tpl.wasm -- $@' > tpl | |
chmod +x tpl | |
make test | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tpl-wasm-wasi | |
path: | | |
tpl.wasm | |
LICENSE | |
ATTRIBUTION | |
README.md | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libtpl-wasm | |
path: | | |
libtpl.wasm | |
LICENSE | |
ATTRIBUTION | |
README.md | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libtpl-wasm-js | |
path: | | |
libtpl-js.wasm | |
LICENSE | |
ATTRIBUTION | |
README.md | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libtpl-wasm-spin | |
path: | | |
libtpl-spin.wasm | |
LICENSE | |
ATTRIBUTION | |
README.md | |
# TODO: temporarily disabled, see: https://github.com/guregu/trealla/issues/11 | |
# - name: Publish on WAPM | |
# run: | | |
# sed -i "s/__RELEASE_VERSION__/$RELEASE_VERSION/" wapm.toml | |
# wapm login $WAPM_REGISTRY_TOKEN | |
# wapm publish || echo "Warning: WAPM publish failed" | |
# if: ${{ env.WAPM_REGISTRY_TOKEN != '' && env.RELEASE_VERSION != '' }} | |
release: | |
if: github.event_name == 'release' && github.event.action == 'created' | |
needs: [build, windows, wasm] | |
name: Release binaries | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: List files | |
run: ls -R | |
- name: Zip releases | |
run: | | |
cd artifacts | |
chmod +x */tpl* */*.wasm | |
for i in tpl-*/; do | |
dir=${i%/} | |
lower=${dir,,} | |
if [ "$dir" != "$lower" ] | |
then | |
mv "$dir" "$lower" | |
fi | |
zip -r "${lower}.zip" "$lower" | |
done | |
- name: Publish zips | |
uses: skx/github-action-publish-binaries@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: 'artifacts/*.zip' | |
- name: Publish wasms | |
uses: skx/github-action-publish-binaries@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: 'artifacts/*/*.wasm' | |