main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. # This is the name of the workflow, visible on GitHub UI.
  2. name: TaskScheduler Examples Build
  3. # Controls when the action will run.
  4. on:
  5. # Triggers the workflow on push or pull request only for the main branch
  6. push:
  7. branches: [ master, main ]
  8. paths:
  9. - 'examples/**'
  10. - 'src/**'
  11. - 'tests/**'
  12. pull_request:
  13. branches: [ master, main ]
  14. paths:
  15. - 'examples/**'
  16. - 'src/**'
  17. - 'tests/**'
  18. workflow_dispatch:
  19. # This is the list of jobs that will be run concurrently.
  20. # Since we use a build matrix, the actual number of jobs
  21. # started depends on how many configurations the matrix
  22. # will produce.
  23. jobs:
  24. # This is the name of the job - can be whatever.
  25. ArduinoIDE_AVR:
  26. # Here we tell GitHub that the jobs must be determined
  27. # dynamically depending on a matrix configuration.
  28. strategy:
  29. matrix:
  30. # The matrix will produce one job for each configuration
  31. # parameter of type `arduino-platform`, in this case, it
  32. # is only 1.
  33. arduino-platform: ["arduino:avr"]
  34. # This is usually optional but we need to statically define the
  35. # FQBN of the boards we want to test for each platform. In the
  36. # future the CLI might automatically detect and download the
  37. # core needed to compile against a certain FQBN, at that point
  38. # the following `include` section will be useless.
  39. fqbn: ["arduino:avr:uno"]
  40. example:
  41. - "Scheduler_example00_Blink"
  42. - "Scheduler_example00_Blink_Namespace"
  43. - "Scheduler_example01"
  44. - "Scheduler_example02"
  45. - "Scheduler_example03"
  46. - "Scheduler_example04_StatusRequest"
  47. - "Scheduler_example05_StatusRequest"
  48. - "Scheduler_example06_IDLE"
  49. - "Scheduler_example07_WDT"
  50. - "Scheduler_example08_LTS"
  51. - "Scheduler_example09_TimeCritical"
  52. - "Scheduler_example10_Benchmark"
  53. - "Scheduler_example11_Priority"
  54. - "Scheduler_example12_Priority"
  55. - "Scheduler_example13_Micros"
  56. - "Scheduler_example16_Multitab"
  57. - "Scheduler_example17_Timeout"
  58. - "Scheduler_example18_StatusRequest_LTS_WDT_Timeout"
  59. - "Scheduler_example19_Dynamic_Tasks"
  60. - "Scheduler_example19_Dynamic_Tasks_SelfDestruct"
  61. - "Scheduler_example20_StatusRequest_LTS_WDT_Timeout_Object"
  62. - "Scheduler_example21_OO_Callbacks"
  63. - "Scheduler_example23_IDLE_Callback"
  64. - "Scheduler_example24_CPU_LOAD"
  65. - "Scheduler_example25_SCHEDULER_CHAIN"
  66. - "Scheduler_example26_SCHEDULING_OPTIONS"
  67. - "Scheduler_example28_Tickless"
  68. # This is the platform GitHub will use to run our workflow,
  69. # I picked ubuntu.
  70. runs-on: ubuntu-latest
  71. # This is the list of steps this job will run.
  72. steps:
  73. # First of all, we clone the repo using the `checkout` action.
  74. - name: Checkout
  75. uses: actions/checkout@main
  76. # We use the `arduino/setup-arduino-cli` action to install and
  77. # configure the Arduino CLI on the system.
  78. - name: Setup Arduino CLI
  79. uses: arduino/setup-arduino-cli@v1.1.1
  80. # We then install the platform, which one will be determined
  81. # dynamically by the build matrix.
  82. - name: Install platform
  83. run: |
  84. arduino-cli core update-index
  85. arduino-cli core install ${{ matrix.arduino-platform }}
  86. - name: Install repo as library
  87. run: |
  88. mkdir -p "$HOME/Arduino/libraries"
  89. ln -s "$PWD" "$HOME/Arduino/libraries/."
  90. - name: Install required libraries
  91. run: |
  92. mkdir -p "$HOME/Arduino/libraries"
  93. # Install QueueArray from Arduino Playground
  94. wget -O queuearray.zip https://playground.arduino.cc/uploads/Code/QueueArray/index.zip
  95. unzip queuearray.zip -d "$HOME/Arduino/libraries/"
  96. # Install MemoryFree library from Arduino Library Manager
  97. git clone https://github.com/McNeight/MemoryFree.git
  98. cp -r MemoryFree "$HOME/Arduino/libraries/"
  99. # Finally, we compile the sketch, using the FQBN that was set
  100. # in the build matrix.
  101. - name: Compile ${{ matrix.example }}
  102. run: arduino-cli compile --fqbn ${{ matrix.fqbn }} ./examples/${{ matrix.example }} --warnings more
  103. ArduinoIDE_ESP32:
  104. strategy:
  105. matrix:
  106. arduino-platform: ["esp32:esp32"]
  107. fqbn: ["esp32:esp32:esp32"]
  108. example:
  109. - "Scheduler_example00_Blink"
  110. - "Scheduler_example00_Blink_Namespace"
  111. - "Scheduler_example01"
  112. - "Scheduler_example02"
  113. - "Scheduler_example03"
  114. - "Scheduler_example04_StatusRequest"
  115. - "Scheduler_example05_StatusRequest"
  116. - "Scheduler_example06_IDLE"
  117. - "Scheduler_example08_LTS"
  118. - "Scheduler_example09_TimeCritical"
  119. - "Scheduler_example10_Benchmark"
  120. - "Scheduler_example11_Priority"
  121. - "Scheduler_example12_Priority"
  122. - "Scheduler_example13_Micros"
  123. - "Scheduler_example15_STDFunction"
  124. - "Scheduler_example16_Multitab"
  125. - "Scheduler_example17_Timeout"
  126. - "Scheduler_example18_StatusRequest_LTS_WDT_Timeout"
  127. - "Scheduler_example19_Dynamic_Tasks"
  128. - "Scheduler_example19_Dynamic_Tasks_SelfDestruct"
  129. - "Scheduler_example19_Dynamic_Tasks_stdQueue"
  130. - "Scheduler_example20_StatusRequest_LTS_WDT_Timeout_Object"
  131. - "Scheduler_example21_OO_Callbacks"
  132. - "Scheduler_example23_IDLE_Callback"
  133. - "Scheduler_example24_CPU_LOAD"
  134. - "Scheduler_example25_SCHEDULER_CHAIN"
  135. - "Scheduler_example26_SCHEDULING_OPTIONS"
  136. - "Scheduler_example28_Tickless"
  137. runs-on: ubuntu-latest
  138. steps:
  139. - name: Checkout
  140. uses: actions/checkout@main
  141. - name: Setup Arduino CLI
  142. uses: arduino/setup-arduino-cli@v1.1.1
  143. - name: Install platform
  144. run: |
  145. arduino-cli core update-index
  146. arduino-cli core install ${{ matrix.arduino-platform }}
  147. - name: Install repo as library
  148. run: |
  149. mkdir -p "$HOME/Arduino/libraries"
  150. ln -s "$PWD" "$HOME/Arduino/libraries/."
  151. - name: Install required libraries
  152. run: |
  153. mkdir -p "$HOME/Arduino/libraries"
  154. # Install QueueArray from Arduino Playground
  155. wget -O queuearray.zip https://playground.arduino.cc/uploads/Code/QueueArray/index.zip
  156. unzip queuearray.zip -d "$HOME/Arduino/libraries/"
  157. # Install MemoryFree library from Arduino Library Manager
  158. git clone https://github.com/McNeight/MemoryFree.git
  159. cp -r MemoryFree "$HOME/Arduino/libraries/"
  160. - name: Compile ${{ matrix.example }}
  161. run: arduino-cli compile --fqbn ${{ matrix.fqbn }} ./examples/${{ matrix.example }} --warnings more
  162. ArduinoIDE_ESP8266_ONLY:
  163. strategy:
  164. matrix:
  165. arduino-platform: ["esp8266:esp8266"]
  166. fqbn: ["esp8266:esp8266:nodemcuv2"]
  167. example:
  168. - "Scheduler_example14_Yield"
  169. runs-on: ubuntu-latest
  170. steps:
  171. - name: Checkout
  172. uses: actions/checkout@main
  173. - name: Setup Arduino CLI
  174. uses: arduino/setup-arduino-cli@v1.1.1
  175. - name: Install platform
  176. run: |
  177. arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
  178. arduino-cli core install ${{ matrix.arduino-platform }} --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
  179. - name: Install repo as library
  180. run: |
  181. mkdir -p "$HOME/Arduino/libraries"
  182. ln -s "$PWD" "$HOME/Arduino/libraries/."
  183. - name: Compile ${{ matrix.example }}
  184. run: arduino-cli compile --fqbn ${{ matrix.fqbn }} ./examples/${{ matrix.example }} --warnings more
  185. ArduinoIDE_STM32:
  186. strategy:
  187. matrix:
  188. arduino-platform: ["STMicroelectronics:stm32"]
  189. fqbn: ["STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F401RE"]
  190. example:
  191. - "Scheduler_example00_Blink"
  192. - "Scheduler_example00_Blink_Namespace"
  193. - "Scheduler_example01"
  194. - "Scheduler_example02"
  195. - "Scheduler_example03"
  196. - "Scheduler_example04_StatusRequest"
  197. - "Scheduler_example05_StatusRequest"
  198. - "Scheduler_example06_IDLE"
  199. - "Scheduler_example08_LTS"
  200. - "Scheduler_example09_TimeCritical"
  201. - "Scheduler_example10_Benchmark"
  202. - "Scheduler_example11_Priority"
  203. - "Scheduler_example12_Priority"
  204. - "Scheduler_example13_Micros"
  205. - "Scheduler_example15_STDFunction"
  206. - "Scheduler_example16_Multitab"
  207. - "Scheduler_example17_Timeout"
  208. - "Scheduler_example18_StatusRequest_LTS_WDT_Timeout"
  209. - "Scheduler_example19_Dynamic_Tasks"
  210. - "Scheduler_example19_Dynamic_Tasks_SelfDestruct"
  211. - "Scheduler_example19_Dynamic_Tasks_stdQueue"
  212. - "Scheduler_example20_StatusRequest_LTS_WDT_Timeout_Object"
  213. - "Scheduler_example21_OO_Callbacks"
  214. - "Scheduler_example23_IDLE_Callback"
  215. - "Scheduler_example24_CPU_LOAD"
  216. - "Scheduler_example25_SCHEDULER_CHAIN"
  217. - "Scheduler_example26_SCHEDULING_OPTIONS"
  218. - "Scheduler_example28_Tickless"
  219. runs-on: ubuntu-latest
  220. steps:
  221. - name: Checkout
  222. uses: actions/checkout@main
  223. - name: Setup Arduino CLI
  224. uses: arduino/setup-arduino-cli@v1.1.1
  225. - name: Install platform
  226. run: |
  227. arduino-cli core update-index --additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
  228. arduino-cli core install ${{ matrix.arduino-platform }} --additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
  229. - name: Install repo as library
  230. run: |
  231. mkdir -p "$HOME/Arduino/libraries"
  232. ln -s "$PWD" "$HOME/Arduino/libraries/."
  233. - name: Install required libraries
  234. run: |
  235. mkdir -p "$HOME/Arduino/libraries"
  236. # Install QueueArray from Arduino Playground
  237. wget -O queuearray.zip https://playground.arduino.cc/uploads/Code/QueueArray/index.zip
  238. unzip queuearray.zip -d "$HOME/Arduino/libraries/"
  239. # Install MemoryFree library from GitHub
  240. git clone https://github.com/McNeight/MemoryFree.git
  241. cp -r MemoryFree "$HOME/Arduino/libraries/"
  242. - name: Compile ${{ matrix.example }}
  243. run: arduino-cli compile --fqbn ${{ matrix.fqbn }} ./examples/${{ matrix.example }} --warnings more
  244. PIO:
  245. strategy:
  246. matrix:
  247. example:
  248. - "Scheduler_example27_PlatformIO"
  249. - "Scheduler_example29_NonArduino"
  250. - "Scheduler_example30_THREAD_SAFE"
  251. environment:
  252. - "esp32dev"
  253. include:
  254. - example: "Scheduler_example27_PlatformIO"
  255. environment: "esp32dev"
  256. - example: "Scheduler_example29_NonArduino"
  257. environment: "esp32dev"
  258. runs-on: ubuntu-latest
  259. steps:
  260. - name: Checkout
  261. uses: actions/checkout@main
  262. - name: Set up Python
  263. uses: actions/setup-python@v4
  264. with:
  265. python-version: '3.x'
  266. - name: Install PlatformIO
  267. run: |
  268. python -m pip install --upgrade pip
  269. pip install platformio
  270. - name: Setup libraries for PlatformIO
  271. run: |
  272. cd examples/${{ matrix.example }}
  273. # Remove any existing lib_deps from platformio.ini that reference TaskScheduler
  274. sed -i '/arkhipenko\/TaskScheduler/d' platformio.ini || true
  275. sed -i '/TaskScheduler/d' platformio.ini || true
  276. # Clone the current branch/commit to get TaskScheduler source
  277. mkdir -p lib
  278. git clone --depth 1 --branch ${GITHUB_REF#refs/heads/} https://github.com/${GITHUB_REPOSITORY}.git lib/TaskScheduler
  279. # Install other required libraries
  280. wget -O queuearray.zip https://playground.arduino.cc/uploads/Code/QueueArray/index.zip
  281. unzip queuearray.zip -d lib/
  282. git clone https://github.com/McNeight/MemoryFree.git
  283. cp -r MemoryFree lib/
  284. # Verify library installation
  285. ls -la lib/
  286. - name: Compile ${{ matrix.example }}
  287. run: |
  288. cd examples/${{ matrix.example }}
  289. pio run -e ${{ matrix.environment }}