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