Add browser runtime, Emscripten build, and persistent submodule updates #8
Workflow file for this run
This file contains hidden or 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 browser runtime | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - "os/main.c" | |
| - "os/wasm-rtos" | |
| - ".gitmodules" | |
| - "build-browser.sh" | |
| - ".github/workflows/build-browser.yml" | |
| pull_request: | |
| paths: | |
| - "os/main.c" | |
| - "os/wasm-rtos" | |
| - ".gitmodules" | |
| - "build-browser.sh" | |
| - ".github/workflows/build-browser.yml" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Update wasm-rtos and nested wasm3 submodules | |
| run: | | |
| git submodule sync --recursive | |
| git submodule update --init --remote --recursive | |
| git submodule status --recursive | |
| test -f os/wasm-rtos/os.c | |
| test -f os/wasm-rtos/wasm3/source/wasm3.h | |
| echo "wasm-rtos commit: $(git -C os/wasm-rtos rev-parse HEAD)" | |
| echo "wasm3 commit: $(git -C os/wasm-rtos/wasm3 rev-parse HEAD)" | |
| - name: Install latest Emscripten SDK | |
| run: | | |
| git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$RUNNER_TEMP/emsdk" >/dev/null | |
| "$RUNNER_TEMP/emsdk/emsdk" install latest >"$RUNNER_TEMP/emsdk-install.log" | |
| "$RUNNER_TEMP/emsdk/emsdk" activate latest >>"$RUNNER_TEMP/emsdk-install.log" | |
| source "$RUNNER_TEMP/emsdk/emsdk_env.sh" >/dev/null | |
| emcc --version | |
| - name: Build JavaScript and WebAssembly runtime | |
| run: | | |
| source "$RUNNER_TEMP/emsdk/emsdk_env.sh" >/dev/null | |
| if ! bash ./build-browser.sh >build-browser.log 2>&1; then | |
| echo "Browser runtime compilation failed:" | |
| tail -n 100 build-browser.log | |
| exit 1 | |
| fi | |
| tail -n 100 build-browser.log | |
| - name: Upload browser build log | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: browser-build-log | |
| path: build-browser.log | |
| if-no-files-found: warn | |
| - name: Verify browser runtime outputs | |
| run: | | |
| test -s os/wasm-rtos.js | |
| test -s os/wasm-rtos.wasm | |
| test "$(od -An -tx1 -N4 os/wasm-rtos.wasm | tr -d ' \n')" = "0061736d" | |
| grep -q "createWasmRtosModule" os/wasm-rtos.js | |
| ls -lh os/wasm-rtos.js os/wasm-rtos.wasm | |
| - name: Upload browser runtime | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm-rtos-browser | |
| path: | | |
| os/wasm-rtos.js | |
| os/wasm-rtos.wasm | |
| if-no-files-found: error |