Skip to content

Initial stab at the web installer #24

Initial stab at the web installer

Initial stab at the web installer #24

#
# Copyright 2022 Fred Dushin <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: esp32-mkimage
on:
push:
paths:
- '.github/workflows/esp32-mkimage.yaml'
pull_request:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'src/**'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
esp32-release:
runs-on: ubuntu-latest
container: espressif/idf:v${{ matrix.idf-version }}
strategy:
matrix:
idf-version: ["5.2"]
cc: ["clang-15"]
cxx: ["clang++-15"]
cflags: ["-O3"]
otp: ["26"]
elixir_version: ["1.16"]
compiler_pkgs: ["clang-15"]
soc: ["esp32c3"]
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
ImageOS: "ubuntu22"
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: '3.23.0'
- name: "APT update"
run: apt update -y
- name: "Install deps"
run: DEBIAN_FRONTEND=noninteractive apt install -y ${{ matrix.compiler_pkgs}} git cmake gperf zlib1g-dev
# needed for generating AtomVM version when running in a docker container
- name: "Configure Git"
run: |
git config --global --add safe.directory /__w/c3card/c3card
echo -n "git rev-parse: "
git rev-parse --short HEAD
# Builder info
- name: "System info"
run: |
echo "**uname:**"
uname -a
echo "**libc version:**"
ldd --version
echo "**C Compiler version:**"
$CC --version
$CXX --version
echo "**Linker version:**"
ld --version
echo "**CMake version:**"
cmake --version
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true
- name: "Clone AtomVM"
run: |
git clone https://github.com/atomvm/AtomVM
- name: "Build: create build dir"
run: mkdir build
- name: "Build: run cmake"
working-directory: build
run: |
cmake ../AtomVM
# 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.
find . -name '*.beam' -exec touch {} \;
- name: "Build erlang and Elixir libs"
working-directory: build/libs
run: |
LANG=en_US.UTF-8 make
- name: "Build the c3card firmware"
working-directory: .
run: |
rebar3 atomvm packbeam
- name: "Copy mkimage.config.in template"
working-directory: .
run: |
cp ./installer/mkimage.config.in ./AtomVM/src/platforms/esp32/tools/
- name: "Use release defaults"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ./AtomVM/src/platforms/esp32/
run: |
cp sdkconfig.release-defaults sdkconfig.defaults
- name: "Clone required components"
shell: bash
working-directory: ./AtomVM/src/platforms/esp32/components/
run: |
git clone https://github.com/atomvm/atomvm_neopixel
git clone https://github.com/atomvm/atomvm_mqtt_client
git clone --branch resource_nif https://github.com/arpunk/atomvm_adc
- name: "Build ${{ matrix.soc }} with idf.py"
shell: bash
working-directory: ./AtomVM/src/platforms/esp32/
run: |
rm -rf build
. $IDF_PATH/export.sh
idf.py set-target ${{ matrix.soc }}
idf.py reconfigure
idf.py build
- name: "Create a ${{ matrix.soc }} image"
working-directory: ./AtomVM/src/platforms/esp32/build
run: |
./mkimage.sh
ls -l *.img
- name: "Upload ${{ matrix.soc }} artifacts"
uses: actions/upload-artifact@v3
with:
name: atomvm-${{ matrix.soc }}-image
path: ./AtomVM/src/platforms/esp32/build/atomvm-${{ matrix.soc }}.img
if-no-files-found: error
- name: "Rename and write sha256sum"
shell: bash
working-directory: ./AtomVM/src/platforms/esp32/build
run: |
ATOMVM_IMG="AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img"
mv atomvm-${{ matrix.soc }}.img "${ATOMVM_IMG}"
sha256sum "${ATOMVM_IMG}" > "${ATOMVM_IMG}.sha256"
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
fail_on_unmatched_files: true
files: |
./AtomVM/src/platforms/esp32/build/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img
./AtomVM/src/platforms/esp32/build/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256