mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 21:04:32 +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
113 lines
5.0 KiB
YAML
113 lines
5.0 KiB
YAML
name: Private ADDITIVE installer and emulator
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: [web/PRIVATE_BUILD.json]
|
|
workflow_dispatch:
|
|
permissions:
|
|
contents: read
|
|
actions: 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
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
- name: Validate candidate provenance
|
|
id: candidate
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
python3 - <<'PY'
|
|
import json,os,urllib.request
|
|
from pathlib import Path
|
|
m=json.loads(Path('web/PRIVATE_BUILD.json').read_text())
|
|
url=f'https://api.github.com/repos/{os.environ["GITHUB_REPOSITORY"]}/actions/runs/{m["run_id"]}'
|
|
req=urllib.request.Request(url,headers={'Authorization':'Bearer '+os.environ['GH_TOKEN'],'Accept':'application/vnd.github+json'})
|
|
run=json.load(urllib.request.urlopen(req))
|
|
assert run['status']=='completed' and run['conclusion']=='success','candidate validation did not pass'
|
|
assert run['head_sha']==m['source'],'candidate run source mismatch'
|
|
assert run['head_branch']=='codex/add15-private','unexpected candidate branch'
|
|
assert m['emulator_source']==m['source'],'emulator must match the beta'
|
|
assert Path('web/EMULATOR').read_text().strip()==m['source'],'emulator pin mismatch'
|
|
with open(os.environ['GITHUB_OUTPUT'],'a') as f:
|
|
f.write(f'run_id={m["run_id"]}\n')
|
|
f.write(f'emulator_source={m["emulator_source"]}\n')
|
|
PY
|
|
- name: Frozen published site
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: github-pages
|
|
run-id: 40870214766
|
|
github-token: ${{ github.token }}
|
|
path: build/frozen
|
|
- name: Exact validated firmware
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: rec-firmware
|
|
run-id: ${{ steps.candidate.outputs.run_id }}
|
|
github-token: ${{ github.token }}
|
|
path: build/validated
|
|
- name: Verify package and update only preview
|
|
run: |
|
|
mkdir -p build/pages
|
|
tar -xf build/frozen/artifact.tar -C build/pages
|
|
node --input-type=module - <<'JS'
|
|
import fs from 'node:fs';
|
|
import {createHash} from 'node:crypto';
|
|
import {Package,crc16} from './web/fm1pkg.js';
|
|
const p=new Package(fs.readFileSync('build/validated/build/felucca.fwsc'));
|
|
if(p.product!=='FM-1_909'||p.flashSize!==0x93000||p.sfcEnd>p.flashSize)throw Error('Unexpected flash layout');
|
|
if(crc16(p.dec.subarray(p.appOff,p.appOff+p.app.size))!==p.app.dcrc)throw Error('Application CRC mismatch');
|
|
const entry=p.entries.find(e=>e.type!==0);
|
|
const loader=p.raw.subarray(entry.dataOff+p.skew,entry.dataOff+p.skew+entry.size);
|
|
if(createHash('sha256').update(loader).digest('hex')!=='ce8721ed1624b36c1b08f160b9d89a591ae42c7f23f9ce82ab963faeefa6a056')throw Error('OTA loader changed');
|
|
JS
|
|
python3 web/publish_private.py web/PRIVATE_BUILD.json build/pages build/validated/build/felucca.fwsc
|
|
- name: Emulator source matching validated beta
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.candidate.outputs.emulator_source }}
|
|
path: build/emulator-source
|
|
persist-credentials: false
|
|
- uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 6.0.11
|
|
- name: Build and verify ADDITIVE emulator
|
|
run: |
|
|
pip install Pillow==12.3.0 numpy==2.3.5 fonttools==4.61.1
|
|
(cd build/emulator-source && python3 -c "import sys;sys.path.insert(0,'tools');import build;build.generate()")
|
|
cp web/emu/additive-api.h build/emulator-source/web/emu/additive-api.h
|
|
cat web/emu/additive-api.h >> build/emulator-source/web/emu/felucca_web.c
|
|
(cd build/emulator-source && sh web/emu/build.sh)
|
|
node web/emu/additive-boot-test.mjs build/emulator-source/build/emu/felucca.wasm
|
|
python3 web/publish_emulator.py web/PRIVATE_BUILD.json build/pages build/emulator-source/build/emu
|
|
- name: Browser ADDITIVE audio and isolated saves
|
|
timeout-minutes: 4
|
|
run: |
|
|
pip install --timeout 30 --retries 2 playwright==1.58.0
|
|
python3 -u web/emu/browser-additive-test.py build/pages/emu
|
|
- 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
|
|
|