Skip to content

Commit

Permalink
add compile workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitshaoxiang committed Aug 11, 2023
1 parent 8276d8b commit 6f893ed
Show file tree
Hide file tree
Showing 11 changed files with 730 additions and 15 deletions.
115 changes: 115 additions & 0 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: 'Test compile for Arduino'
description: 'Compile sketches or Arduino library examples for one board type using arduino-cli and check for errors'
author: 'Armin Joachimsmeyer'
inputs:
cli-version:
description: 'Version of arduino-cli to use when building. Current (8/2022) one is 0.26.0.'
default: 'latest'
required: false

sketch-names:
description: 'Comma sepatated list of patterns or filenames (without path) of the sketch(es) to test compile. Useful if the sketch is a *.cpp or *.c file or only one sketch in the repository should be compiled.'
default: '*.ino'
required: false

sketch-names-find-start:
description: 'The start directory to look for the sketch-names to test compile. Can be a path like "digistump-avr/libraries/*/examples/C*/" .'
default: '.'
required: false

arduino-board-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
description: 'Fully Qualified Board Name of the Arduino board. You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace.'
default: 'arduino:avr:uno'
required: false

arduino-platform:
description: 'Comma separated list of platform specifiers, if you require a fixed version like "arduino:avr@1.8.2" or do not want the specifier derived from the 2 first elements of the arduino-board-fqbn or need more than one core. The suffix "@latest" is always removed.'
default: ''
required: false

platform-default-url:
description: 'The platform URL for the required board description if arduino-board-fqbn does not start with "arduino:" and not explicitly specified by platform-url.'
default: ''
required: false

platform-url:
description: 'The platform URL for the required board description if arduino-board-fqbn does not start with "arduino:".'
default: ''
required: false

required-libraries:
description: 'Comma separated list of arduino library names required for compiling the sketches / examples for this board.'
default: ''
required: false

sketches-exclude:
description: 'Comma or space separated list of complete names of all sketches / examples to be excluded in the build for this board.'
default: ''
required: false

build-properties:
description: |
Build parameter like -DDEBUG for each example specified or for all examples, if example name is "All". In json format.
For example: build-properties: '{ "WhistleSwitch": "-DDEBUG -DFREQUENCY_RANGE_LOW", "SimpleFrequencyDetector": "-DINFO" }'
default: ''
required: false

extra-arduino-cli-args:
description: |
This string is passed verbatim without double quotes to the arduino-cli compile commandline as last argument before the filename.
See https://arduino.github.io/arduino-cli/commands/arduino-cli_compile/ for compile parameters.
default: ''
required: false

extra-arduino-lib-install-args:
description: |
This string is passed verbatim without double quotes to the arduino-cli lib install commandline as last argument before the library names.
It can be used e.g. to suppress dependency resolving for libraries by using --no-deps as argument string.
default: ''
required: false

set-build-path:
description: 'Flag to set the build directory (arduino-cli paramer --build-path) to /build subdirectory of compiled sketches.'
default: 'false'
required: false

debug-compile:
description: 'If set to "true" the action logs verbose compile output even during successful builds'
default: ''
required: false

debug-install:
description: 'If set to "true" the action logs verbose arduino-cli output during installation'
default: ''
required: false

runs:
using: 'composite'
steps:
- name: Compile all sketches / examples using the bash script arduino-test-compile.sh
env:
# Passing parameters to the script by setting the appropriate ENV_* variables.
# Direct passing as arguments is not possible because of blanks in the arguments.
ENV_CLI_VERSION: ${{ inputs.cli-version }}
ENV_SKETCH_NAMES: ${{ inputs.sketch-names }}
ENV_SKETCH_NAMES_FIND_START: ${{ inputs.sketch-names-find-start }}
ENV_ARDUINO_BOARD_FQBN: ${{ inputs.arduino-board-fqbn }}
ENV_ARDUINO_PLATFORM: ${{ inputs.arduino-platform }}
ENV_PLATFORM_DEFAULT_URL: ${{ inputs.platform-default-url }}
ENV_PLATFORM_URL: ${{ inputs.platform-url }}
ENV_REQUIRED_LIBRARIES: ${{ inputs.required-libraries }}
ENV_SKETCHES_EXCLUDE: ${{ inputs.sketches-exclude }}
ENV_BUILD_PROPERTIES: ${{ inputs.build-properties }}
ENV_EXTRA_ARDUINO_CLI_ARGS: ${{ inputs.extra-arduino-cli-args }}
ENV_EXTRA_ARDUINO_LIB_INSTALL_ARGS: ${{ inputs.extra-arduino-lib-install-args }}
ENV_SET_BUILD_PATH: ${{ inputs.set-build-path }}
ENV_DEBUG_COMPILE: ${{ inputs.debug-compile }}
ENV_DEBUG_INSTALL: ${{ inputs.debug-install }}

run: ${{ github.action_path }}/arduino-test-compile.sh
shell: bash

branding:
icon: 'eye'
color: 'red'
Loading

0 comments on commit 6f893ed

Please sign in to comment.