Skip to content

Commit

Permalink
Use rebar3 for compilation and AVM packbeam generation.
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Dushin <fred@dushin.net>
  • Loading branch information
fadushin committed Dec 16, 2023
1 parent 2cc65f7 commit 78c57cf
Show file tree
Hide file tree
Showing 555 changed files with 1,153 additions and 1,380 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build-and-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,34 @@ jobs:
echo "**CMake version:**"
cmake --version
- name: "Build rebar3"
run: |
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
# Build
- name: "Build: create build dir"
run: mkdir build

- name: "Build: run cmake"
working-directory: build
run: |
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
export PATH="/tmp/rebar3:/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
cmake -DAVM_WARNINGS_ARE_ERRORS=ON -G Ninja ..
- name: "Build: run ninja"
working-directory: build
run: |
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
export PATH="/tmp/rebar3:/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
ninja
- name: "Build: run dialyzer"
working-directory: build
run: |
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
export PATH="/tmp/rebar3:/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
ninja dialyzer
# Test
Expand Down Expand Up @@ -114,16 +122,10 @@ jobs:
run: |
./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
- name: "Install and smoke test"
working-directory: build
run: |
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
export PATH="/tmp/rebar3:/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
sudo ninja install
atomvm examples/erlang/hello_world.avm
atomvm -v
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/build-and-test-on-freebsd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
echo "%%"
echo "**freebsd-version:**"
freebsd-version
sudo pkg install -y cmake gperf erlang elixir mbedtls
sudo pkg install -y cmake gperf erlang rebar3 elixir mbedtls
echo "**uname:**"
uname -a
echo "**C Compiler version:**"
Expand Down Expand Up @@ -110,11 +110,6 @@ jobs:
echo "%%"
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm
echo "%%"
echo "%% Running alisp tests ..."
echo "%%"
./src/AtomVM tests/libs/alisp/test_alisp.avm
echo "%%"
echo "%% Running install ..."
echo "%%"
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/build-and-test-other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,24 @@ jobs:
- name: Install required packages
run: sudo apt install -y gperf

