build.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. name: Build
  2. on:
  3. pull_request:
  4. push:
  5. repository_dispatch:
  6. release:
  7. types:
  8. - created
  9. jobs:
  10. # Unit testing with Ceedling
  11. unit-test:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Setup Ruby
  15. uses: actions/setup-ruby@v1
  16. with:
  17. ruby-version: '2.7'
  18. - name: Checkout TinyUSB
  19. uses: actions/checkout@v2
  20. - name: Unit Tests
  21. run: |
  22. # Install Ceedling
  23. gem install ceedling
  24. cd test
  25. ceedling test:all
  26. # build all example for each family
  27. build-family:
  28. runs-on: ubuntu-latest
  29. strategy:
  30. fail-fast: false
  31. matrix:
  32. family:
  33. # Alphabetical order
  34. - 'imxrt'
  35. - 'nrf'
  36. - 'rp2040'
  37. - 'samd11'
  38. - 'samd21'
  39. - 'samd51'
  40. - 'stm32f4'
  41. - 'stm32f7'
  42. steps:
  43. - name: Setup Python
  44. uses: actions/setup-python@v2
  45. - name: Setup Node.js
  46. uses: actions/setup-node@v1
  47. - name: Install Toolchains
  48. run: |
  49. # ARM GCC from xpack
  50. npm install --global xpm
  51. xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
  52. echo `echo $HOME/.local/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
  53. - name: Checkout TinyUSB
  54. uses: actions/checkout@v2
  55. with:
  56. submodules: 'true'
  57. - name: Checkout Sub-Submodules
  58. run: |
  59. # some submodule has it own submodules that need to be fetched as well
  60. git submodule update --init --recursive hw/mcu/microchip
  61. git submodule update --init --recursive lib/FreeRTOS
  62. - name: Build
  63. run: python3 tools/build_family.py ${{ matrix.family }}
  64. - uses: actions/upload-artifact@v2
  65. with:
  66. name: ${{ matrix.family }}-tinyusb-examples
  67. path: _bin/
  68. - name: Create Release Asset
  69. if: ${{ github.event_name == 'release' }}
  70. run: |
  71. cd _bin/
  72. zip -r ../${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip *
  73. - name: Upload Release Asset
  74. uses: actions/upload-release-asset@v1
  75. env:
  76. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  77. if: ${{ github.event_name == 'release' }}
  78. with:
  79. upload_url: ${{ github.event.release.upload_url }}
  80. asset_path: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  81. asset_name: ${{ matrix.family }}-tinyusb-${{ github.event.release.tag_name }}-examples.zip
  82. asset_content_type: application/zip
  83. # Build all no-family (opharned) boards
  84. build-board:
  85. runs-on: ubuntu-latest
  86. strategy:
  87. fail-fast: false
  88. matrix:
  89. example:
  90. # Alphabetical order
  91. - 'device/audio_test'
  92. - 'device/board_test'
  93. - 'device/cdc_dual_ports'
  94. - 'device/cdc_msc'
  95. - 'device/cdc_msc_freertos'
  96. - 'device/dfu_runtime'
  97. - 'device/hid_composite'
  98. - 'device/hid_composite_freertos'
  99. - 'device/hid_generic_inout'
  100. - 'device/hid_multiple_interface'
  101. - 'device/midi_test'
  102. - 'device/msc_dual_lun'
  103. - 'device/net_lwip_webserver'
  104. - 'device/uac2_headset'
  105. - 'device/usbtmc'
  106. - 'device/webusb_serial'
  107. - 'host/cdc_msc_hid'
  108. steps:
  109. - name: Setup Python
  110. uses: actions/setup-python@v2
  111. - name: Setup Node.js
  112. uses: actions/setup-node@v1
  113. - name: Checkout TinyUSB
  114. uses: actions/checkout@v2
  115. with:
  116. submodules: 'true'
  117. - name: Checkout Sub-Submodules
  118. run: |
  119. # some submodule has it own submodules that need to be fetched as well
  120. git submodule update --init --recursive hw/mcu/microchip
  121. git submodule update --init --recursive lib/FreeRTOS
  122. # Add msp430-gcc url to env
  123. echo >> $GITHUB_ENV MSP430_GCC_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
  124. - name: Cache MSP430-GCC
  125. uses: actions/cache@v2
  126. id: cache-msp430
  127. with:
  128. path: ~/cache/
  129. key: ${{ runner.os }}-21-01-26-${{ env.MSP430_GCC_URL }}
  130. - name: Install MSP430-GCC
  131. if: steps.cache-msp430.outputs.cache-hit != 'true'
  132. run: |
  133. # MSP430 GCC
  134. mkdir -p ~/cache/msp430-gcc
  135. wget --progress=dot:mega $MSP430_GCC_URL -O msp430-gcc.tar.bz2
  136. tar -C ~/cache/msp430-gcc -xaf msp430-gcc.tar.bz2
  137. - name: Install Toolchains
  138. run: |
  139. # ARM & RISC-V GCC from xpack
  140. npm install --global xpm
  141. xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
  142. xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest
  143. echo `echo $HOME/.local/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
  144. echo `echo $HOME/.local/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` >> $GITHUB_PATH
  145. # TI MSP430 GCC
  146. echo >> $GITHUB_PATH `echo ~/cache/msp430-gcc/msp430-gcc-*/bin`
  147. - name: Build
  148. run: python3 tools/build_board.py ${{ matrix.example }}
  149. # Build ESP32S2
  150. build-esp32s2:
  151. runs-on: ubuntu-latest
  152. strategy:
  153. fail-fast: false
  154. matrix:
  155. board:
  156. # Alphabetical order
  157. - 'adafruit_feather_esp32s2'
  158. - 'adafruit_magtag_29gray'
  159. - 'adafruit_metro_esp32s2'
  160. - 'espressif_kaluga_1'
  161. - 'espressif_saola_1'
  162. steps:
  163. - name: Setup Python
  164. uses: actions/setup-python@v2
  165. - name: Pull ESP-IDF docker
  166. run: docker pull espressif/idf:latest
  167. - name: Checkout TinyUSB
  168. uses: actions/checkout@v2
  169. with:
  170. submodules: 'false'
  171. - name: Build
  172. run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32s2.py ${{ matrix.board }}