Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#
# Copyright 2023 Fred Dushin <fred@dushin.net>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#

name: "Build MQTT Client"

on: ["push", "pull_request"]

jobs:
esp32-build:
runs-on: ubuntu-latest
container: espressif/idf:v${{ matrix.idf-version }}

strategy:
matrix:
idf-version: ["4.4.3"]
otp: ["24"]
elixir_version: ["1.11"]
soc: ["esp32", "esp32c3", "esp32s2", "esp32s3"]

env:
ImageOS: "ubuntu20"

steps:
- name: Checkout repo
uses: actions/checkout@v2

- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}

- name: "APT update"
run: apt update -y

- name: "Install deps"
run: DEBIAN_FRONTEND=noninteractive apt install -y git cmake

- name: "System info"
run: |
echo "**uname:**"
uname -a
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true

- name: "Check out AtomVM"
run: |
pwd
ls -l
git clone https://github.com/atomvm/AtomVM
cd AtomVM
git rev-parse --short HEAD

- name: "Build: run cmake"
working-directory: AtomVM
run: |
mkdir build
cd build
cmake ..

- name: "Build erlang and Elixir libs"
working-directory: AtomVM/build/libs
run: |
make

- name: "Build ${{ matrix.soc }} AtomVM with atomvm_mqtt_client"
working-directory: ./AtomVM/src/platforms/esp32/
run: |
cd components
ln -s /__w/atomvm_mqtt_client/atomvm_mqtt_client
cd ..
. $IDF_PATH/export.sh
idf.py set-target ${{ matrix.soc }}
idf.py reconfigure
idf.py build

- name: "Create a ${{ matrix.soc }} atomvm_mqtt_client image"
working-directory: ./AtomVM/src/platforms/esp32/build
run: |
./mkimage.sh
for i in atomvm-${{ matrix.soc }}-*.img; do
mv -- "${i}" "${i%.img}-atomvm_mqtt_client.img"
done
ls -l *.img

- name: "Upload ${{ matrix.soc }} artifacts"
uses: actions/upload-artifact@v3
with:
name: atomvm-${{ matrix.soc }}-atomvm_mqtt_client-image
path: ./AtomVM/src/platforms/esp32/build/atomvm-${{ matrix.soc }}-*.img
if-no-files-found: error

avm-build:

runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

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

- name: "Build rebar3"
run: |
cd /tmp
git clone https://github.com/erlang/rebar3.git
cd rebar3
./bootstrap

- name: "Build atomvm_mqtt_client AVM"
run: |
REBAR="/tmp/rebar3/rebar3"
${REBAR} fmt -c
${REBAR} packbeam -f -i

- name: "Upload atomvm_mqtt_client AVM"
uses: actions/upload-artifact@v3
with:
name: atomvm-mqtt_client-avm
path: ./_build/default/lib/mqtt_client.avm
if-no-files-found: error

- name: "Build Example Programs"
run: |
REBAR="/tmp/rebar3/rebar3"
EXAMPLES="mqtt_client_example"
for i in ${EXAMPLES}; do cd ./examples/$i; ${REBAR} fmt -c || exit 1; ${REBAR} packbeam -p -f -i || exit 1; cd ../..; done

release-if-master:
if: github.ref_name == 'master'
needs: ["esp32-build", "avm-build"]
runs-on: ubuntu-latest
steps:
- name: "Download artifacts"
uses: actions/download-artifact@v3

- name: Display structure of downloaded files
run: |
ls -R

- name: Upload latest release
uses: pyTooling/Actions/releaser@main
with:
tag: latest
rm: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
atomvm-esp32-atomvm_mqtt_client-image/*.img
atomvm-esp32c3-atomvm_mqtt_client-image/*.img
atomvm-esp32s2-atomvm_mqtt_client-image/*.img
atomvm-esp32s3-atomvm_mqtt_client-image/*.img
atomvm-mqtt_client-avm/*.avm
5 changes: 3 additions & 2 deletions examples/mqtt_client_example/rebar.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{erl_opts, [debug_info]}.
{deps, [
{atomvm_mqtt_client, {git, "https://github.com/atomvm/atomvm_mqtt_client.git", {branch, "master"}}}
{atomvm_mqtt_client,
{git, "https://github.com/atomvm/atomvm_mqtt_client.git", {branch, "master"}}}
]}.
{plugins, [atomvm_rebar3_plugin]}.
{plugins, [atomvm_rebar3_plugin, erlfmt]}.
4 changes: 2 additions & 2 deletions examples/mqtt_client_example/src/mqtt_client_example.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{applications, [
kernel, stdlib
]},
{env,[]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{links, []}
]}.
]}.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [atomvm_rebar3_plugin]}.
{plugins, [atomvm_rebar3_plugin, erlfmt]}.
4 changes: 2 additions & 2 deletions src/mqtt_client.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{applications, [
kernel, stdlib
]},
{env,[]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{links, []}
]}.
]}.
Loading