build.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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. - 'lpc15'
  40. - 'lpc18'
  41. - 'lpc54'
  42. - 'lpc55'
  43. - 'nrf'
  44. - 'rp2040'
  45. - 'samd11'
  46. - 'samd21'
  47. - 'samd51'
  48. - 'saml22'
  49. - 'stm32f0'
  50. - 'stm32f4'
  51. - 'stm32f7'
  52. - 'stm32h7'
  53. steps:
  54. - name: Setup Python
  55. uses: actions/setup-python@v2
  56. - name: Checkout TinyUSB
  57. uses: actions/checkout@v2
  58. - name: Checkout common submodules in lib
  59. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip lib/sct_neopixel
  60. - name: Checkout pico-sdk
  61. if: matrix.family == 'rp2040'
  62. run: |
  63. git clone --depth 1 https://github.com/raspberrypi/pico-sdk ~/pico-sdk
  64. echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk
  65. - name: Set Toolchain URL
  66. 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
  67. - name: Cache Toolchain
  68. uses: actions/cache@v2
  69. id: cache-toolchain
  70. with:
  71. path: ~/cache/
  72. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  73. - name: Install Toolchain
  74. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  75. run: |
  76. mkdir -p ~/cache/toolchain
  77. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
  78. tar -C ~/cache/toolchain -xaf toolchain.tar.gz
  79. - name: Set Toolchain Path
  80. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  81. - name: Build
  82. run: python3 tools/build_family.py ${{ matrix.family }}
  83. - uses: actions/upload-artifact@v2
  84. with:
  85. name: ${{ matrix.family }}-tinyusb-examples
  86. path: _bin/
  87. - name: Create Release Asset
  88. if: ${{ github.event_name == 'release' }}
  89. run: |
  90. cd _bin/
  91. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  92. - name: Upload Release Asset
  93. uses: actions/upload-release-asset@v1
  94. env:
  95. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  96. if: ${{ github.event_name == 'release' }}
  97. with:
  98. upload_url: ${{ github.event.release.upload_url }}
  99. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  100. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  101. asset_content_type: application/zip
  102. # ---------------------------------------
  103. # Build RISC-V family
  104. # ---------------------------------------
  105. build-riscv:
  106. runs-on: ubuntu-latest
  107. strategy:
  108. fail-fast: false
  109. matrix:
  110. family:
  111. # Alphabetical order
  112. - 'fomu'
  113. steps:
  114. - name: Setup Python
  115. uses: actions/setup-python@v2
  116. - name: Checkout TinyUSB
  117. uses: actions/checkout@v2
  118. - name: Checkout common submodules in lib
  119. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  120. - name: Set Toolchain URL
  121. 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
  122. - name: Cache Toolchain
  123. uses: actions/cache@v2
  124. id: cache-toolchain
  125. with:
  126. path: ~/cache/
  127. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  128. - name: Install Toolchain
  129. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  130. run: |
  131. mkdir -p ~/cache/toolchain
  132. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
  133. tar -C ~/cache/toolchain -xaf toolchain.tar.gz
  134. - name: Set Toolchain Path
  135. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  136. - name: Build
  137. run: python3 tools/build_family.py ${{ matrix.family }}
  138. - uses: actions/upload-artifact@v2
  139. with:
  140. name: ${{ matrix.family }}-tinyusb-examples
  141. path: _bin/
  142. - name: Create Release Asset
  143. if: ${{ github.event_name == 'release' }}
  144. run: |
  145. cd _bin/
  146. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  147. - name: Upload Release Asset
  148. uses: actions/upload-release-asset@v1
  149. env:
  150. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  151. if: ${{ github.event_name == 'release' }}
  152. with:
  153. upload_url: ${{ github.event.release.upload_url }}
  154. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  155. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  156. asset_content_type: application/zip
  157. # ---------------------------------------
  158. # Build ESP32SX family
  159. # ---------------------------------------
  160. build-esp32sx:
  161. runs-on: ubuntu-latest
  162. strategy:
  163. fail-fast: false
  164. matrix:
  165. board:
  166. # Alphabetical order
  167. # ESP32-S2
  168. - 'adafruit_feather_esp32s2'
  169. - 'adafruit_magtag_29gray'
  170. - 'adafruit_metro_esp32s2'
  171. - 'espressif_kaluga_1'
  172. - 'espressif_saola_1'
  173. # ESP32-S3
  174. # - 'espressif_addax_1' # temporarily remove the board from test while espressif MR is not merged
  175. steps:
  176. - name: Setup Python
  177. uses: actions/setup-python@v2
  178. - name: Pull ESP-IDF docker
  179. run: docker pull espressif/idf:latest
  180. - name: Checkout TinyUSB
  181. uses: actions/checkout@v2
  182. - name: Build
  183. run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32sx.py ${{ matrix.board }}
  184. # ---------------------------------------
  185. # Build msp430 family
  186. # ---------------------------------------
  187. build-msp430:
  188. runs-on: ubuntu-latest
  189. strategy:
  190. fail-fast: false
  191. matrix:
  192. family:
  193. # Alphabetical order
  194. - 'msp430'
  195. steps:
  196. - name: Setup Python
  197. uses: actions/setup-python@v2
  198. - name: Checkout TinyUSB
  199. uses: actions/checkout@v2
  200. - name: Checkout common submodules in lib
  201. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  202. - name: Set Toolchain URL
  203. 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
  204. - name: Cache Toolchain
  205. uses: actions/cache@v2
  206. id: cache-toolchain
  207. with:
  208. path: ~/cache/
  209. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  210. - name: Install Toolchain
  211. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  212. run: |
  213. mkdir -p ~/cache/toolchain
  214. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.bz2
  215. tar -C ~/cache/toolchain -xaf toolchain.tar.bz2
  216. - name: Set Toolchain Path
  217. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  218. - name: Build
  219. run: python3 tools/build_family.py ${{ matrix.family }}
  220. - uses: actions/upload-artifact@v2
  221. with:
  222. name: ${{ matrix.family }}-tinyusb-examples
  223. path: _bin/
  224. - name: Create Release Asset
  225. if: ${{ github.event_name == 'release' }}
  226. run: |
  227. cd _bin/
  228. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  229. - name: Upload Release Asset
  230. uses: actions/upload-release-asset@v1
  231. env:
  232. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  233. if: ${{ github.event_name == 'release' }}
  234. with:
  235. upload_url: ${{ github.event.release.upload_url }}
  236. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  237. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  238. asset_content_type: application/zip
  239. # ---------------------------------------
  240. # Build Renesas family
  241. # ---------------------------------------
  242. build-renesas:
  243. runs-on: ubuntu-latest
  244. strategy:
  245. fail-fast: false
  246. matrix:
  247. family:
  248. # Alphabetical order
  249. - 'rx63n'
  250. steps:
  251. - name: Setup Python
  252. uses: actions/setup-python@v2
  253. - name: Checkout TinyUSB
  254. uses: actions/checkout@v2
  255. - name: Checkout common submodules in lib
  256. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  257. - name: Set Toolchain URL
  258. run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run
  259. - name: Cache Toolchain
  260. uses: actions/cache@v2
  261. id: cache-toolchain
  262. with:
  263. path: ~/cache/
  264. key: ${{ runner.os }}-21-03-30-${{ env.TOOLCHAIN_URL }}
  265. - name: Install Toolchain
  266. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  267. run: |
  268. mkdir -p ~/cache/toolchain/gnurx
  269. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.run
  270. chmod +x toolchain.run
  271. ./toolchain.run -p ~/cache/toolchain/gnurx -y
  272. - name: Set Toolchain Path
  273. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  274. - name: Build
  275. run: python3 tools/build_family.py ${{ matrix.family }}
  276. - uses: actions/upload-artifact@v2
  277. with:
  278. name: ${{ matrix.family }}-tinyusb-examples
  279. path: _bin/
  280. - name: Create Release Asset
  281. if: ${{ github.event_name == 'release' }}
  282. run: |
  283. cd _bin/
  284. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  285. - name: Upload Release Asset
  286. uses: actions/upload-release-asset@v1
  287. env:
  288. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  289. if: ${{ github.event_name == 'release' }}
  290. with:
  291. upload_url: ${{ github.event.release.upload_url }}
  292. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  293. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  294. asset_content_type: application/zip
  295. # ---------------------------------------
  296. # Build all no-family (opharned) boards
  297. # ---------------------------------------
  298. build-board:
  299. runs-on: ubuntu-latest
  300. strategy:
  301. fail-fast: false
  302. matrix:
  303. example:
  304. # Alphabetical order, a group of 4
  305. - 'device/audio_test device/board_test device/cdc_dual_ports device/cdc_msc'
  306. - 'device/cdc_msc_freertos device/dfu_runtime device/hid_composite device/hid_composite_freertos'
  307. - 'device/hid_generic_inout device/hid_multiple_interface device/midi_test device/msc_dual_lun'
  308. - 'device/net_lwip_webserver'
  309. - 'device/uac2_headset device/usbtmc device/webusb_serial host/cdc_msc_hid'
  310. steps:
  311. - name: Setup Python
  312. uses: actions/setup-python@v2
  313. - name: Checkout TinyUSB
  314. uses: actions/checkout@v2
  315. - name: Checkout common submodules in lib
  316. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  317. - name: Set Toolchain URL
  318. 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
  319. - name: Cache Toolchain
  320. uses: actions/cache@v2
  321. id: cache-toolchain
  322. with:
  323. path: ~/cache/
  324. key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
  325. - name: Install Toolchain
  326. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  327. run: |
  328. mkdir -p ~/cache/toolchain
  329. wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
  330. tar -C ~/cache/toolchain -xaf toolchain.tar.gz
  331. - name: Set Toolchain Path
  332. run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
  333. - name: Build
  334. run: python3 tools/build_board.py ${{ matrix.example }}