- name: "Build rebar3"
run: |
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
- name: Compile test modules
run: |
export PATH=/tmp/rebar3:$PATH
set -e
mkdir build_tests
cd build_tests
cmake ..
make erlang_test_modules
make code_load copy_code_load_beam copy_code_load_avm
make erlang_tests
make test_estdlib
make test_eavmlib
make test_alisp
- name: Upload test modules
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -164,13 +172,10 @@ jobs:
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/ &&
mkdir -p tests/erlang_tests/_build/default/lib/erlang_tests/ebin &&
cp -r ../build_tests/tests/erlang_tests/_build/default/lib/erlang_tests/ebin/* tests/erlang_tests/_build/default/lib/erlang_tests/ebin/. &&
cp ../build_tests/tests/libs/estdlib/_build/default/lib/*.avm tests/libs/estdlib/. &&
cp ../build_tests/tests/libs/eavmlib/_build/default/lib/*.avm tests/libs/eavmlib/. &&
make AtomVM &&
make test-erlang &&
make test-enif &&
Expand All @@ -186,6 +191,5 @@ jobs:
./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
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm
'
25 changes: 15 additions & 10 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ jobs:
- name: "Install deps"
run: sudo apt install -y ${{ matrix.compiler_pkgs}} cmake gperf zlib1g-dev doxygen valgrind libmbedtls-dev

- name: "Build rebar3"
run: |
export PATH="${{ matrix.path_prefix }}$PATH"
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
# Builder info
- name: "System info"
run: |
Expand Down Expand Up @@ -250,11 +258,15 @@ jobs:
- name: "Build: run make"
working-directory: build
run: make
run: |
export PATH=/tmp/rebar3:$PATH
make
- name: "Build: run dialyzer"
working-directory: build
run: make dialyzer
run: |
export PATH=/tmp/rebar3:$PATH
make dialyzer
# Test
- name: "Test: test-erlang"
Expand Down Expand Up @@ -297,17 +309,10 @@ jobs:
./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
sudo PATH=/tmp/rebar3:${PATH} make install
atomvm examples/erlang/hello_world.avm
atomvm -v
atomvm -h
2 changes: 1 addition & 1 deletion .github/workflows/build-libraries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
working-directory: build
run: |
ATOMVMLIB_FILE=atomvmlib-${{ github.ref_name }}.avm
mv libs/atomvmlib.avm "libs/${ATOMVMLIB_FILE}" &&
mv libs/atomvmlib/_build/default/lib/atomvmlib.avm "libs/${ATOMVMLIB_FILE}" &&
sha256sum "libs/${ATOMVMLIB_FILE}" > "libs/${ATOMVMLIB_FILE}.sha256"
- name: Release
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/build-linux-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,24 @@ jobs:
- name: Install required packages
run: sudo apt install -y gperf

- name: "Build rebar3"
run: |
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
- name: Compile test modules
run: |
set -e
mkdir build_tests
cd build_tests
export PATH=/tmp/rebar3:$PATH
cmake ..
make erlang_test_modules
make erlang_tests
make code_load copy_code_load_beam copy_code_load_avm
make test_estdlib
make test_eavmlib
make test_alisp
- name: Upload test modules
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -216,13 +224,10 @@ jobs:
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/ &&
mkdir -p tests/erlang_tests/_build/default/lib/erlang_tests/ebin &&
cp -r ../build_tests/tests/erlang_tests/_build/default/lib/erlang_tests/ebin/* tests/erlang_tests/_build/default/lib/erlang_tests/ebin/. &&
cp ../build_tests/tests/libs/estdlib/_build/default/lib/*.avm tests/libs/estdlib/. &&
cp ../build_tests/tests/libs/eavmlib/_build/default/lib/*.avm tests/libs/eavmlib/. &&
VERBOSE=1 make AtomVM &&
make test-erlang &&
make test-enif &&
Expand All @@ -239,7 +244,6 @@ jobs:
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
'
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,17 @@ jobs:
languages: ${{ matrix.language }}
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql

- name: "Build rebar3"
run: |
export PATH="${{ matrix.path_prefix }}$PATH"
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
- name: "Build"
run: |
export PATH=/tmp/rebar3:$PATH
mkdir build
cd build
cmake .. -G Ninja
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/esp32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
set -eu
apt update
DEBIAN_FRONTEND=noninteractive apt install -y -q \
doxygen erlang-base erlang-dialyzer \
doxygen erlang erlang-dialyzer \
libglib2.0-0 libpixman-1-0 \
gcc g++ zlib1g-dev
Expand All @@ -88,10 +88,18 @@ jobs:
pytest-embedded-idf==1.2.5 \
pytest-embedded-qemu==1.2.5
- name: "Build rebar3"
run: |
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
- name: Build ESP32 tests using idf.py
working-directory: ./src/platforms/esp32/test/
run: |
set -e
export PATH=/tmp/rebar3:$PATH
. $IDF_PATH/export.sh
idf.py build
Expand All @@ -100,6 +108,7 @@ jobs:
timeout-minutes: 10
run: |
set -e
export PATH=/tmp/rebar3:$PATH
. $IDF_PATH/export.sh
export PATH=/opt/qemu/bin:${PATH}
pytest --embedded-services=idf,qemu -s
9 changes: 9 additions & 0 deletions .github/workflows/esp32-mkimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,20 @@ jobs:
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true
- name: "Build rebar3"
run: |
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
- name: "Build: create build dir"
run: mkdir build

- name: "Build: run cmake"
working-directory: build
run: |
export PATH=/tmp/rebar3:$PATH
cmake ..
# 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.
Expand All @@ -104,6 +112,7 @@ jobs:
- name: "Build erlang and Elixir libs"
working-directory: build/libs
run: |
export PATH=/tmp/rebar3:$PATH
make
- name: "Use release defaults"
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/pico-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,26 @@ jobs:
uses: actions/checkout@v3

- name: "Install deps"
run: sudo apt install -y cmake gperf ninja-build gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib erlang-base erlang-dialyzer
run: sudo apt install -y cmake gperf ninja-build gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib

- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.14"

- name: "Build rebar3"
run: |
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap
- name: Build
shell: bash
working-directory: ./src/platforms/rp2040/
run: |
set -euo pipefail
export PATH=/tmp/rebar3:$PATH
mkdir build
cd build
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }}
Expand All @@ -65,6 +78,7 @@ jobs:
working-directory: ./src/platforms/rp2040/
run: |
set -euo pipefail
export PATH=/tmp/rebar3:$PATH
mkdir build.nosmp
cd build.nosmp
# TODO: fix all warnings and enable -DAVM_WARNINGS_ARE_ERRORS=ON
Expand All @@ -85,6 +99,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
export PATH=/tmp/rebar3:$PATH
set -euo pipefail
mkdir build
cd build
Expand Down
Loading

0 comments on commit 78c57cf

Please sign in to comment.