build.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: Build
  2. on:
  3. push:
  4. branches:
  5. - main
  6. # PRs get the same gate -- without this the checks only ran after merge.
  7. pull_request:
  8. jobs:
  9. compile:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Check out repository
  13. uses: actions/checkout@v4
  14. - name: Set up Arduino CLI
  15. uses: arduino/setup-arduino-cli@v2
  16. - name: Set up Python
  17. uses: actions/setup-python@v5
  18. with:
  19. python-version: '3.x'
  20. - name: Install adafruit-nrfutil
  21. # The Adafruit nRF52 build recipe shells out to adafruit-nrfutil to
  22. # package the DFU .zip; it is not bundled with the core on the runner.
  23. run: pip install adafruit-nrfutil
  24. - name: Install Adafruit nRF52 core
  25. run: |
  26. arduino-cli config init --overwrite
  27. arduino-cli config set board_manager.additional_urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
  28. arduino-cli core update-index
  29. arduino-cli core install adafruit:nrf52
  30. - name: Generate version header
  31. run: ./gen_version.sh
  32. - name: Compile OpenPuck
  33. run: |
  34. mkdir -p build/openpuck build/cache/openpuck
  35. arduino-cli compile \
  36. -b adafruit:nrf52:feather52840 \
  37. --clean \
  38. --build-path build/cache/openpuck \
  39. --output-dir build/openpuck \
  40. --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb} -DCFG_TUD_HID=4 -DCFG_TUD_TASK_QUEUE_SZ=64 -DCFG_TUD_VENDOR_TX_BUFSIZE=256" \
  41. OpenPuck
  42. - name: Generate UF2 (OpenPuck)
  43. # The Adafruit nRF52 core leaves its UF2 objcopy recipe commented out in
  44. # platform.txt, so arduino-cli only emits .hex/.zip. Convert the .hex to
  45. # a drag-and-drop .uf2 ourselves.
  46. run: ./gen_uf2.sh build/openpuck/OpenPuck.ino.hex build/openpuck/OpenPuck.ino.uf2
  47. - name: Compile ReversePuckFirmware
  48. run: |
  49. mkdir -p build/reversepuck build/cache/reversepuck
  50. arduino-cli compile \
  51. -b adafruit:nrf52:feather52840 \
  52. --clean \
  53. --build-path build/cache/reversepuck \
  54. --output-dir build/reversepuck \
  55. --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb}" \
  56. ReversePuckFirmware
  57. - name: Generate UF2 (ReversePuckFirmware)
  58. run: ./gen_uf2.sh build/reversepuck/ReversePuckFirmware.ino.hex build/reversepuck/ReversePuckFirmware.ino.uf2
  59. - name: List build outputs
  60. run: |
  61. find build/openpuck build/reversepuck -maxdepth 1 -type f -print | sort
  62. - name: Upload build artifacts
  63. uses: actions/upload-artifact@v4
  64. with:
  65. name: openpuck-firmware
  66. retention-days: 7
  67. path: |
  68. build/openpuck/*.uf2
  69. build/openpuck/*.bin
  70. build/openpuck/*.hex
  71. build/openpuck/*.elf
  72. build/openpuck/*.map
  73. build/openpuck/*.zip
  74. build/reversepuck/*.uf2
  75. build/reversepuck/*.bin
  76. build/reversepuck/*.hex
  77. build/reversepuck/*.elf
  78. build/reversepuck/*.map
  79. build/reversepuck/*.zip