mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
web/PREVIEW -> 054cbc7 (branch seq-v2). The browser emulator now builds from web/PREVIEW's commit too (main's if
unpinned or if that tree's emulator does not build), so the emulator and the beta installer run the same firmware.
The public installer stays on beta4a.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
181 lines
10 KiB
YAML
181 lines
10 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. The browser emulator follows web/PREVIEW too (main without a pin).
|
|
name: emulator
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: true
|
|
jobs:
|
|
build:
|
|
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()"
|
|
- uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 6.0.11 # (the version the emulator is tested with)
|
|
- name: the emulator
|
|
# (0.9.9-seq2) the emulator runs the beta's firmware (web/PREVIEW's commit, as the beta installer), main's if
|
|
# no pin is set or the pinned tree's emulator does not build
|
|
run: |
|
|
P=$(tr -d ' \n' < web/PREVIEW 2>/dev/null || true)
|
|
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 (cd /tmp/emusrc && python3 -c "import sys; sys.path.insert(0, 'tools'); import build; build.generate()" \
|
|
&& sh web/emu/build.sh); then
|
|
rm -rf build/emu; mkdir -p build; cp -r /tmp/emusrc/build/emu build/emu
|
|
echo "emulator: web/PREVIEW ${P::7}"
|
|
else
|
|
echo "emulator: ${P::7} did not build, main's instead"; sh web/emu/build.sh
|
|
fi
|
|
git worktree remove -f /tmp/emusrc || true
|
|
else
|
|
sh web/emu/build.sh
|
|
fi
|
|
# (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
|
|
(cd "$PREVIEW_ROOT" && python3 tools/build.py)
|
|
PV=$(ver "$PREVIEW_ROOT")
|
|
V=$(ver .)
|
|
python3 web/make_site.py "$PREVIEW_ROOT/build/felucca.fwsc" "${PV:-dev}-${PREVIEW_SHA::7}-preview" build/site_preview
|
|
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"))'
|
|
python3 web/make_site.py "$PKG" "${SV:-dev}-$SH" 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
|
|
for f in index.html worklet.js fm1backup.js felucca.wasm fonts; do
|
|
if [ -e "build/emu/$f" ]; then mv "build/emu/$f" build/pages/emu/; fi
|
|
done
|
|
cp -r build/emu/. build/pages/
|
|
cp web/landing/index.html build/pages/index.html
|
|
cp web/landing/frecuencia.html build/pages/frecuencia.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
|
|
# (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/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/
|
|
# (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
|
|
- uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: build/pages
|
|
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
|