From 275dd0d02b1b2820d74466e62b7fdbee96830879 Mon Sep 17 00:00:00 2001 From: Fred Dushin Date: Thu, 23 Nov 2023 13:19:50 -0500 Subject: [PATCH] Use a build script in CI and for local testing --- .github/workflows/build-examples.yaml | 4 +--- build.sh | 31 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100755 build.sh diff --git a/.github/workflows/build-examples.yaml b/.github/workflows/build-examples.yaml index 4ee7d0e..1657d0a 100644 --- a/.github/workflows/build-examples.yaml +++ b/.github/workflows/build-examples.yaml @@ -38,6 +38,4 @@ jobs: - name: "Build Erlang Example Programs" run: | - REBAR="/tmp/rebar3/rebar3" - EXAMPLES="arepl_example blinky esp_nvs deep_sleep gpio_interrupt i2c_example hello_world ledc_example read_priv spi_example system_info tcp_client tcp_server uart_example udp_client udp_server wifi" - for i in ${EXAMPLES}; do cd ./erlang/$i; ${REBAR} fmt -c || exit 1; ${REBAR} packbeam -p -f -i || exit 1; cd ../..; done + ./build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..016e957 --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# This file is part of AtomVM. +# +# Copyright 2023 Fred Dushin +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later +# + +REBAR="rebar3" +cd erlang +ERLANG_EXAMPLES="$(/bin/ls | grep -v README.md)" +for i in ${ERLANG_EXAMPLES}; do + cd $i + rm -rf _build + ${REBAR} atomvm packbeam -l || exit 1 + ${REBAR} as check fmt -c || exit 1 + cd .. +done