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
119 lines
5.7 KiB
YAML
119 lines
5.7 KiB
YAML
name: Publish beta emulator
|
|
# (V10.6g) The browser emulator of the verified beta: compiled from the same source commit as web/SPLIT_BETA.json, into
|
|
# the site the last beta publish deployed (its Pages artifact, site_run_id); only emu/ changes, every installer,
|
|
# firmware package and editor file is kept byte for byte.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: [web/EMULATOR_BETA.json]
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
pages: write
|
|
id-token: write
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
- name: Pin
|
|
id: pin
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
python3 - <<'PY'
|
|
import json,os,re,urllib.request
|
|
from pathlib import Path
|
|
m=json.loads(Path('web/EMULATOR_BETA.json').read_text())
|
|
b=json.loads(Path('web/SPLIT_BETA.json').read_text())
|
|
assert re.fullmatch('[0-9a-f]{40}',m['source']) and m['source']==b['source'],'emulator must be the beta source'
|
|
assert Path('web/EMULATOR').read_text().strip()==m['source'],'web/EMULATOR pin mismatch'
|
|
req=urllib.request.Request(f'https://api.github.com/repos/{os.environ["GITHUB_REPOSITORY"]}/actions/runs/{m["site_run_id"]}',headers={'Authorization':'Bearer '+os.environ['GH_TOKEN']})
|
|
run=json.load(urllib.request.urlopen(req))
|
|
assert run['status']=='completed' and run['conclusion']=='success','site run did not deploy'
|
|
assert run['name'] in ('Publish verified ADD beta','Publish beta emulator'),'site run is not a beta publish'
|
|
with open(os.environ['GITHUB_OUTPUT'],'a') as f:
|
|
f.write('source='+m['source']+'\n')
|
|
f.write('site_run_id='+str(m['site_run_id'])+'\n')
|
|
PY
|
|
- name: Published site
|
|
id: site
|
|
continue-on-error: true
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: github-pages
|
|
run-id: ${{ steps.pin.outputs.site_run_id }}
|
|
github-token: ${{ github.token }}
|
|
path: build/released
|
|
- name: Published site to start from (the artifact; the live site when it expired or is older)
|
|
# The Pages artifact of the pinned run expires; the live site does not. tools/fetch_live_site.py leaves at
|
|
# build/released/artifact.tar the downloaded artifact, or the live site fetched file by file and checked
|
|
# (site-manifest.json, SHA256SUMS, versions.json); it stops the run rather than start from a partial site.
|
|
run: |
|
|
[ "${{ steps.site.outcome }}" = success ] || rm -rf build/released
|
|
python3 tools/fetch_live_site.py restore --artifact build/released/artifact.tar
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.pin.outputs.source }}
|
|
path: build/emusrc
|
|
persist-credentials: false
|
|
- uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 6.0.11
|
|
- name: Build and verify the emulator
|
|
run: |
|
|
pip install Pillow==12.3.0 numpy==2.3.5 fonttools==4.61.1
|
|
(cd build/emusrc && python3 -c "import sys;sys.path.insert(0,'tools');import build;build.generate()")
|
|
cp web/emu/additive-api.h build/emusrc/web/emu/additive-api.h
|
|
cat web/emu/additive-api.h >> build/emusrc/web/emu/felucca_web.c
|
|
(cd build/emusrc && sh web/emu/build.sh)
|
|
node web/emu/additive-boot-test.mjs build/emusrc/build/emu/felucca.wasm
|
|
- name: Replace only emu/
|
|
run: |
|
|
mkdir -p build/pages
|
|
tar -xf build/released/artifact.tar -C build/pages
|
|
python3 - <<'PY'
|
|
import hashlib,json,re,shutil
|
|
from pathlib import Path
|
|
pages=Path('build/pages');compiled=Path('build/emusrc/build/emu');m=json.loads(Path('web/EMULATOR_BETA.json').read_text())
|
|
def tree():return {p.relative_to(pages).as_posix():hashlib.sha256(p.read_bytes()).hexdigest() for p in pages.rglob('*') if p.is_file() and p.relative_to(pages).parts[0]!='emu'}
|
|
before=tree()
|
|
v=re.search(r'^#define FELUCCA_VERSION "([^"]+)"',Path('build/emusrc/firmware/src/felucca.c').read_text(),re.M).group(1)
|
|
assert m['version']==v,'version label mismatch'
|
|
shell=Path('web/emu/index-additive.html').read_text().replace('@VERSION@',v).replace('@PREVIEW@',' (beta)')
|
|
(compiled/'index.html').write_text(shell)
|
|
shutil.copy('web/emu/worklet.js',compiled/'worklet.js')
|
|
dest=pages/'emu'
|
|
if dest.exists():shutil.rmtree(dest)
|
|
shutil.copytree(compiled,dest)
|
|
(dest/'SOURCE_COMMIT').write_text(m['source']+'\n');(dest/'EDITION').write_text('ADDITIVE\n')
|
|
assert before==tree(),'files outside emu changed'
|
|
print('PASS only emu/ changed:',v,m['source'])
|
|
PY
|
|
- name: Browser audio
|
|
timeout-minutes: 4
|
|
run: |
|
|
pip install --timeout 30 --retries 2 playwright==1.58.0
|
|
python3 -u web/emu/browser-beta-test.py build/pages/emu "$(python3 -c "import json;print(json.load(open('web/EMULATOR_BETA.json'))['version'])")"
|
|
- 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
|