From 9b6b8f2dcfc83967209f4bab10847c94d84d59d9 Mon Sep 17 00:00:00 2001 From: Andreas Neuhaus Date: Mon, 22 Jul 2024 11:46:32 +0200 Subject: [PATCH] Build flashable firmware image in CI --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ firmware/README.md | 6 ++++++ 2 files changed, 36 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ffa7be9..76e9a72 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -67,3 +67,33 @@ jobs: name: touch-n-drink-elf path: firmware/target/riscv32imc-unknown-none-elf/release/touch-n-drink if-no-files-found: error + + image: + name: Image + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Cache espflash + id: cache-espflash + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/espflash + key: ${{ runner.os }}-espflash + - name: Install dependencies + if: steps.cache-espflash.outputs.cache-hit != 'true' + run: sudo apt-get update && sudo apt-get install pkg-config libudev-dev + - name: Install espflash + if: steps.cache-espflash.outputs.cache-hit != 'true' + run: cargo install espflash + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: touch-n-drink-elf + - name: Generate ESP32 image + run: espflash save-image --chip esp32c3 --merge --skip-padding firmware/target/riscv32imc-unknown-none-elf/release/touch-n-drink touch-n-drink-esp32c3.bin + - name: Upload firmware artifact + uses: actions/upload-artifact@v4 + with: + name: touch-n-drink-esp32c3 + path: touch-n-drink-esp32c3.bin + if-no-files-found: error diff --git a/firmware/README.md b/firmware/README.md index a7e0807..ff2de3e 100644 --- a/firmware/README.md +++ b/firmware/README.md @@ -1,5 +1,7 @@ # LSC Touch 'n Drink Firmware +Firmware images are automatically build by GitHub actions. They can be downloaded as artifacts of recent [CI][actions] runs and flashed [from your browser][esptool-js]. The setup described below is only needed for local development. + ## Requirements ### Rust Toolchain @@ -29,3 +31,7 @@ To flash the firmware to a device, connect the device via its USB-C serial port ```sh cargo espflash flash --release ``` + +[actions]: https://github.com/zargony/touch-n-drink/actions +[esptool-js]: https://espressif.github.io/esptool-js/ +[releases]: https://github.com/zargony/touch-n-drink/releases