build.yml 3.2 KB

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