Skip to content

Commit

Permalink
Build flashable firmware image in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Jul 22, 2024
1 parent 4c3a7bd commit 5229147
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 --release --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
6 changes: 6 additions & 0 deletions firmware/README.md
Original file line number Diff line number Diff line change
@@ -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 <!-- eventually: on the [releases] page --> and flashed [from your browser][esptool-js]. The setup described below is only needed for local development.

## Requirements

### Rust Toolchain
Expand Down Expand Up @@ -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

0 comments on commit 5229147

Please sign in to comment.