Loading files
name: Setup
description: Setup Node.js, ModdableSDK and ESP-IDF environments
inputs:
target-branch:
description: "Target branch to setup environment"
required: false
default: ""
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./firmware/node_modules
key: ${{ runner.os }}-npm-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
working-directory: ./firmware
shell: bash
- name: check latest release tag of Moddable
if: inputs.target-branch == ''
run: |
API_URL="https://api.github.com/repos/Moddable-OpenSource/moddable/commits/public"
RESPONSE=$(curl -s -H "Authorization: Bearer ${{ github.token }}" $API_URL)
LATEST_COMMIT=$(echo $RESPONSE | jq -r '.sha' | cut -c1-12)
echo "Latest commit of Moddable: $LATEST_COMMIT"
echo "moddable_cache_key=${{ runner.os }}-moddable-$LATEST_COMMIT" >> $GITHUB_ENV
shell: bash
- name: Restore cache of Moddale and ESP32
if: inputs.target-branch == ''
id: restore-cache-moddable
uses: actions/cache/restore@v4
with:
path: |
/home/runner/.local/share
/home/runner/.espressif
key: ${{ env.moddable_cache_key }}
- name: install Moddable
if: steps.restore-cache-moddable.outputs.cache-hit != 'true'
run: |
sudo apt-get update
if [ -z "${{ inputs.target-branch }}" ]; then
npm run setup
else
npm run setup -- --target-branch ${{ inputs.target-branch }}
fi
working-directory: ./firmware
shell: bash
- name: install ESP32
if: steps.restore-cache-moddable.outputs.cache-hit != 'true'
run: |
sudo apt-get update
source $HOME/.local/share/xs-dev-export.sh && npm run setup -- --device=esp32
working-directory: ./firmware
shell: bash
- name: Save cache of Moddale and ESP32
if: inputs.target-branch == '' && steps.restore-cache-moddable.outputs.cache-hit != 'true'
id: save-cache-moddable
uses: actions/cache/save@v4
with:
path: |
/home/runner/.local/share
/home/runner/.espressif
key: ${{ env.moddable_cache_key }}
f28aa5c47This file is pinned to the selected release. Download the original to open it in your design tool.