Skip to content

improve base64 (#101) #106

improve base64 (#101)

improve base64 (#101) #106

Workflow file for this run

name: Build WASI
on:
workflow_dispatch:
workflow_call:
push:
branches:
- 'master'
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
MODE: release
TARGET_OS: wasi
TARGET_ARCH: ${{ matrix.arch }}
JOBS: 4
strategy:
fail-fast: false
matrix:
os: [windows-2019,windows-2022,ubuntu-20.04,ubuntu-22.04,ubuntu-24.04,macos-13,macos-14,macos-15]
arch: [wasm32]
sdk: [24]
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
# Setup ENV
- name: Setup ENV
shell: bash
run: |
echo Running on: $ImageOS
if [ $ImageOS == macos12 ] || [ $ImageOS == macos13 ]; then \
WASI_OS=macos; \
WASI_ARCH=x86_64; \
WASMER_OS=darwin; \
WASMER_ARCH=amd64; \
WABT_OS=macos-12; \
elif [ $ImageOS == macos14 ] || [ $ImageOS == macos15 ]; then \
WASI_OS=macos; \
WASI_ARCH=arm64; \
WASMER_OS=darwin; \
WASMER_ARCH=arm64; \
WABT_OS=macos-14; \
elif [ $ImageOS == ubuntu20 ] || [ $ImageOS == ubuntu22 ] || [ $ImageOS == ubuntu24 ]; then \
WASI_OS=linux; \
WASI_ARCH=x86_64; \
WASMER_OS=linux; \
WASMER_ARCH=amd64; \
WABT_OS=ubuntu-20.04; \
elif [ $ImageOS == win19 ] || [ $ImageOS == win22 ]; then \
WASI_OS=windows; \
WASI_ARCH=x86_64; \
WASMER_OS=windows; \
WASMER_ARCH=amd64; \
WABT_OS=windows; \
else \
echo UNKNOWN OPERATING SYSTEM; \
exit 1; \
fi
echo WASI_OS=$WASI_OS >> "$GITHUB_ENV"
echo WASI_ARCH=$WASI_ARCH >> "$GITHUB_ENV"
echo WASMER_OS=$WASMER_OS >> "$GITHUB_ENV"
echo WASMER_ARCH=$WASMER_ARCH >> "$GITHUB_ENV"
echo WABT_OS=$WABT_OS >> "$GITHUB_ENV"
# Install WASI SDK
- name: Install WASI SDK
shell: bash
env:
REPOSITORY: https://github.com/WebAssembly/wasi-sdk
VERSIONMAJOR: ${{ matrix.sdk }}
VERSIONMINOR: 0
EXT: tar.gz
run: |
FILENAME=wasi-sdk-$VERSIONMAJOR.$VERSIONMINOR-$WASI_ARCH-$WASI_OS
URL=$REPOSITORY/releases/download/wasi-sdk-$VERSIONMAJOR/$FILENAME.$EXT
curl -L -O $URL
tar xfz $FILENAME.$EXT
rm -f $FILENAME.$EXT
echo WASI_SDK_PATH=$(pwd)/$FILENAME >> "$GITHUB_ENV"
# Install Wasmer
- name: Install Wasmer
shell: bash
env:
REPOSITORY: https://github.com/wasmerio/wasmer
VERSIONMAJOR: 4
VERSIONMINOR: 4
VERSIONPATCH: 0
EXT: tar.gz
run: |
FILENAME=wasmer-$WASMER_OS-$WASMER_ARCH
URL=$REPOSITORY/releases/download/v$VERSIONMAJOR.$VERSIONMINOR.$VERSIONPATCH/$FILENAME.$EXT
curl -L -O $URL
mkdir $FILENAME
tar xfz $FILENAME.$EXT -C ./$FILENAME
rm -f $FILENAME.$EXT
echo WASMER_DIR=$(pwd)/$FILENAME >> "$GITHUB_ENV"
# Install WABT
- name: Install WABT
shell: bash
env:
REPOSITORY: https://github.com/WebAssembly/wabt
VERSIONMAJOR: 1
VERSIONMINOR: 0
VERSIONPATCH: 36
EXT: tar.gz
run: |
FILENAME=wabt-$VERSIONMAJOR.$VERSIONMINOR.$VERSIONPATCH-$WABT_OS
URL=$REPOSITORY/releases/download/$VERSIONMAJOR.$VERSIONMINOR.$VERSIONPATCH/$FILENAME.$EXT
curl -L -O $URL
tar xfz $FILENAME.$EXT
rm -f $FILENAME.$EXT
echo WABT_DIR=$(pwd)/wabt-$VERSIONMAJOR.$VERSIONMINOR.$VERSIONPATCH >> "$GITHUB_ENV"
# Clang Version
- name: Clang Version
shell: bash
run: $WASI_SDK_PATH/bin/clang --version
# Wasmer Version
- name: Wasmer Version
shell: bash
run: $WASMER_DIR/bin/wasmer --version
# Build
- name: Build
run: make -j${{ env.JOBS }}
# Binary Info (CppCore.Interface.C)
- name: Binary Info (CppCore.Interface.C)
shell: bash
run: |
echo $WABT_DIR
$WABT_DIR/bin/wasm-objdump -x build/make/lib/wasi-$TARGET_ARCH/libcppcore.wasm
# Binary Info (CppCore.Test)
- name: Binary Info (CppCore.Test)
shell: bash
run: |
$WABT_DIR/bin/wasm-objdump -x build/make/bin/wasi-$TARGET_ARCH/CppCore.Test.wasm
# Binary Info (CppCore.Debug)
- name: Binary Info (CppCore.Debug)
shell: bash
run: |
$WABT_DIR/bin/wasm-objdump -x build/make/bin/wasi-$TARGET_ARCH/CppCore.Debug.wasm
# Test
- name: Test
run: make test
# Dist
- name: Dist
run: make dist
# Upload Binaries
- name: Upload Binaries
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-24.04' }}
with:
name: Binaries (wasi-${{ matrix.arch }})
path: ./build/make/bin/wasi-${{ matrix.arch }}/*.wasm
# Upload Libraries
- name: Upload Libraries
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-24.04' }}
with:
name: Libraries (wasi-${{ matrix.arch }})
path: ./build/make/lib/wasi-${{ matrix.arch }}/*.wasm
# Install uglify-js
- name: Install uglify-js
run: npm install uglify-js -g
# Build JS
- name: Build JS
run: make CppCore.Interface.JS
# Upload JS
- name: Upload JS
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-24.04' }}
with:
name: Browser (wasi-${{ matrix.arch }})
path: ./dist/browser/CppCore.Interface.JS/*