Skip to content

Add ESP32-C61 support #114

Add ESP32-C61 support

Add ESP32-C61 support #114

Workflow file for this run

name: Build Firmware
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
jobs:
# catalog.json is the single source of truth for the set of firmware variants.
# Its `binaries` array is shaped exactly like a matrix `include` list, so it
# can be handed to strategy.matrix as-is.
catalog:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.gen.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Generate build matrix from catalog
id: gen
run: |
# catalog.json names are unprefixed (e.g. "esp32c5"); artifacts,
# release assets, and GCS publish paths have a wendy_mcu_ prefix,
# stored as asset_name here for downstream jobs to use.
echo "matrix=$(jq -c '{include: (.binaries | map(. + {asset_name: ("wendy_mcu_" + .name)}))}' catalog.json)" >> "$GITHUB_OUTPUT"
build:
needs: catalog
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.catalog.outputs.matrix) }}
container:
image: espressif/idf:v5.5.4
steps:
- uses: actions/checkout@v4
- name: Build firmware
shell: bash
run: |
. $IDF_PATH/export.sh
idf.py @boards/${{ matrix.board_cfg }}.cfg set-target ${{ matrix.target }}
idf.py build
- name: Create merged firmware binary
shell: bash
run: |
. $IDF_PATH/export.sh
cd build
esptool.py --chip ${{ matrix.target }} merge_bin \
-o ${{ matrix.asset_name }}.bin \
--flash_mode dio \
--flash_size ${{ matrix.flash_size }} \
@flash_args
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: build/${{ matrix.asset_name }}.bin
nightly:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Update nightly release
env:
GH_TOKEN: ${{ github.token }}
run: |
# Delete existing nightly release and tag if present
gh release delete nightly --yes --cleanup-tag 2>/dev/null || true
# Create new nightly pre-release at current commit. catalog.json ships
# alongside the binaries so consumers can discover the variants.
gh release create nightly \
--prerelease \
--title "Nightly" \
--notes "Automated nightly build from \`main\` ($(date -u '+%Y-%m-%d %H:%M UTC')), commit ${{ github.sha }}" \
$(jq -r '.binaries[] | "wendy_mcu_\(.name)/wendy_mcu_\(.name).bin"' catalog.json) \
catalog.json
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout must come first: it cleans its destination, which would wipe
# the downloaded artifacts. Only catalog.json is needed from the repo.
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Build asset list from catalog
id: assets
run: |
{
echo 'files<<EOF'
jq -r '.binaries[] | "wendy_mcu_\(.name)/wendy_mcu_\(.name).bin"' catalog.json
echo catalog.json
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Attach firmware to release
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.assets.outputs.files }}
# Publish firmware to the GCS bucket + manifests that `wendy os install`
# reads from (firmware/<chip>/<version>/ and manifests/<chip>.json +
# manifests/master.json). Mirrors the OS-image publish flow in
# wendylabsinc/meta-wendyos-jetson by reusing its tools/publisher CLI.
# Tag-triggered (stable releases) only.
publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # required for GCP workload-identity federation
steps:
# Checked out for catalog.json, which drives the loop below.
- uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
# The publisher lives in the WendyOS builder repo so the OS and firmware
# publish paths share one tool. That repo is public, so the default
# GITHUB_TOKEN can check it out -- no separate token needed.
- name: Check out publisher tool
uses: actions/checkout@v4
with:
repository: wendylabsinc/meta-wendyos-jetson
path: builder
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: builder/tools/publisher/go.mod
cache-dependency-path: builder/tools/publisher/go.sum
- name: Build publisher
run: |
cd builder/tools/publisher
go build -o "$RUNNER_TEMP/publisher" .
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Publish firmware to GCS
env:
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
# Tags are vX.Y.Z; GCS manifests use plain X.Y.Z.
VERSION="${REF_NAME#v}"
TOKEN="$(gcloud auth print-access-token)"
# catalog.json names are the firmwareId key that `wendy os install` queries;
# artifacts/bins on disk have the wendy_mcu_ prefix.
for variant in $(jq -r '.binaries[].name' catalog.json); do
bin="wendy_mcu_${variant}/wendy_mcu_${variant}.bin"
echo "Publishing ${variant} v${VERSION} from ${bin}"
# Sequential loop keeps master.json writes serial (no race).
"$RUNNER_TEMP/publisher" \
--firmware \
--chip "$variant" \
--version "$VERSION" \
--file "$bin" \
--notify-discord=false \
--access-token "$TOKEN" </dev/null
done