Skip to content

Add support for erlang:size/1 bif #3348

Add support for erlang:size/1 bif

Add support for erlang:size/1 bif #3348

Workflow file for this run

#
# Copyright 2017-2022 Davide Bettio <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build and Test
on:
push:
paths-ignore:
- 'src/platforms/emscripten/**'
- 'src/platforms/esp32/**'
- 'src/platforms/rp2040/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
- '*.Md'
- '*.md'
pull_request:
paths-ignore:
- 'src/platforms/emscripten/**'
- 'src/platforms/esp32/**'
- 'src/platforms/rp2040/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
- '*.Md'
- '*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Ubuntu 20.04 has gcc from 7 to 10 ("gcc" is gcc-9)
# Ubuntu 22.04 has gcc from 9 to 12 ("gcc" is gcc-11)
# Ubuntu 24.04 has gcc from 9 to 14 ("gcc" is gcc-13)
# Ubuntu 20.04 has clang 10 and 12 to ("clang" is 10)
# Ubuntu 22.04 has clang from 12 to 15 ("clang" is 14)
# Ubuntu 24.04 has clang from 14 to 18 ("clang" is 18)
# We want to test every compiler but don't need to test every OS
# We only test several OTP versions with default compilers (gcc-9, 11, 13, clang-10, 14, 18)
cc: ["gcc-9", "gcc-11", "gcc-13", "clang-10", "clang-14", "clang-18"]
cflags: ["-O3"]
otp: ["25", "26", "27"]
include:
- cc: "gcc-7"
cxx: "g++-7"
compiler_pkgs: "gcc-7 g++-7"
os: "ubuntu-20.04"
otp: "27"
- cc: "gcc-8"
cxx: "g++-8"
compiler_pkgs: "gcc-8 g++-8"
os: "ubuntu-20.04"
otp: "27"
- cc: "gcc-9"
cxx: "g++-9"
compiler_pkgs: "gcc-9 g++-9"
os: "ubuntu-20.04"
# otp: all
- cc: "gcc-10"
cxx: "g++-10"
compiler_pkgs: "gcc-10 g++-10"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
otp: "27"
- cc: "gcc-11"
cxx: "g++-11"
compiler_pkgs: "gcc-11 g++-11"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
# otp: all
- cc: "gcc-12"
cxx: "g++-12"
compiler_pkgs: "gcc-12 g++-12"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "gcc-13"
cxx: "g++-13"
compiler_pkgs: "gcc-13 g++-13"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
# otp: all
- cc: "gcc-14"
cxx: "g++-14"
compiler_pkgs: "gcc-14 g++-14"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-10"
cxx: "clang++-10"
compiler_pkgs: "clang-10"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-20.04"
# otp: all
- cc: "clang-11"
cxx: "clang++-11"
compiler_pkgs: "clang-11"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-20.04"
otp: "27"
- cc: "clang-12"
cxx: "clang++-12"
compiler_pkgs: "clang-12"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
otp: "27"
- cc: "clang-13"
cxx: "clang++-13"
compiler_pkgs: "clang-13"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
otp: "27"
- cc: "clang-14"
cxx: "clang++-14"
compiler_pkgs: "clang-14"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
# otp: all
- cc: "clang-15"
cxx: "clang++-15"
compiler_pkgs: "clang-15"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-16"
cxx: "clang++-16"
compiler_pkgs: "clang-16"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-17"
cxx: "clang++-17"
compiler_pkgs: "clang-17"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-18"
cxx: "clang++-18"
compiler_pkgs: "clang-18"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
# otp: all
- otp: "25"
elixir_version: "1.14"
- otp: "26"
elixir_version: "1.17"
- otp: "27"
elixir_version: "1.17"
# Old versions of OTP/Elixir
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "21"
cflags: ""
elixir_version: "1.7"
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "22"
cflags: ""
elixir_version: "1.8"
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "23"
cflags: ""
elixir_version: "1.11"
- os: "ubuntu-22.04"
cc: "cc"
cxx: "c++"
otp: "24"
cflags: ""
elixir_version: "1.14"
# master/main version of OTP/Elixir
- os: "ubuntu-24.04"
cc: "cc"
cxx: "c++"
otp: "master"
elixir_version: "main"
# Additional default compiler builds
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "27"
cflags: ""
elixir_version: "1.17"
- os: "ubuntu-22.04"
cc: "cc"
cxx: "c++"
otp: "27"
cflags: ""
elixir_version: "1.17"
# Additional latest & -Os compiler builds
- os: "ubuntu-24.04"
cc: "gcc-14"
cxx: "g++-14"
otp: "27"
cflags: "-Os"
elixir_version: "1.17"
compiler_pkgs: "gcc-14 g++-14"
- os: "ubuntu-24.04"
cc: "clang-18"
cxx: "clang++-18"
otp: "27"
cflags: "-Os"
elixir_version: "1.17"
compiler_pkgs: "clang-18"
# Additional 32 bits build
- os: "ubuntu-20.04"
cc: "gcc-10"
cxx: "g++-10"
cflags: "-m32 -O3"
otp: "23"
elixir_version: "1.11"
# Use Werror so we get an error with 32 bit specific warnings
cmake_opts_other: "-DAVM_CREATE_STACKTRACES=off -DAVM_WARNINGS_ARE_ERRORS=ON"
arch: "i386"
compiler_pkgs: "gcc-10 g++-10 gcc-10-multilib g++-10-multilib libc6-dev-i386
libc6-dbg:i386 zlib1g-dev:i386 libmbedtls-dev:i386"
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
steps:
# Setup
- name: "Checkout repo"
uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: "Add i386 architecture"
if: matrix.arch == 'i386'
run: sudo dpkg --add-architecture i386
- name: "APT update"
run: sudo apt update -y
- name: "Install deps"
run: sudo apt install -y ${{ matrix.compiler_pkgs}} cmake gperf zlib1g-dev doxygen valgrind libmbedtls-dev
# Builder info
- name: "System info"
run: |
echo "**uname:**"
uname -a
echo "**libc version:**"
ldd --version
echo "**C Compiler version:**"
$CC --version
$CXX --version
echo "**Linker version:**"
ld --version
echo "**CMake version:**"
cmake --version
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true
# Build
- name: "Build: create build dir"
run: mkdir build
- uses: actions/cache@v4
id: cache
with:
path: 'build/tests/**/*.beam'
key: ${{ matrix.otp }}-${{ hashFiles('**/build-and-test.yaml', 'tests/**/*.erl') }}
- name: "Build: run cmake"
working-directory: build
run: |
cmake ${{ matrix.cmake_opts_fp }} ${{ matrix.cmake_opts_smp }} ${{ matrix.cmake_opts_other }} ..
# git clone will use more recent timestamps than cached beam files
# touch them so we can benefit from the cache and avoid costly beam file rebuild.
find . -name '*.beam' -exec touch {} \;
- name: "Build: run make"
working-directory: build
run: make
- name: "Build: run dialyzer"
working-directory: build
run: make dialyzer
# Test
- name: "Test: test-erlang"
timeout-minutes: 15
working-directory: build
run: |
./tests/test-erlang -s prime_smp
valgrind ./tests/test-erlang -s prime_smp
- name: "Test: test-enif"
working-directory: build
run: |
./tests/test-enif
valgrind ./tests/test-enif
- name: "Test: test-mailbox"
working-directory: build
run: |
./tests/test-mailbox
valgrind ./tests/test-mailbox
- name: "Test: test-structs"
timeout-minutes: 10
working-directory: build
run: |
./tests/test-structs
valgrind ./tests/test-structs
- name: "Test: test_estdlib.avm"
timeout-minutes: 5
working-directory: build
run: |
./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
valgrind ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
- name: "Test: test_eavmlib.avm"
timeout-minutes: 10
working-directory: build
run: |
./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
valgrind ./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
- name: "Test: test_alisp.avm"
timeout-minutes: 10
working-directory: build
run: |
./src/AtomVM ./tests/libs/alisp/test_alisp.avm
valgrind ./src/AtomVM ./tests/libs/alisp/test_alisp.avm
- name: "Install and smoke test"
working-directory: build
run: |
sudo PATH=${PATH} make install
atomvm examples/erlang/hello_world.avm
atomvm -v
atomvm -h