|
| 1 | +name: Github Actions CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - staging/erriez/* |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + schedule: |
| 12 | + # */2: even, */4: every 4 |
| 13 | + # +--------------> minute (0 - 59) |
| 14 | + # | +------------> hour (0 - 23) |
| 15 | + # | | +----------> day of the month (1 - 31) |
| 16 | + # | | | +--------> month (1 - 12) |
| 17 | + # | | | | +------> day of the week (0 - 6) |
| 18 | + # | | | | | |
| 19 | + - cron: "0 0 1 */4 *" |
| 20 | + # Run this workflow manually from the Actions tab |
| 21 | + workflow_dispatch: |
| 22 | + |
| 23 | +env: |
| 24 | + # To use repository name: ${{ github.event.repository.name }} |
| 25 | + PDF_NAME: ${{ github.event.repository.name }} |
| 26 | + |
| 27 | +jobs: |
| 28 | + build: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + examples: [ |
| 33 | + examples/ErriezMHZ19B7SegmentDisplay/ErriezMHZ19B7SegmentDisplay.ino, |
| 34 | + examples/ErriezMHZ19BGettingStarted/ErriezMHZ19BGettingStarted.ino, |
| 35 | + examples/ErriezMHZ19BSerialPlottter/ErriezMHZ19BSerialPlottter.ino, |
| 36 | + examples/ErriezMHZ19BESP8266MQTT/ErriezMHZ19BESP8266MQTT.ino |
| 37 | + ] |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + |
| 42 | + - uses: actions/cache@v3 |
| 43 | + with: |
| 44 | + path: | |
| 45 | + ~/.cache/pip |
| 46 | + ~/.platformio/.cache |
| 47 | + key: ${{ runner.os }}-pio |
| 48 | + |
| 49 | + - uses: actions/setup-python@v4 |
| 50 | + with: |
| 51 | + python-version: '3.9' |
| 52 | + |
| 53 | + - name: Install PlatformIO Core |
| 54 | + run: pip install --upgrade platformio |
| 55 | + |
| 56 | + - name: Install library dependencies |
| 57 | + run: | |
| 58 | + pio pkg install --global --library https://github.com/Erriez/ErriezTM1637 |
| 59 | + pio pkg install --global --library https://github.com/Erriez/ErriezRobotDyn4DigitDisplay |
| 60 | + pio pkg install --global --library https://github.com/knolleary/pubsubclient |
| 61 | +
|
| 62 | + echo "Install ESPSoftwareSerial into framework-arduinoespressif32 to prevent conflicts with generic name SoftwareSerial" |
| 63 | + mkdir -p ~/.platformio/packages/framework-arduinoespressif32/libraries |
| 64 | + platformio lib --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries install "EspSoftwareSerial@6.16.1" |
| 65 | + # Cannot upgrade to pio pkg install command: https://github.com/platformio/platformio-core/issues/4410 |
| 66 | + #pio pkg install --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries --library "EspSoftwareSerial@6.16.1" |
| 67 | +
|
| 68 | + - name: Build PlatformIO examples Arduino |
| 69 | + run: | |
| 70 | + # Use option -O "lib_ldf_mode=chain+" to parse defines |
| 71 | + pio ci -O "lib_ldf_mode=chain+" --lib="." --board=uno --board micro --board pro16MHzatmega328 --board pro8MHzatmega328 --board megaatmega2560 --board leonardo --board due --board nodemcuv2 --board lolin_d32 |
| 72 | + env: |
| 73 | + PLATFORMIO_CI_SRC: ${{ matrix.examples }} |
| 74 | + |
| 75 | + doxygen: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - name: Checkout repository |
| 79 | + uses: actions/checkout@v3 |
| 80 | + with: |
| 81 | + submodules: "true" |
| 82 | + |
| 83 | + - name: Install Doxygen |
| 84 | + run: sudo apt-get install doxygen graphviz -y |
| 85 | + shell: bash |
| 86 | + |
| 87 | + - name: Generate Doxygen HTML |
| 88 | + run: doxygen Doxyfile |
| 89 | + shell: bash |
| 90 | + |
| 91 | + - name: Create .nojekyll (ensures pages with underscores work on gh pages) |
| 92 | + run: touch docs/html/.nojekyll |
| 93 | + shell: bash |
| 94 | + |
| 95 | + - name: Generate Doxygen PDF |
| 96 | + if: ${{ github.ref == 'refs/heads/master' }} |
| 97 | + run: | |
| 98 | + sudo apt-get install texlive-latex-recommended texlive-pictures texlive-latex-extra -y |
| 99 | + make -C docs/latex |
| 100 | + cp docs/latex/refman.pdf docs/html/$PDF_NAME.pdf |
| 101 | + shell: bash |
| 102 | + |
| 103 | + - name: Deploy to GitHub branch gh-pages |
| 104 | + if: ${{ github.ref == 'refs/heads/master' }} |
| 105 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 106 | + with: |
| 107 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 108 | + branch: gh-pages |
| 109 | + folder: docs/html |
| 110 | + |
0 commit comments