# LibraryBuild.yml # Github workflow script to test compile all examples of an Arduino library repository. # # Copyright (C) 2020 Armin Joachimsmeyer # https://github.com/ArminJo/Github-Actions # License: MIT # # Before being able to push to my .github\workflows directories, # I had to create a new personal token with workflow enabled at https://github.com/settings/tokens # This is the name of the workflow, visible on GitHub UI. name: LibraryBuild on: push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request paths: - '**.ino' - '**.cpp' - '**.h' - '**LibraryBuild.yml' pull_request: jobs: build: name: ${{ matrix.arduino-boards-fqbn }} - test compiling examples runs-on: ubuntu-18.04 # I picked Ubuntu to use shell scripts. env: # Comma separated list without double quotes around the list. PLATFORM_DEFAULT_URL: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json REQUIRED_LIBRARIES: EspSoftwareSerial strategy: matrix: # The matrix will produce one job for each configuration parameter of type `arduino-boards-fqbn` # In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command # # Examples: arduino:avr:uno, arduino:avr:leonardo, arduino:avr:nano, arduino:avr:mega # arduino:sam:arduino_due_x, arduino:samd:arduino_zero_native" # ATTinyCore:avr:attinyx5:chip=85,clock=1internal, digistump:avr:digispark-tiny, digistump:avr:digispark-pro # STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 # esp8266:esp8266:huzzah:eesz=4M3M,xtal=80, esp32:esp32:featheresp32:FlashFreq=80 # You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace ############################################################################################################# arduino-boards-fqbn: - arduino:avr:uno - arduino:avr:leonardo - arduino:avr:mega - arduino:sam:arduino_due_x - SparkFun:apollo3:artemis - SparkFun:apollo3:amap3redboard - SparkFun:apollo3:amap3nano - SparkFun:apollo3:amap3atp - SparkFun:apollo3:amap3thing - SparkFun:apollo3:edge - SparkFun:apollo3:edge2 - esp8266:esp8266:huzzah:eesz=4M3M,xtal=80 - esp32:esp32:featheresp32:FlashFreq=80 - STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 # Choose the right platform for the boards we want to test. (maybe in the future Arduino will automatically do this for you). # This works like this: when the fqbn is "arduino:avr:uno" the variable `platform` is set to "arduino:avr". # Just take the first 2 token of the fqbn - this cannot be automatically done by GitHub workflow :-( # You may exclude specific examples for a board with examples-exclude: Use a space separated list. ############################################################################################################# include: - arduino-boards-fqbn: arduino:sam:arduino_due_x examples-exclude: Example5_LCDDemo # No SoftwareSerial available. Space separated list of (unique substrings of) example names to exclude in build - arduino-boards-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80 platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json - arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80 platform-url: https://dl.espressif.com/dl/package_esp32_index.json - arduino-boards-fqbn: STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/dev/STM32/package_stm_index.json # Do not cancel all jobs / architectures if one job fails fail-fast: false # This is the list of steps this job will run. steps: # First of all, we clone the repo using the `checkout` action. - name: Checkout uses: actions/checkout@v2 - name: Compile all examples uses: ArminJo/arduino-test-compile@v2 with: required-libraries: ${{ env.REQUIRED_LIBRARIES }} arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }} platform-default-url: ${{ env.PLATFORM_DEFAULT_URL }} platform-url: ${{ matrix.platform-url }} examples-exclude: ${{ matrix.examples-exclude }}