build.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 -DCFG_TUD_TASK_QUEUE_SZ=64" \
  39. OpenPuck
  40. - name: Generate UF2 (OpenPuck)
  41. # The Adafruit nRF52 core leaves its UF2 objcopy recipe commented out in
  42. # platform.txt, so arduino-cli only emits .hex/.zip. Convert the .hex to
  43. # a drag-and-drop .uf2 ourselves.
  44. run: ./gen_uf2.sh build/openpuck/OpenPuck.ino.hex build/openpuck/OpenPuck.ino.uf2
  45. - name: Compile ReversePuckFirmware
  46. run: |
  47. mkdir -p build/reversepuck build/cache/reversepuck
  48. arduino-cli compile \
  49. -b adafruit:nrf52:feather52840 \
  50. --clean \
  51. --build-path build/cache/reversepuck \
  52. --output-dir build/reversepuck \
  53. --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb}" \
  54. ReversePuckFirmware
  55. - name: Generate UF2 (ReversePuckFirmware)
  56. run: ./gen_uf2.sh build/reversepuck/ReversePuckFirmware.ino.hex build/reversepuck/ReversePuckFirmware.ino.uf2
  57. - name: List build outputs
  58. run: |
  59. find build/openpuck build/reversepuck -maxdepth 1 -type f -print | sort
  60. - name: Upload build artifacts
  61. uses: actions/upload-artifact@v4
  62. with:
  63. name: openpuck-firmware
  64. retention-days: 7
  65. path: |
  66. build/openpuck/*.uf2
  67. build/openpuck/*.bin
  68. build/openpuck/*.hex
  69. build/openpuck/*.elf
  70. build/openpuck/*.map
  71. build/openpuck/*.zip
  72. build/reversepuck/*.uf2
  73. build/reversepuck/*.bin
  74. build/reversepuck/*.hex
  75. build/reversepuck/*.elf
  76. build/reversepuck/*.map
  77. build/reversepuck/*.zip