You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.4 KiB

  1. name: Build Examples with PlatformIO
  2. # Triggers the workflow on push or pull request events
  3. on: [push, pull_request]
  4. jobs:
  5. build:
  6. runs-on: ubuntu-latest
  7. if: "!contains(github.event.head_commit.message, 'ci skip')"
  8. strategy:
  9. matrix:
  10. example:
  11. [
  12. examples/BlynkClient,
  13. examples/FileDownload,
  14. examples/MqttClient,
  15. examples/WebClient,
  16. tools/test_build,
  17. tools/Diagnostics,
  18. ]
  19. modem:
  20. [
  21. TINY_GSM_MODEM_A6,
  22. TINY_GSM_MODEM_BG96,
  23. TINY_GSM_MODEM_ESP8266,
  24. TINY_GSM_MODEM_M95,
  25. TINY_GSM_MODEM_M590,
  26. TINY_GSM_MODEM_MC60,
  27. TINY_GSM_MODEM_SIM800,
  28. TINY_GSM_MODEM_SIM808,
  29. TINY_GSM_MODEM_SIM5360,
  30. TINY_GSM_MODEM_SIM7600,
  31. TINY_GSM_MODEM_SIM7000,
  32. TINY_GSM_MODEM_SIM7000SSL,
  33. TINY_GSM_MODEM_SIM7070,
  34. TINY_GSM_MODEM_UBLOX,
  35. TINY_GSM_MODEM_SARAR4,
  36. TINY_GSM_MODEM_XBEE,
  37. TINY_GSM_MODEM_SEQUANS_MONARCH,
  38. ]
  39. steps:
  40. - uses: actions/checkout@v3
  41. - name: Set variables
  42. run: |
  43. if [[ -z "${GITHUB_HEAD_REF}" ]]; then
  44. echo "::debug::Push to commit ${GITHUB_SHA}"
  45. echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_SHA}" >> $GITHUB_ENV
  46. else
  47. echo "::debug::Pull Request from the ${GITHUB_HEAD_REF} branch"
  48. echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_HEAD_REF}" >> $GITHUB_ENV
  49. fi
  50. - name: Set up Python
  51. uses: actions/setup-python@v4
  52. with:
  53. python-version: '3.x'
  54. # This should be pulled from cache, if there's not a new version
  55. - name: Install PlatformIO
  56. run: |
  57. python -m pip install --upgrade pip
  58. pip install --upgrade platformio
  59. - name: Restore or Cache Platforms and Libraries
  60. uses: actions/cache@v2.1.5
  61. id: cache_pio
  62. with:
  63. path: ~/.platformio
  64. # if nothing in the example_dependencies.json file has changed, then it will
  65. # be a "cache hit" and we can restore libraries from cache and not
  66. # download them. If it has changed we have to re-download.
  67. key: ${{ hashFiles('./examples/example_dependencies.json') }}
  68. # Install cores and library dependencies for the Arduino CLI, iff no cache
  69. - name: Install the Arduino libraries
  70. if: steps.cache_pio.outputs.cache-hit != 'true'
  71. run: pio lib --global install 89 415 1202 1286
  72. - name: Run PlatformIO
  73. env:
  74. PLATFORMIO_CI_SRC: ${{ matrix.example }}
  75. TINYGSM_MODEM_TO_USE: ${{ matrix.modem }}
  76. run: |
  77. echo "${{ env.LIBRARY_INSTALL_SOURCE }}"
  78. pio lib --global install ${{ env.LIBRARY_INSTALL_SOURCE }}
  79. sed -i 's/\/\/ #define TINY_GSM_MODEM_SIM800/#define TINY_GSM_MODEM_SIM800/g' ${{ matrix.example }}/*
  80. platformio ci --project-option='build_flags=-D ${{ env.TINYGSM_MODEM_TO_USE }}' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev
  81. pio lib --global uninstall TinyGSM