# SPDX-License-Identifier: GPL-3.0-only # The browser emulator (web/emu) on GitHub Pages: 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). 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 - uses: actions/setup-python@v5 with: python-version: "3.13" - run: pip install Pillow numpy fonttools - 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 run: sh web/emu/build.sh # (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). If any of it fails the emulator still goes up - 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 - name: JieLi toolchain and SDK files id: tc continue-on-error: true 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" retry git clone --filter=blob:none --no-checkout --depth 1 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 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' continue-on-error: true env: AC79_SDK: /home/runner/fw-AC79_AIoT_SDK JIELI_TOOLCHAIN: /home/runner/.jieli/toolchain run: | python3 tools/build.py V=$(sed -n 's/^#define FELUCCA_VERSION "\([^"]*\)".*/\1/p' firmware/src/felucca.c | head -1) # (0.6.46) the versions the site offers now stay installable (the last few, web/fetch_prev.py) python3 web/fetch_prev.py "https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}" build/prev || true python3 web/make_site.py build/felucca.fwsc "${V:-dev}-${GITHUB_SHA::7}" build/site build/prev cp -r build/site/webapp build/site/firmware build/emu/ - uses: actions/upload-pages-artifact@v3 with: path: build/emu 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