Files
JIANT/.github/workflows/emulator.yml
T
Claude dc74b4dbe4 Editor: the SOUND page's modules again on V10.8.7x (G_COUNT 77), not the plain list; appended parameters tolerated; a test in the site deploy
A user (via JIANT Studio): "the sound editor used to show modules, for a few
updates now it is a vertical list". knownLayout knew G_COUNT up to 73; the
firmware has 77 since the OTT / GATE globals, so the editor fell back to the
plain list. Now any G_COUNT from 73 up and any P_COUNT from 123 up with the
engine block last (P_E0 = P_COUNT - 8) is known: the firmware appends, the
ids the layout names stay. web/editor_layout_test.mjs compiles P_COUNT,
G_COUNT, P_E0 from core.h of web/STABLE and web/PREVIEW and checks them
(fails on the old editor: 32099fe and b983fbb both 123 / 77 / 115);
emulator.yml runs it before the site is deployed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-30 21:14:12 +00:00

359 lines
22 KiB
YAML

# SPDX-License-Identifier: GPL-3.0-only
# The site on GitHub Pages: the front page (web/landing) at the root and the browser emulator (web/emu) under emu/: the firmware's sources compiled to WebAssembly, on every push to
# main. Needs Settings > Pages > Source: "GitHub Actions" once. The emulator needs only the generated headers; the
# installer (webapp/installer) and the editor (webapp/editor) need the package, built with JieLi's toolchain (downloaded).
# Two installers: preview/webapp/installer follows web/PREVIEW when set (otherwise main); webapp/installer follows
# the approved web/STABLE commit. web/EMULATOR independently freezes the browser-only SAMPLE source.
name: emulator
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
actions: read
pages: write
id-token: write
concurrency:
group: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, '[private-preview]') && 'pages-full-idle' || 'pages' }}
cancel-in-progress: true
jobs:
build:
if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[private-preview]')
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # (web/STABLE's commit: built for the public installer)
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install Pillow==12.3.0 numpy==2.3.5 fonttools==4.61.1
- name: generated headers (fonts, icons, palettes, shapes, tables, samples)
run: python3 -c "import sys; sys.path.insert(0, 'tools'); import build; build.generate()"
- name: Installer quarantine and edition ordering
run: python3 tests/test_installer_channels.py
# (V10.8.77, a user: the sound editor showed a plain list) the editor knows the firmware's layout (P_COUNT, G_COUNT)
# of the public release and the beta, so its SOUND page shows the modules
- name: Editor layout against the firmware
run: node web/editor_layout_test.mjs
- uses: mymindstorm/setup-emsdk@v14
with:
version: 6.0.11 # (the version the emulator is tested with)
- name: the emulator
# The frozen browser SAMPLE source is separate from the ADD hardware beta pin.
run: |
E=$(tr -d ' \n' < web/EMULATOR_EDITION)
P=$(tr -d ' \n' < web/EMULATOR 2>/dev/null || tr -d ' \n' < web/PREVIEW)
if [ -n "$P" ] && git cat-file -e "$P^{commit}" 2>/dev/null; then
rm -rf /tmp/emusrc; git worktree add -f --detach /tmp/emusrc "$P"
if [ "$E" = ADDITIVE ]; then
cp web/emu/additive-api.h /tmp/emusrc/web/emu/additive-api.h
cat web/emu/additive-api.h >> /tmp/emusrc/web/emu/felucca_web.c
cp web/emu/transfer-api.h /tmp/emusrc/web/emu/transfer-api.h
cat web/emu/transfer-api.h >> /tmp/emusrc/web/emu/felucca_web.c
fi
# (pm) the Project Manager's SAVE / LOAD of a project (the device's own SAVE > PROJECT, song_save_as), either
# edition; a pin from before the project library (no song_save_as) builds without it (the panel says so)
if grep -q "int song_save_as" /tmp/emusrc/firmware/src/song_save.c 2>/dev/null; then
cp web/emu/pm-api.h /tmp/emusrc/web/emu/pm-api.h
cat web/emu/pm-api.h >> /tmp/emusrc/web/emu/felucca_web.c
fi
# (V10.8.72) the pin is the public release (web/STABLE): no "(preview)" mark, and its SOURCE_COMMIT
PV=1; [ "$P" = "$(tr -d ' \n' < web/STABLE)" ] && PV=0
if (cd /tmp/emusrc && python3 -c "import sys; sys.path.insert(0, 'tools'); import build; build.generate()" \
&& EMU_PREVIEW=$PV sh web/emu/build.sh); then
rm -rf build/emu; mkdir -p build; cp -r /tmp/emusrc/build/emu build/emu
printf '%s\n' "$P" > build/emu/SOURCE_COMMIT
echo "emulator: web/EMULATOR ${P::7}"
else
echo "Pinned emulator ${P::7} did not build"; exit 1
fi
git worktree remove -f /tmp/emusrc || true
else
sh web/emu/build.sh
fi
# Use the current browser shell with the pinned firmware, preserving its version label.
python3 - <<'PY'
from pathlib import Path
import re, shutil
target = Path("build/emu/index.html")
version = re.search(r'<small class="version">(.*?)</small>', target.read_text()).group(1)
template = "web/emu/index-additive.html" if Path("web/EMULATOR_EDITION").read_text().strip() == "ADDITIVE" else "web/emu/index.html"
shell = Path(template).read_text().replace("@VERSION@", version).replace("@PREVIEW@", "")
target.write_text(shell)
shutil.copy("web/emu/worklet.js", "build/emu/worklet.js")
shutil.copy("web/emu/devices.html", "build/emu/devices.html") # (ports) every device's panel, one page
for f in ("transfer.js", "transfer-ui.js", "../fm1backup.js", "pm.js", "pm-fm.js", "pm-ui.js"): # (emu-transfer) the FM-1 panel; (pm) the Project Manager
shutil.copy("web/emu/" + f, "build/emu/" + Path(f).name)
PY
if [ "$E" = ADDITIVE ]; then
node web/emu/additive-boot-test.mjs build/emu/felucca.wasm
fi
# (ports) devices.html is this tree's (above), so is its MPC panel's firmware: felucca_hp.wasm (the big CPUs'
# build: SAMPLE, GRAIN, the slots), built here whatever web/EMULATOR pins; felucca.wasm stays the pinned one
EMU_ONLY=hp sh web/emu/build.sh
- name: Browser emulator audio
timeout-minutes: 4
run: |
pip install --timeout 30 --retries 2 playwright==1.58.0
if [ "$(tr -d ' \n' < web/EMULATOR_EDITION)" = ADDITIVE ]; then
python3 -u web/emu/browser-additive-test.py build/emu
fi
# (the owner: "the beta emulator should play every version the public installer offers") each of web/STABLE and
# web/CLASSIC as its own emulator under emu-v/<sha7>/ (its commit's own page, worklet and wasm), for the beta
# emulator's version picker (web/emu/picker.js); a commit's build kept in the cache, so only a new one is built
- name: every installer version's emulator (cached)
uses: actions/cache@v4
with:
path: build/emu-v-cache
key: emu-v-1-${{ hashFiles('web/STABLE', 'web/CLASSIC', 'web/WITHDRAWN') }}
restore-keys: emu-v-1-
- name: every installer version's emulator
timeout-minutes: 40
run: bash web/emu/build_versions.sh build/pages/emu-v build/emu-v-cache
# (Studio's converter) web/EMU_CONVERT: V10.8.50 + web_proj_load / web_proj_save (codex/emu-convert), under
# emu-convert/: it still reads the projects of before V10.7 that V10.8.51+ refuses (OLD PROJECT: OPEN IN STUDIO)
- name: the old-project converter's emulator
if: hashFiles('web/EMU_CONVERT') != ''
timeout-minutes: 15
run: |
C=$(tr -d ' \n' < web/EMU_CONVERT)
[[ "$C" =~ ^[0-9a-f]{40}$ ]]
git cat-file -e "$C^{commit}" || git fetch -q origin "$C"
rm -rf /tmp/convsrc; git worktree add -f --detach /tmp/convsrc "$C"
(cd /tmp/convsrc && python3 -c "import sys; sys.path.insert(0, 'tools'); import build; build.generate()" && sh web/emu/build.sh)
mkdir -p build/pages/emu-convert
cp -r /tmp/convsrc/build/emu/. build/pages/emu-convert/
cp /tmp/convsrc/web/emu/worklet.js build/pages/emu-convert/worklet.js
printf '%s\n' "$C" > build/pages/emu-convert/SOURCE_COMMIT
git worktree remove -f /tmp/convsrc || true
# (JIANT) the installer and the web editor next to the emulator: the package needs JieLi's toolchain (downloaded)
# and three files of their AC79 SDK (a partial clone: only those blobs). A firmware build failure stops deployment.
- name: JieLi toolchain and SDK files (cached)
uses: actions/cache@v4
with:
path: |
~/.jieli
~/fw-AC79_AIoT_SDK/cpu/wl82/tools
key: jieli-ac79-v1.2.1
- name: JieLi toolchain and SDK files
id: tc
run: |
# gitee resets connections from the runners now and then: retries with backoff; the cache above keeps them
retry() { for d in 0 5 15 30 60; do sleep $d; "$@" && return 0; done; return 1; }
T=$HOME/fw-AC79_AIoT_SDK/cpu/wl82/tools
[ -e "$HOME/.jieli/toolchain" ] || retry sh tools/get_toolchain.sh "$HOME/.jieli"
if [ ! -s "$T/uboot.boot" ] || [ ! -s "$T/cfg_tool.bin" ] || [ ! -s "$T/cfg/eq_cfg_hw.bin" ]; then
rm -rf "$HOME/fw-AC79_AIoT_SDK"
# (0.9.13) the reference release, AC79NN_SDK_V1.2.1 (d179b44), not the tip: the tip's cfg_tool.bin / eq_cfg_hw.bin
# are 623 B longer and pushed the app region past 0x93000 with the grown slot (tools/fm1pkg_make.py)
retry git clone --filter=blob:none --no-checkout https://gitee.com/Jieli-Tech/fw-AC79_AIoT_SDK.git "$HOME/fw-AC79_AIoT_SDK"
cd "$HOME/fw-AC79_AIoT_SDK" && git sparse-checkout set --no-cone /cpu/wl82/tools/uboot.boot /cpu/wl82/tools/cfg_tool.bin \
/cpu/wl82/tools/cfg/eq_cfg_hw.bin && retry git checkout d179b4484759423312073f5fbb232501aa491047
fi
test -s "$T/uboot.boot" && test -s "$T/cfg_tool.bin" && test -s "$T/cfg/eq_cfg_hw.bin"
- name: the package, the installer and the editor
if: steps.tc.outcome == 'success'
env:
AC79_SDK: /home/runner/fw-AC79_AIoT_SDK
JIELI_TOOLCHAIN: /home/runner/.jieli/toolchain
run: |
ver() { sed -n 's/^#define FELUCCA_VERSION "\([^"]*\)".*/\1/p' "$1/firmware/src/felucca.c" | head -1; }
# The preview follows an explicitly selected source commit, or main when no pin exists.
PREVIEW_ROOT=.
PREVIEW_SHA="$GITHUB_SHA"
P=$(tr -d ' \n' < web/PREVIEW 2>/dev/null || true)
if [ -n "$P" ]; then
[[ "$P" =~ ^[0-9a-f]{40}$ ]]
git cat-file -e "$P^{commit}"
git worktree add --detach /tmp/preview "$P"
PREVIEW_ROOT=/tmp/preview
PREVIEW_SHA="$P"
fi
# USB input regression: include the actual pinned beta, not main's sources.
for CDC in 0 1; do
(cd "$PREVIEW_ROOT" && cc -O2 -w -DHALF_FRAMES=128 -DT_CDC="$CDC" tests/uac_test.c -lm -o "/tmp/beta-uac-$CDC")
"/tmp/beta-uac-$CDC"
done
(cd "$PREVIEW_ROOT" && python3 tools/build.py)
PV=$(ver "$PREVIEW_ROOT")
V=$(ver .)
# Explicit beta-only editions: never read by the public installer.
mkdir -p build/beta; : > build/beta/list
while read -r C NOTE; do
case "$C" in ''|'#'*) continue;; esac
git cat-file -e "$C^{commit}"
git worktree add --detach /tmp/beta-edition "$C"
(cd /tmp/beta-edition && python3 tools/build.py)
BV=$(ver /tmp/beta-edition); BF="felucca-${BV}-${C::7}.fwsc"
cp /tmp/beta-edition/build/felucca.fwsc "build/beta/$BF"
printf '%s %s\n' "$BV-${C::7}" "$BF" >> build/beta/list
git worktree remove -f /tmp/beta-edition
done < web/BETA_VERSIONS
python3 -c 'import json; L=[l.split() for l in open("build/beta/list") if l.strip()]; json.dump([{"version":v,"file":f} for v,f in L], open("build/beta/versions.json","w"))'
python3 web/make_site.py "$PREVIEW_ROOT/build/felucca.fwsc" "${PV:-dev}-${PREVIEW_SHA::7}-preview" build/site_preview build/beta
mkdir -p build/emu/preview
cp -r build/site_preview/webapp build/site_preview/firmware build/emu/preview/
printf '%s\n' "$PREVIEW_SHA" > build/emu/preview/firmware/SOURCE_COMMIT
(cd build/emu/preview/firmware && sha256sum felucca-*.fwsc > SHA256SUMS)
# the public installer: the approved commit (web/STABLE), built from its own sources
S=$(tr -d ' \n' < web/STABLE 2>/dev/null || true)
PKG=build/felucca.fwsc; SV=${V:-dev}; SH=${GITHUB_SHA::7}
if [ -n "$S" ] && git cat-file -e "$S^{commit}" 2>/dev/null; then
git worktree add -f /tmp/stable "$S"
(cd /tmp/stable && python3 tools/build.py)
PKG=/tmp/stable/build/felucca.fwsc; SV=$(ver /tmp/stable); SH=${S::7}
fi
# (0.9.9-beta1) web/CLASSIC: earlier versions offered too, each built from its own commit here (never a
# package taken from the live site: later builds crashed on the device). versions.json for make_site.py.
rm -rf build/prev; mkdir -p build/prev; : > build/prev/list
W=$(sed 's/#.*//' web/WITHDRAWN 2>/dev/null | awk 'NF{print $1}' | tr '\n' ' ')
while read -r C NOTE; do
case "$C" in ''|'#'*) continue;; esac
git cat-file -e "$C^{commit}" 2>/dev/null || { echo "CLASSIC: $C is not a commit here, skipped"; continue; }
rm -rf /tmp/classic; git worktree prune; git worktree add -f --detach /tmp/classic "$C"
if (cd /tmp/classic && python3 tools/build.py >/tmp/classic.log 2>&1); then
CV=$(ver /tmp/classic); F="felucca-${CV}-${C::7}.fwsc"
case " $W " in *" ${CV#v} "*) echo "CLASSIC: $CV withdrawn (web/WITHDRAWN), skipped";;
*) cp /tmp/classic/build/felucca.fwsc "build/prev/$F"; printf '%s %s\n' "$CV-${C::7}" "$F" >> build/prev/list;;
esac
else
echo "CLASSIC: $C did not build, skipped"; tail -5 /tmp/classic.log
fi
git worktree remove -f /tmp/classic || true
done < web/CLASSIC
python3 -c 'import json,sys; L=[l.split() for l in open("build/prev/list") if l.strip()]; json.dump([{"version":v,"file":f} for v,f in L], open("build/prev/versions.json","w"))'
# (2026-10-30) one public list: web/STABLE first, then web/CLASSIC (ADD par10 among them; the SAMPLE edition withdrawn)
python3 web/make_site.py "$PKG" "${SV:-dev}" build/site build/prev
cp -r build/site/webapp build/site/firmware build/emu/
# (JIANT 0.7.9) the stems app's phase-0 probe (android/probe), next to the installer: app/jiant-probe.apk
- uses: actions/setup-java@v4
continue-on-error: true
with:
distribution: temurin
java-version: "17"
- uses: gradle/actions/setup-gradle@v4
continue-on-error: true
with:
gradle-version: "8.9"
- name: the Android probe
continue-on-error: true
run: |
gradle -p android/probe assembleDebug --no-daemon
mkdir -p build/emu/app
cp android/probe/app/build/outputs/apk/debug/app-debug.apk build/emu/app/jiant-probe.apk
# (JIANT 0.8.1) the site's front page (web/landing: what JIANT is, install / try / edit, what comes next) at the
# root, for people who just want to play; the emulator moves to emu/ (its links go up one level)
- name: the front page and the emulator under emu/
run: |
mkdir -p build/pages/emu
# (ports) devices.html beside what it loads (worklet.js, felucca.wasm, felucca_hp.wasm, fonts, index.html)
for f in index.html worklet.js fm1backup.js transfer.js transfer-ui.js pm.js pm-fm.js pm-ui.js felucca.wasm devices.html felucca_hp.wasm fonts SOURCE_COMMIT; do
if [ -e "build/emu/$f" ]; then mv "build/emu/$f" build/pages/emu/; fi
done
# (the owner: "the public emulator with the version picker too") the public pin's page over emu-v's versions
if [ -s build/pages/emu-v/index.json ] && [ -f build/pages/emu/index.html ]; then
python3 -c "from pathlib import Path; p=Path('build/pages/emu/index.html'); h=p.read_text(); p.write_text(h if 'emu-v/picker.js' in h else h.replace('</body>','<script src=\"../emu-v/picker.js\"></script>\n</body>',1))"
fi
cp -r build/emu/. build/pages/
cp web/landing/index.html build/pages/index.html
cp web/landing/frecuencia.html build/pages/frecuencia.html
# (ports) the old address of the devices page (it was at the root, without its wasm): to emu/devices.html
printf '%s\n' '<!doctype html><meta charset="utf-8"><title>JIANT FM devices</title>' \
'<meta http-equiv="refresh" content="0; url=emu/devices.html">' \
'<script>location.replace("emu/devices.html" + location.hash)</script><a href="emu/devices.html">JIANT FM devices</a>' \
> build/pages/devices.html
# (0.9.12) the front page's animations, recorded from the firmware's drawing code (tools/landing_anim)
cp -r web/landing/anim build/pages/anim
# (V10) the front page's screens: V10's own pages recorded moving (tools/landing_anim/build_screens.sh)
cp -r web/landing/screens build/pages/screens
# (studio) JIANT Studio: install, edit, the screen, the emulator and recording for JIANT FM and JIANT BYTE in one
# page (web/studio; it shows JIANT BYTE's tools from /JIANT-BYTE/, the same origin)
mkdir -p build/pages/studio
cp web/studio/index.html web/studio/studio.js web/studio/studio-lib.js web/studio/daw.js web/studio/recorder-worklet.js web/studio/learn.js web/studio/wavetable.js web/studio/radio-vis.js web/studio/visgen.js web/studio/analysis.js web/studio/convert.js web/studio/fmformula.js web/studio/audioedit.js web/studio/learn-fm.json web/studio/learn-byte.json web/studio/live-fm.json web/studio/live-byte.json web/fm1backup.js build/pages/studio/
cp -r web/studio/smk37 build/pages/studio/smk37
cp web/fm1pkg.js web/fm1ota.js build/pages/studio/smk37/
cp -r LICENSE LICENSES LICENSING.md build/pages/studio/smk37/
cp -r web/studio/img build/pages/studio/img
# (videos) the presentation videos: Studio's home and the front page play them from here
if [ -d web/studio/video ]; then cp -r web/studio/video build/pages/studio/video; fi
# (studio) FM-1 Rescue's builder and base firmware for Studio's Rescue tab; its own page at rescue/
mkdir -p build/pages/studio/rescue/base build/pages/rescue
cp rescue/builder.js build/pages/studio/rescue/ && cp rescue/base/*.uf2 build/pages/studio/rescue/base/
cp rescue/fm1-rescue.html build/pages/rescue/index.html
# (0.9.11) old and mistyped links (/installer/, /webapp/, a link with ":1:1" stuck to it) to the page they meant
cp web/404.html build/pages/404.html
mkdir -p build/pages/docs && cp docs/studio.png build/pages/docs/ && cp docs/cheatsheet-controls.pdf docs/cheatsheet-sound.pdf docs/cheatsheet-controls.png docs/cheatsheet-sound.png build/pages/docs/
# (0.9.2) the navigation map the front page shows (tools/gen_nav_map.py), English and Spanish
cp docs/navigation-map.png docs/navigation-map.svg docs/navigation-map.es.png docs/navigation-map.es.svg build/pages/docs/
# (V10.8.21) the guides: what's new and the full manual, EN and ES, one self-contained page each
mkdir -p build/pages/docs/guide && cp docs/guide/*.html build/pages/docs/guide/
# (0.9.12) the interactive manual (web/manual: the panel, every command, the map, what's new) at manual/
python3 web/make_site.py manual build/pages
- name: the beta emulator's pin (web/SPLIT_BETA.json, when it is web/PREVIEW's commit)
id: betaemu
run: |
python3 - <<'PY'
import json,os
from pathlib import Path
out=open(os.environ['GITHUB_OUTPUT'],'a')
try:
m=json.loads(Path('web/SPLIT_BETA.json').read_text())
ok=m.get('emulator_sha256') and m['source']==Path('web/PREVIEW').read_text().strip()
except Exception:
ok=False
out.write('run_id='+(str(m['run_id']) if ok else '')+'\n')
PY
# (V10.8.20) a full rebuild from main used to drop preview/emu (only split-beta.yml wrote it): the same
# verified candidate emulator again, from the CI run the beta was published from
- name: the beta emulator's candidate
if: steps.betaemu.outputs.run_id != ''
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: drum-kits-emulator-candidate
run-id: ${{ steps.betaemu.outputs.run_id }}
github-token: ${{ github.token }}
path: build/beta-emulator
- name: the beta emulator under preview/emu
if: steps.betaemu.outputs.run_id != ''
run: |
python3 - <<'PY'
import hashlib,json,shutil
from pathlib import Path
m=json.loads(Path('web/SPLIT_BETA.json').read_text())
emu=Path('build/beta-emulator'); wasm=emu/'felucca.wasm'
if not wasm.exists() or hashlib.sha256(wasm.read_bytes()).hexdigest()!=m['emulator_sha256']:
print('beta emulator: candidate missing or its SHA256 differs, preview/emu left out'); raise SystemExit(0)
html=(emu/'index.html').read_text()
(emu/'index.html').write_text(html.replace('Installer (approved version)','Installer (beta)'))
target=Path('build/pages/preview/emu')
if target.exists(): shutil.rmtree(target)
shutil.copytree(emu,target)
if Path('build/pages/emu-v/index.json').exists(): # (the version picker, web/emu/picker.js)
(target/'index.html').write_text((target/'index.html').read_text().replace('</body>','<script src="../../emu-v/picker.js"></script>\n</body>',1))
(target/'SOURCE_COMMIT').write_text(m['source']+'\n')
(target/'SHA256SUMS').write_text(''.join(hashlib.sha256(p.read_bytes()).hexdigest()+' '+p.relative_to(target).as_posix()+'\n' for p in sorted(target.rglob('*')) if p.is_file()))
print('beta emulator restored:',m['version'])
PY
- name: Site manifest (every file with its SHA-256, for the next publish to recover the site exactly)
run: python3 tools/fetch_live_site.py manifest build/pages
- uses: actions/upload-pages-artifact@v3
with:
path: build/pages
retention-days: 90 # (the default is 1 day: the next publish starts from this artifact)
deploy:
needs: build
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4