Build atomvm_mqtt_client #228
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright 2023 Fred Dushin <fred@dushin.net> | |
# | |
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | |
# | |
name: "Build atomvm_mqtt_client" | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '17 9 * * *' | |
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: | | |
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 | |
run: | | |
make esp32boot | |
- name: "Build ${{ matrix.soc }} AtomVM with atomvm_mqtt_client" | |
working-directory: ./AtomVM/src/platforms/esp32/ | |
run: | | |
cd components | |
ln -s ../../../../../../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 }}-atomvm_mqtt_client.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: 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 |