build.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: Build
  2. on:
  3. push:
  4. branches:
  5. - main
  6. jobs:
  7. compile:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Check out repository
  11. uses: actions/checkout@v4
  12. - name: Set up Arduino CLI
  13. uses: arduino/setup-arduino-cli@v2
  14. - name: Set up Python
  15. uses: actions/setup-python@v5
  16. with:
  17. python-version: '3.x'
  18. - name: Install adafruit-nrfutil
  19. # The Adafruit nRF52 build recipe shells out to adafruit-nrfutil to
  20. # package the DFU .zip; it is not bundled with the core on the runner.
  21. run: pip install adafruit-nrfutil
  22. - name: Install Adafruit nRF52 core
  23. run: |
  24. arduino-cli config init --overwrite
  25. arduino-cli config set board_manager.additional_urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
  26. arduino-cli core update-index
  27. arduino-cli core install adafruit:nrf52
  28. - name: Generate version header
  29. run: ./gen_version.sh
  30. - name: Compile OpenPuck
  31. run: |
  32. mkdir -p build/openpuck build/cache/openpuck
  33. arduino-cli compile \
  34. -b adafruit:nrf52:feather52840 \
  35. --clean \
  36. --build-path build/cache/openpuck \
  37. --output-dir build/openpuck \
  38. --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb} -DCFG_TUD_HID=4" \
  39. OpenPuck
  40. - name: Generate UF2 image
  41. run: |
  42. CORE_DIR="$(find "${HOME}/.arduino15/packages/adafruit/hardware/nrf52" \
  43. -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)"
  44. UF2CONV="${CORE_DIR}/tools/uf2conv/uf2conv.py"
  45. test -f "${UF2CONV}"
  46. test -f build/openpuck/OpenPuck.ino.hex
  47. python3 "${UF2CONV}" -f 0xADA52840 -c \
  48. -o build/openpuck/OpenPuck.ino.uf2 \
  49. build/openpuck/OpenPuck.ino.hex
  50. - name: List build outputs
  51. run: |
  52. find build/openpuck -maxdepth 1 -type f -print | sort
  53. - name: Upload build artifacts
  54. uses: actions/upload-artifact@v4
  55. with:
  56. name: openpuck-firmware
  57. retention-days: 7
  58. path: |
  59. build/openpuck/*.uf2
  60. build/openpuck/*.bin
  61. build/openpuck/*.hex
  62. build/openpuck/*.elf
  63. build/openpuck/*.map
  64. build/openpuck/*.zip