Skip to content

Process aliases

Process aliases #3671

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/wasm-build.yaml'
- 'CMakeLists.txt'
- 'CMakeModules/**'
- 'libs/**'
- 'src/platforms/emscripten/**'
- 'src/libAtomVM/**'
pull_request:
paths:
- '.github/workflows/wasm-build.yaml'
- 'CMakeLists.txt'
- 'CMakeModules/**'
- 'libs/**'
- 'src/platforms/emscripten/**'
- 'src/libAtomVM/**'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
compile_tests:
runs-on: ubuntu-24.04
container: erlang:27
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["c-cpp"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install required packages
run: apt update && apt install -y gperf zlib1g-dev cmake ninja-build
- name: "Git config safe.directory for codeql"
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
build-mode: manual
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql
- name: Compile AtomVM and test modules
run: |
set -e
mkdir build
cd build
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
# test_eavmlib does not work with wasm due to http + ssl test
ninja AtomVM atomvmlib erlang_test_modules test_etest test_alisp test_estdlib hello_world run_script call_cast html5_events wasm_webserver
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3
- name: Upload AtomVM and test modules
uses: actions/upload-artifact@v4
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@v4
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-24.04
container: emscripten/emsdk
steps:
- name: Checkout repo
uses: actions/checkout@v4
- 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@v4
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/estdlib/test_estdlib.avm
# test_eavmlib does not work with wasm due to http + ssl test
# node src/AtomVM.js ../../../../build/tests/libs/eavmlib/test_eavmlib.avm
node src/AtomVM.js ../../../../build/tests/libs/etest/test_etest.avm
node src/AtomVM.js ../../../../build/tests/erlang_tests/test_crypto.beam
- name: "Rename and write sha256sum (node)"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: src/platforms/emscripten/build/src
run: |
ATOMVM_JS=AtomVM-node-${{ github.ref_name }}.js
mv AtomVM.js "${ATOMVM_JS}"
sha256sum "${ATOMVM_JS}" > "${ATOMVM_JS}.sha256"
ATOMVM_WASM=AtomVM-node-${{ github.ref_name }}.wasm
mv AtomVM.wasm "${ATOMVM_WASM}"
sha256sum "${ATOMVM_WASM}" > "${ATOMVM_WASM}.sha256"
- name: "Release (node)"
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
files: |
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.js
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.js.sha256
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.wasm
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.wasm.sha256
wasm_build_web:
runs-on: ubuntu-24.04
container: emscripten/emsdk
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript-typescript"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: "Install deps"
run: sudo apt update -y && sudo apt install -y cmake gperf
- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
build-mode: none
db-location: '${{ github.runner_temp }}/codeql_js_database'
- 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: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3
- name: Upload wasm build for web
uses: actions/upload-artifact@v4
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-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download AtomVM and test modules
uses: actions/download-artifact@v4
with:
name: atomvm-and-test-modules
path: build
- name: Download wasm build for web
uses: actions/download-artifact@v4
with:
name: atomvm-js-web
path: src/platforms/emscripten/build
- name: Download emscripten test modules
uses: actions/download-artifact@v4
with:
name: emscripten-test-modules
path: src/platforms/emscripten/build
- name: Start Docker echo server for CI
run: |
docker run -d --name echo-server -p 9090:8080 jmalloc/echo-server
sleep 5
- 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 -e CYPRESS_CI=true cypress/included:12.17.1 --browser chrome
killall AtomVM
- name: "Publish screenshots of failures"
if: failure()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: |
src/platforms/emscripten/tests/cypress/screenshots/**/*.png
retention-days: 7
- name: "Rename and write sha256sum (web)"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: src/platforms/emscripten/build/src
run: |
ATOMVM_JS=AtomVM-web-${{ github.ref_name }}.js
mv AtomVM.js "${ATOMVM_JS}"
sha256sum "${ATOMVM_JS}" > "${ATOMVM_JS}.sha256"
ATOMVM_WASM=AtomVM-web-${{ github.ref_name }}.wasm
mv AtomVM.wasm "${ATOMVM_WASM}"
sha256sum "${ATOMVM_WASM}" > "${ATOMVM_WASM}.sha256"
- name: "Release (web)"
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
files: |
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.js
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.js.sha256
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.wasm
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.wasm.sha256