build.yml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. name: Build
  2. on:
  3. pull_request:
  4. push:
  5. repository_dispatch:
  6. release:
  7. types:
  8. - created
  9. jobs:
  10. # ---------------------------------------
  11. # Unit testing with Ceedling
  12. # ---------------------------------------
  13. unit-test:
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Setup Ruby
  17. uses: actions/setup-ruby@v1
  18. with:
  19. ruby-version: '2.7'
  20. - name: Checkout TinyUSB
  21. uses: actions/checkout@v2
  22. - name: Unit Tests
  23. run: |
  24. # Install Ceedling
  25. gem install ceedling
  26. cd test
  27. ceedling test:all
  28. # ---------------------------------------
  29. # Build ARM family
  30. # ---------------------------------------
  31. build-arm:
  32. runs-on: ubuntu-latest
  33. strategy:
  34. fail-fast: false
  35. matrix:
  36. family:
  37. # Alphabetical order
  38. - 'imxrt'
  39. - 'lpc18'
  40. - 'lpc55'
  41. - 'nrf'
  42. - 'rp2040'
  43. - 'samd11'
  44. - 'samd21'
  45. - 'samd51'
  46. - 'stm32f4'
  47. - 'stm32f7'
  48. - 'stm32h7'
  49. steps:
  50. - name: Setup Python
  51. uses: actions/setup-python@v2
  52. - name: Checkout TinyUSB
  53. uses: actions/checkout@v2
  54. - name: Checkout common submodules in lib
  55. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip lib/sct_neopixel
  56. - name: Set Toolchain URL
  57. run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz
  58. - name: Cache Toolchain
  59. uses: actions/cache@v2
  60. id: cache-toolchain
  61. with:
  62. path: ~/cache/
  63. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  64. - name: Install Toolchain
  65. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  66. run: |
  67. mkdir -p ~/cache/toolchain
  68. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
  69. tar -C ~/cache/toolchain -xaf toolchain.tar.gz
  70. - name: Set Toolchain Path
  71. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  72. - name: Build
  73. run: python3 tools/build_family.py ${{ matrix.family }}
  74. - uses: actions/upload-artifact@v2
  75. with:
  76. name: ${{ matrix.family }}-tinyusb-examples
  77. path: _bin/
  78. - name: Create Release Asset
  79. if: ${{ github.event_name == 'release' }}
  80. run: |
  81. cd _bin/
  82. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  83. - name: Upload Release Asset
  84. uses: actions/upload-release-asset@v1
  85. env:
  86. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  87. if: ${{ github.event_name == 'release' }}
  88. with:
  89. upload_url: ${{ github.event.release.upload_url }}
  90. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  91. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  92. asset_content_type: application/zip
  93. # ---------------------------------------
  94. # Build RISC-V family
  95. # ---------------------------------------
  96. build-riscv:
  97. runs-on: ubuntu-latest
  98. strategy:
  99. fail-fast: false
  100. matrix:
  101. family:
  102. # Alphabetical order
  103. - 'fomu'
  104. steps:
  105. - name: Setup Python
  106. uses: actions/setup-python@v2
  107. - name: Checkout TinyUSB
  108. uses: actions/checkout@v2
  109. - name: Checkout common submodules in lib
  110. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  111. - name: Set Toolchain URL
  112. run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v10.1.0-1.1/xpack-riscv-none-embed-gcc-10.1.0-1.1-linux-x64.tar.gz
  113. - name: Cache Toolchain
  114. uses: actions/cache@v2
  115. id: cache-toolchain
  116. with:
  117. path: ~/cache/
  118. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  119. - name: Install Toolchain
  120. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  121. run: |
  122. mkdir -p ~/cache/toolchain
  123. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
  124. tar -C ~/cache/toolchain -xaf toolchain.tar.gz
  125. - name: Set Toolchain Path
  126. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  127. - name: Build
  128. run: python3 tools/build_family.py ${{ matrix.family }}
  129. - uses: actions/upload-artifact@v2
  130. with:
  131. name: ${{ matrix.family }}-tinyusb-examples
  132. path: _bin/
  133. - name: Create Release Asset
  134. if: ${{ github.event_name == 'release' }}
  135. run: |
  136. cd _bin/
  137. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  138. - name: Upload Release Asset
  139. uses: actions/upload-release-asset@v1
  140. env:
  141. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  142. if: ${{ github.event_name == 'release' }}
  143. with:
  144. upload_url: ${{ github.event.release.upload_url }}
  145. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  146. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  147. asset_content_type: application/zip
  148. # ---------------------------------------
  149. # Build ESP32S2 family
  150. # ---------------------------------------
  151. build-esp32s2:
  152. runs-on: ubuntu-latest
  153. strategy:
  154. fail-fast: false
  155. matrix:
  156. board:
  157. # Alphabetical order
  158. - 'adafruit_feather_esp32s2'
  159. - 'adafruit_magtag_29gray'
  160. - 'adafruit_metro_esp32s2'
  161. - 'espressif_kaluga_1'
  162. - 'espressif_saola_1'
  163. steps:
  164. - name: Setup Python
  165. uses: actions/setup-python@v2
  166. - name: Pull ESP-IDF docker
  167. run: docker pull espressif/idf:latest
  168. - name: Checkout TinyUSB
  169. uses: actions/checkout@v2
  170. - name: Build
  171. run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32s2.py ${{ matrix.board }}
  172. # ---------------------------------------
  173. # Build msp430 family
  174. # ---------------------------------------
  175. build-msp430:
  176. runs-on: ubuntu-latest
  177. strategy:
  178. fail-fast: false
  179. matrix:
  180. family:
  181. # Alphabetical order
  182. - 'msp430'
  183. steps:
  184. - name: Setup Python
  185. uses: actions/setup-python@v2
  186. - name: Checkout TinyUSB
  187. uses: actions/checkout@v2
  188. - name: Checkout common submodules in lib
  189. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  190. - name: Set Toolchain URL
  191. run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2
  192. - name: Cache Toolchain
  193. uses: actions/cache@v2
  194. id: cache-toolchain
  195. with:
  196. path: ~/cache/
  197. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  198. - name: Install Toolchain
  199. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  200. run: |
  201. mkdir -p ~/cache/toolchain
  202. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.bz2
  203. tar -C ~/cache/toolchain -xaf toolchain.tar.bz2
  204. - name: Set Toolchain Path
  205. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  206. - name: Build
  207. run: python3 tools/build_family.py ${{ matrix.family }}
  208. - uses: actions/upload-artifact@v2
  209. with:
  210. name: ${{ matrix.family }}-tinyusb-examples
  211. path: _bin/
  212. - name: Create Release Asset
  213. if: ${{ github.event_name == 'release' }}
  214. run: |
  215. cd _bin/
  216. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  217. - name: Upload Release Asset
  218. uses: actions/upload-release-asset@v1
  219. env:
  220. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  221. if: ${{ github.event_name == 'release' }}
  222. with:
  223. upload_url: ${{ github.event.release.upload_url }}
  224. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  225. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  226. asset_content_type: application/zip
  227. # ---------------------------------------
  228. # Build all no-family (opharned) boards
  229. # ---------------------------------------
  230. build-board:
  231. runs-on: ubuntu-latest
  232. strategy:
  233. fail-fast: false
  234. matrix:
  235. example:
  236. # Alphabetical order, a group of 4
  237. - 'device/audio_test device/board_test device/cdc_dual_ports device/cdc_msc'
  238. - 'device/cdc_msc_freertos device/dfu_runtime device/hid_composite device/hid_composite_freertos'
  239. - 'device/hid_generic_inout device/hid_multiple_interface device/midi_test device/msc_dual_lun'
  240. - 'device/net_lwip_webserver'
  241. - 'device/uac2_headset device/usbtmc device/webusb_serial host/cdc_msc_hid'
  242. steps:
  243. - name: Setup Python
  244. uses: actions/setup-python@v2
  245. - name: Checkout TinyUSB
  246. uses: actions/checkout@v2
  247. - name: Checkout common submodules in lib
  248. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  249. - name: Set Toolchain URL
  250. run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz
  251. - name: Cache Toolchain
  252. uses: actions/cache@v2
  253. id: cache-toolchain
  254. with:
  255. path: ~/cache/
  256. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  257. - name: Install Toolchain
  258. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  259. run: |
  260. mkdir -p ~/cache/toolchain
  261. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
  262. tar -C ~/cache/toolchain -xaf toolchain.tar.gz
  263. - name: Set Toolchain Path
  264. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  265. - name: Build
  266. run: python3 tools/build_board.py ${{ matrix.example }}