Skip to content

Merge pull request #1370 from pguyot/w47/http-server-fixes #3750

Merge pull request #1370 from pguyot/w47/http-server-fixes

Merge pull request #1370 from pguyot/w47/http-server-fixes #3750

#
# Copyright 2022 Davide Bettio <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build and Test on Other Architectures
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:
compile_tests:
runs-on: ubuntu-24.04
container: erlang:27
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: Compile test modules
run: |
set -e
mkdir build_tests
cd build_tests
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
ninja erlang_test_modules test_estdlib test_eavmlib test_alisp
- name: Upload test modules
uses: actions/upload-artifact@v4
with:
name: test-modules
path: |
build_tests/**/*.avm
build_tests/**/*.beam
build_tests/**/*.hrl
retention-days: 1
build-and-test-other:
needs: compile_tests
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
arch: ["arm32v5", "arm32v7", "arm64v8"]
include:
- arch: "arm32v5"
platform: "arm/v5"
cflags: "-O2 -mthumb -mthumb-interwork -march=armv4t"
cmake_opts: "-DAVM_DISABLE_SMP=On -DAVM_DISABLE_TASK_DRIVER=On"
tag: "stretch"
sources: |
deb [trusted=yes] http://archive.debian.org/debian/ stretch-backports main
deb [trusted=yes] http://archive.debian.org/debian/ stretch-backports-sloppy main
deb [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main
deb-src [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main
deb [trusted=yes] http://archive.debian.org/debian/ stretch main
deb-src [trusted=yes] http://archive.debian.org/debian/ stretch main
# Workaround from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954852
install_deps: |
apt update &&
apt install -y -t stretch-backports-sloppy libarchive13 &&
apt install -y -t stretch-backports cmake &&
apt install -y file gcc g++ binutils make doxygen gperf zlib1g-dev libmbedtls-dev
- arch: "arm32v7"
platform: "arm/v7"
tag: "bullseye"
# -D_FILE_OFFSET_BITS=64 is required for making atomvm:posix_readdir/1 test work
# otherwise readdir will fail due to 64 bits inode numbers with 32 bit ino_t
cflags: "-mcpu=cortex-a7 -mfloat-abi=hard -O2 -mthumb -mthumb-interwork -D_FILE_OFFSET_BITS=64"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
- arch: "arm64v8"
platform: "arm64/v8"
tag: "bullseye"
cflags: "-O2"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
# Required for testing big endian archs
- arch: "s390x"
platform: "s390x"
tag: "bullseye"
cflags: "-O2"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: apt update
run: sudo apt update
- name: Install required packages
run: sudo apt install -y debootstrap
- name: Download test modules
uses: actions/download-artifact@v4
with:
name: test-modules
path: build_tests
- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: "Build and Test: AtomVM on foreign arch"
timeout-minutes: 15
run: |
docker run --platform linux/${{ matrix.platform }} --rm -v $PWD:/atomvm -w /atomvm \
-e CFLAGS="${{ matrix.cflags }}" -e CXXFLAGS="${{ matrix.cflags }}" \
${{ matrix.arch }}/debian:${{ matrix.tag }} /bin/bash -c '
([ -n "${{ matrix.sources }}" ] && echo "${{ matrix.sources }}" > /etc/apt/sources.list || true) &&
cat /etc/apt/sources.list &&
if test -n "${{ matrix.install_deps }}"; then
echo
${{ matrix.install_deps }}
else
apt update &&
apt install -y file gcc g++ binutils cmake make doxygen gperf zlib1g-dev libmbedtls-dev
fi &&
file /bin/bash &&
uname -a &&
cc --version &&
ld --version &&
ldd --version &&
echo $CFLAGS &&
echo $CXXFLAGS &&
cmake --version &&
mkdir -p build &&
cd build &&
cmake .. ${{ matrix.cmake_opts }} &&
cp ../build_tests/tests/erlang_tests/*.beam tests/erlang_tests/ &&
cp ../build_tests/tests/erlang_tests/code_load/*.{avm,beam,hrl} tests/erlang_tests/code_load/ &&
mkdir -p tests/erlang_tests/code_load/beams/ &&
cp ../build_tests/tests/erlang_tests/code_load/beams/*.beam tests/erlang_tests/code_load/beams/ &&
cp ../build_tests/tests/libs/estdlib/*.avm tests/libs/estdlib/ &&
cp ../build_tests/tests/libs/eavmlib/*.avm tests/libs/eavmlib/ &&
cp ../build_tests/tests/libs/alisp/*.avm tests/libs/alisp/ &&
make AtomVM &&
make test-erlang &&
make test-enif &&
make test-mailbox &&
make test-structs &&
file ./tests/test-erlang &&
./tests/test-erlang -s prime_smp &&
file ./tests/test-enif &&
./tests/test-enif &&
file ./tests/test-mailbox &&
./tests/test-mailbox &&
file ./tests/test-structs &&
./tests/test-structs &&
file ./src/AtomVM &&
./src/AtomVM tests/libs/estdlib/test_estdlib.avm &&
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm &&
./src/AtomVM tests/libs/alisp/test_alisp.avm
'