mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
split-beta, emulator-beta, public-release and installer-pages: the download of the pinned run's github-pages artifact may fail (continue-on-error); the next step (tools/fetch_live_site.py restore) leaves build/released/artifact.tar as the downloaded artifact or, when it expired or is older than the live site, the live site fetched and checked. The steps after it are unchanged. Every deploy (those four, emulator, private-preview, usb-input-release) now writes site-manifest.json (every file, size, SHA-256) and keeps its Pages artifact 90 days instead of 1. Pushing this runs "Publish installer pages" (its workflow file changed): it republishes the live site as it is, plus site-manifest.json. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
237 lines
13 KiB
YAML
237 lines
13 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
|
|
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
|
|
- 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
|
|
fi
|
|
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/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")
|
|
PY
|
|
if [ "$E" = ADDITIVE ]; then
|
|
node web/emu/additive-boot-test.mjs build/emu/felucca.wasm
|
|
fi
|
|
- 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
|
|
# (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
|
|
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
|
|
# (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
|
|
# (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
|
|
- 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
|
|
|
|
|
|
|
|
|