Skip to content

Document and add specifications for several nifs and bifs #141

Document and add specifications for several nifs and bifs

Document and add specifications for several nifs and bifs #141

Workflow file for this run

#
# Copyright 2023 Paul Guyot <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Wasm Build
on:
push:
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/emscripten/**'
- 'src/libAtomVM/**'
pull_request:
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/emscripten/**'
- 'src/libAtomVM/**'
env:
otp_version: 24
elixir_version: 1.14
jobs:
compile_tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
- name: apt update
run: sudo apt update
- name: Install required packages
run: sudo apt install -y gperf zlib1g-dev ninja-build
- name: Compile AtomVM and test modules
run: |
set -e
mkdir build
cd build
cmake .. -G Ninja
ninja AtomVM atomvmlib test_eavmlib test_alisp hello_world run_script call_cast wasm_webserver
- name: Upload AtomVM and test modules
uses: actions/upload-artifact@v3
with:
name: atomvm-and-test-modules
path: |
build/**/*.avm
build/**/*.beam
build/src/AtomVM
retention-days: 1
- name: Compile emscripten test modules
run: |
set -e
cd src/platforms/emscripten
mkdir -p build/tests/src/
cd build/tests/src
cmake ../../../tests/src -G Ninja
ninja emscripten_erlang_test_modules
- name: Upload emscripten test modules
uses: actions/upload-artifact@v3
with:
name: emscripten-test-modules
path: |
src/platforms/emscripten/build/**/*.beam
retention-days: 1
wasm_build_and_test_node:
needs: compile_tests
runs-on: ubuntu-latest
container: emscripten/emsdk
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: "Install deps"
run: sudo apt update -y && sudo apt install -y cmake gperf
- name: Build
shell: bash
working-directory: ./src/platforms/emscripten/
run: |
set -euo pipefail
mkdir build
cd build
emcmake cmake ..
emmake make -j
- name: Download AtomVM and test modules
uses: actions/download-artifact@v3
with:
name: atomvm-and-test-modules
path: build
- name: Test
shell: bash
working-directory: ./src/platforms/emscripten/build
run: |
set -euxo pipefail
# Test compressed beams
node src/AtomVM.js ../../../../build/examples/erlang/hello_world.beam ../../../../build/libs/eavmlib/src/eavmlib.avm
# Run tests that pass
node src/AtomVM.js ../../../../build/tests/libs/alisp/test_alisp.avm
node src/AtomVM.js ../../../../build/tests/libs/eavmlib/test_eavmlib.avm
wasm_build_web:
runs-on: ubuntu-latest
container: emscripten/emsdk
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: "Install deps"
run: sudo apt update -y && sudo apt install -y cmake gperf
- name: Build wasm build for web
shell: bash
working-directory: ./src/platforms/emscripten/
run: |
set -euo pipefail
mkdir build
cd build
emcmake cmake .. -DAVM_EMSCRIPTEN_ENV=web
emmake make -j
- name: Upload wasm build for web
uses: actions/upload-artifact@v3
with:
name: atomvm-js-web
path: |
src/platforms/emscripten/build/**/*.wasm
src/platforms/emscripten/build/**/*.js
retention-days: 1
wasm_test_web:
needs: [compile_tests, wasm_build_web]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Download AtomVM and test modules
uses: actions/download-artifact@v3
with:
name: atomvm-and-test-modules
path: build
- name: Download wasm build for web
uses: actions/download-artifact@v3
with:
name: atomvm-js-web
path: src/platforms/emscripten/build
- name: Download emscripten test modules
uses: actions/download-artifact@v3
with:
name: emscripten-test-modules
path: src/platforms/emscripten/build
- name: Test using cypress
shell: bash
run: |
set -euxo pipefail
cd build
chmod +x ./src/AtomVM
./src/AtomVM examples/emscripten/wasm_webserver.avm &
cd ../src/platforms/emscripten/tests/
docker run --network host -v $PWD:/mnt -w /mnt cypress/included:12.17.1 --browser chrome
killall AtomVM