Skip to content

Merge pull request #1104 from bettio/add-v0.6-to-security #7

Merge pull request #1104 from bettio/add-v0.6-to-security

Merge pull request #1104 from bettio/add-v0.6-to-security #7

#
# Copyright 2022 Davide Bettio <davide@uninstall.it>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build Linux Artifacts
on:
push:
tags:
- '**'
permissions:
contents: write
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
- name: Compile test modules
run: |
set -e
mkdir build_tests
cd build_tests
cmake ..
make erlang_test_modules
make test_estdlib
make test_eavmlib
make test_alisp
- name: Upload test modules
uses: actions/upload-artifact@v3
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-22.04
strategy:
fail-fast: false
matrix:
include:
- arch: "arm32v5"
build_name: "linux-arm32v5"
docker_image: "arm32v5/debian"
platform: "arm/v5"
cflags: "-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 tzdata
- arch: "arm32v7"
build_name: "linux-arm32v7thl"
docker_image: "arm32v7/debian"
platform: "arm/v7"
tag: "stretch"
cflags: "-mfloat-abi=hard -mthumb -mthumb-interwork"
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 tzdata
- arch: "arm64v8"
build_name: "linux-arm64v8"
docker_image: "arm64v8/ubuntu"
platform: "arm64/v8"
tag: "22.04"
cflags: ""
- arch: "riscv64"
build_name: "linux-riscv64"
docker_image: "riscv64/ubuntu"
platform: "riscv64"
tag: "22.04"
cflags: ""
- arch: "x86_64"
build_name: "linux-x86_64-static-mbedtls"
docker_image: "ubuntu"
platform: "amd64"
tag: "18.04"
cflags: ""
cmake_opts: "-DAVM_STATIC_MBEDTLS=ON"
install_deps: |
apt update &&
apt install -y file gcc g++ binutils make doxygen gperf zlib1g-dev libmbedtls-dev wget tzdata &&
apt purge -y cmake &&
wget https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz &&
tar xf cmake-3.13.5-Linux-x86_64.tar.gz &&
mv cmake-3.13.5-Linux-x86_64 /opt/cmake-3.13.5 &&
ln -sf /opt/cmake-3.13.5/bin/* /usr/bin/
- arch: "x86_64"
build_name: "linux-x86_64"
docker_image: "ubuntu"
platform: "amd64"
tag: "18.04"
cflags: ""
install_deps: |
apt update &&
apt install -y file gcc g++ binutils make doxygen gperf zlib1g-dev libmbedtls-dev wget tzdata &&
apt purge -y cmake &&
wget https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz &&
tar xf cmake-3.13.5-Linux-x86_64.tar.gz &&
mv cmake-3.13.5-Linux-x86_64 /opt/cmake-3.13.5 &&
ln -sf /opt/cmake-3.13.5/bin/* /usr/bin/
- arch: "i386"
build_name: "linux-i386"
docker_image: "i386/debian"
platform: "386"
cflags: ""
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
steps:
- name: Checkout repo
uses: actions/checkout@v3
- 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@v3
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 AtomVM using docker
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.docker_image }}:${{ 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 tzdata
fi &&
file /bin/bash &&
uname -a &&
cc --version &&
ld --version &&
ldd --version &&
echo $CFLAGS &&
echo $CXXFLAGS &&
cmake --version &&
mkdir -p build &&
cd build &&
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo ${{ 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/ &&
VERBOSE=1 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 &&
cp ./src/AtomVM ./AtomVM-${{ matrix.build_name }}-${{ github.ref_name }} &&
sha256sum ./src/AtomVM > ./AtomVM-${{ matrix.build_name }}-${{ github.ref_name }}.sha256
'
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
files: |
build/AtomVM*