ci: generalize firmware release workflow #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| host: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: app | |
| - uses: dtolnay/rust-toolchain@1.94.1 | |
| with: | |
| components: clippy, rustfmt | |
| - name: Format | |
| run: cargo fmt --all -- --check | |
| working-directory: app | |
| - name: Clippy | |
| run: cargo clippy --all-targets -- -D warnings | |
| working-directory: app | |
| - name: Test host runner | |
| run: cargo test --all-targets | |
| working-directory: app | |
| - name: Test embedded host-function ABI | |
| run: cargo test --features esp32c3,wifi,bluetooth | |
| working-directory: app | |
| - name: Test VMBC partition packer | |
| run: | | |
| python scripts/flash_vmbc.py programs/esp32-blinky.rss --output /tmp/rustscript.partition.bin | |
| test -s /tmp/rustscript.partition.bin | |
| working-directory: app | |
| - name: Examples smoke | |
| run: | | |
| cargo run --example run_file -- programs/blinky.rss | grep 'led:off' | |
| printf 'print(1 + 2);\n.quit\n' | cargo run --example repl | grep '3' | |
| working-directory: app | |
| esp32: | |
| name: ESP32-C3 factory firmware | |
| runs-on: ubuntu-latest | |
| env: | |
| PLATFORMIO_CORE_DIR: /mnt/TEMP/platformio/core | |
| PIP_CACHE_DIR: /mnt/TEMP/platformio/pip-cache | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: app | |
| - uses: dtolnay/rust-toolchain@1.94.1 | |
| with: | |
| components: llvm-tools-preview | |
| targets: riscv32imc-unknown-none-elf,riscv32imafc-unknown-none-elf | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install PlatformIO | |
| run: | | |
| sudo mkdir -p /mnt/TEMP | |
| sudo chown -R "$USER:$USER" /mnt/TEMP | |
| python -m venv /mnt/TEMP/platformio/venv | |
| /mnt/TEMP/platformio/venv/bin/pip install platformio==6.1.19 | |
| echo /mnt/TEMP/platformio/venv/bin >> "$GITHUB_PATH" | |
| - name: Build complete firmware | |
| run: pio run | |
| working-directory: app | |
| - name: Build and run Arduino target | |
| run: | | |
| pio run -e arduino | |
| .pio/build/arduino/program | tee /tmp/arduino.log | |
| grep 'micro-rustscript:gpio=low' /tmp/arduino.log | |
| grep 'rss:status=0' /tmp/arduino.log | |
| working-directory: app | |
| - name: Install ESP-IDF preview toolchain under /mnt/TEMP | |
| run: | | |
| sudo mkdir -p /mnt/TEMP | |
| sudo chown -R "$USER:$USER" /mnt/TEMP | |
| ci/install-esp-idf-s31.sh | |
| working-directory: app | |
| - name: Build ESP32-S31 factory image | |
| run: pio run -e esp32s31 | |
| working-directory: app | |
| - name: Verify firmware artifacts | |
| run: | | |
| test -s .pio/build/esp32-c3-devkitm-1/firmware.elf | |
| test -s .pio/build/esp32-c3-devkitm-1/firmware.bin | |
| test -s dist/micro-rustscript-esp32-c3.factory.bin | |
| test -s .pio/generated/rustscript.partition.bin | |
| test -s .pio/build/arduino/program | |
| test -s dist/micro-rustscript-esp32-s31.factory.bin | |
| test -s /mnt/TEMP/micro-rustscript-esp32s31/build/micro_rustscript_esp32s31.elf | |
| cp /mnt/TEMP/micro-rustscript-esp32s31/build/micro_rustscript_esp32s31.elf \ | |
| dist/micro-rustscript-esp32-s31.elf | |
| nm -C .pio/build/esp32-c3-devkitm-1/firmware.elf | grep rustscript_run_vmbc | |
| nm -C .pio/build/esp32-c3-devkitm-1/firmware.elf | grep rustscript_dispatch_host | |
| grep 'rustscript.*0x110000.*0x010000' partitions.csv | |
| stat --format='%n %s bytes' \ | |
| .pio/build/esp32-c3-devkitm-1/firmware.elf \ | |
| .pio/build/esp32-c3-devkitm-1/firmware.bin \ | |
| dist/micro-rustscript-esp32-c3.factory.bin \ | |
| .pio/generated/esp32-blinky.vmbc \ | |
| .pio/generated/rustscript.partition.bin | |
| test "$(stat --format=%s dist/micro-rustscript-esp32-c3.factory.bin)" -lt 1200000 | |
| working-directory: app | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: micro-rustscript-firmware | |
| path: | | |
| app/dist/micro-rustscript-esp32-c3.factory.bin | |
| app/.pio/build/esp32-c3-devkitm-1/firmware.elf | |
| app/.pio/generated/esp32-blinky.vmbc | |
| app/.pio/generated/rustscript.partition.bin | |
| app/.pio/build/arduino/program | |
| app/dist/micro-rustscript-esp32-s31.factory.bin | |
| app/dist/micro-rustscript-esp32-s31.elf | |
| app/scripts/flash_vmbc.py | |
| app/scripts/vmbc_image.py | |
| app/scripts/repl_vmbc.py | |
| app/partitions.csv |