main.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. name: CI
  2. on:
  3. schedule:
  4. - cron: '0 0 * * 5'
  5. push:
  6. branches: [ master ]
  7. pull_request:
  8. branches: [ master ]
  9. release:
  10. types: [ published, created, edited ]
  11. # Allows you to run this workflow manually from the Actions tab
  12. workflow_dispatch:
  13. # A workflow run is made up of one or more jobs that can run sequentially or in parallel
  14. jobs:
  15. check_version_files:
  16. runs-on: ubuntu-latest
  17. steps:
  18. - uses: actions/checkout@v2
  19. - name: check version
  20. run: |
  21. $GITHUB_WORKSPACE/travis/version.py --check
  22. prepare_example_json:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - uses: actions/checkout@v2
  26. - name: generate examples
  27. id: set-matrix
  28. run: |
  29. source $GITHUB_WORKSPACE/travis/common.sh
  30. cd $GITHUB_WORKSPACE
  31. echo -en "::set-output name=matrix::"
  32. echo -en "["
  33. get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266 esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,dbg=Serial1
  34. echo -en ","
  35. get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266 esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,eesz=1M,FlashMode=qio,FlashFreq=80
  36. echo -en ","
  37. get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp32 esp32 1.8.19 espressif:esp32:esp32:FlashFreq=80
  38. echo -en "]"
  39. outputs:
  40. matrix: ${{ steps.set-matrix.outputs.matrix }}
  41. prepare_ide:
  42. runs-on: ubuntu-latest
  43. strategy:
  44. fail-fast: false
  45. matrix:
  46. IDE_VERSION: [1.8.19]
  47. env:
  48. IDE_VERSION: ${{ matrix.IDE_VERSION }}
  49. steps:
  50. - uses: actions/checkout@v2
  51. - name: Get Date
  52. id: get-date
  53. run: |
  54. echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
  55. shell: bash
  56. - uses: actions/cache@v2
  57. id: cache_all
  58. with:
  59. path: |
  60. /home/runner/arduino_ide
  61. /home/runner/Arduino
  62. key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ matrix.IDE_VERSION }}
  63. - name: download IDE
  64. if: steps.cache_all.outputs.cache-hit != 'true'
  65. run: |
  66. wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz -q
  67. tar xf arduino-$IDE_VERSION-linux64.tar.xz
  68. mv arduino-$IDE_VERSION $HOME/arduino_ide
  69. - name: download ArduinoJson
  70. if: steps.cache_all.outputs.cache-hit != 'true'
  71. run: |
  72. mkdir -p $HOME/Arduino/libraries
  73. wget https://github.com/bblanchon/ArduinoJson/archive/6.x.zip -q
  74. unzip 6.x.zip
  75. mv ArduinoJson-6.x $HOME/Arduino/libraries/ArduinoJson
  76. - name: download esp8266
  77. if: steps.cache_all.outputs.cache-hit != 'true'
  78. run: |
  79. source $GITHUB_WORKSPACE/travis/common.sh
  80. get_core esp8266
  81. - name: download esp32
  82. if: steps.cache_all.outputs.cache-hit != 'true'
  83. run: |
  84. source $GITHUB_WORKSPACE/travis/common.sh
  85. get_core esp32
  86. build:
  87. needs: [prepare_ide, prepare_example_json]
  88. runs-on: ubuntu-latest
  89. strategy:
  90. fail-fast: false
  91. matrix:
  92. include: ${{ fromJson(needs.prepare_example_json.outputs.matrix) }}
  93. env:
  94. CPU: ${{ matrix.cpu }}
  95. BOARD: ${{ matrix.board }}
  96. IDE_VERSION: ${{ matrix.ideversion }}
  97. SKETCH: ${{ matrix.sketch }}
  98. # Steps represent a sequence of tasks that will be executed as part of the job
  99. steps:
  100. - uses: actions/checkout@v2
  101. - name: install libgtk2.0-0
  102. run: |
  103. sudo apt-get install -y libgtk2.0-0
  104. - name: Get Date
  105. id: get-date
  106. run: |
  107. echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
  108. shell: bash
  109. - uses: actions/cache@v2
  110. id: cache_all
  111. with:
  112. path: |
  113. /home/runner/arduino_ide
  114. /home/runner/Arduino
  115. key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ matrix.ideversion }}
  116. - name: install python serial
  117. if: matrix.cpu == 'esp32'
  118. run: |
  119. sudo pip3 install pyserial
  120. sudo pip install pyserial
  121. # sudo apt install python-is-python3
  122. - name: start DISPLAY
  123. run: |
  124. /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
  125. export DISPLAY=:1.0
  126. sleep 3
  127. - name: test IDE
  128. run: |
  129. export PATH="$HOME/arduino_ide:$PATH"
  130. which arduino
  131. - name: copy code
  132. run: |
  133. mkdir -p $HOME/Arduino/libraries/
  134. cp -r $GITHUB_WORKSPACE $HOME/Arduino/libraries/arduinoWebSockets
  135. - name: config IDE
  136. run: |
  137. export DISPLAY=:1.0
  138. export PATH="$HOME/arduino_ide:$PATH"
  139. arduino --board $BOARD --save-prefs
  140. arduino --get-pref sketchbook.path
  141. arduino --pref update.check=false
  142. - name: build example
  143. timeout-minutes: 20
  144. run: |
  145. set -ex
  146. export DISPLAY=:1.0
  147. export PATH="$HOME/arduino_ide:$PATH"
  148. source $GITHUB_WORKSPACE/travis/common.sh
  149. cd $GITHUB_WORKSPACE
  150. build_sketch arduino $SKETCH
  151. done:
  152. needs: [prepare_ide, prepare_example_json, build, check_version_files]
  153. runs-on: ubuntu-latest
  154. steps:
  155. - name: Done
  156. run: |
  157. echo DONE