Skip to content

Commit

Permalink
sketch-name test
Browse files Browse the repository at this point in the history
  • Loading branch information
ArminJo committed Mar 21, 2020
1 parent b70ebf0 commit 87d3986
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# ActionTest.yml
# Github workflow script for testing the arduino-compile-examples action development.
# arduino-test-compile-Test.yml
# Github workflow script for testing the arduino-test-compile action development.
#
# Copyright (C) 2020 Armin Joachimsmeyer
# https://github.com/ArminJo/Github-Actions
# License: MIT
#

# This is the name of the workflow, visible on GitHub UI.
name: ActionTest
name: arduino-test-compile-Test
on:
push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
paths:
- '**.sh'
- '**.yml'
- '**arduino-test-compile-Test.yml'

jobs:
build:
Expand All @@ -24,6 +24,7 @@ jobs:
# Space separated list without double quotes around the list.
# If you need a library with a space in its name, like Adafruit NeoPixel or Adafruit INA219, you must use double quotes
# around the name and have at least 2 entries, where the first must be without double quotes! You may use Servo as dummy entry.
#############################################################################################################
REQUIRED_LIBRARIES: Servo "Adafruit NeoPixel"
# CLI_VERSION: latest

Expand All @@ -45,6 +46,7 @@ jobs:
# - digistump:avr:digispark-tiny1
# - ATTinyCore:avr:attinyx5:chip=85,clock=1internal
- esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
- esp32:esp32:featheresp32:FlashFreq=80

# Specify parameters for each board.
# Parameters can be: examples-exclude and examples-build-properties
Expand All @@ -59,7 +61,7 @@ jobs:
SimpleFrequencyDetector:
-DINFO

- arduino-boards-fqbn: arduino:avr:uno|trace
- arduino-boards-fqbn: arduino:avr:uno|trace # UNO board with different build properties
examples-exclude: 50Hz # Space separated list of (unique substrings of) example names to exclude in build
examples-build-properties:
WhistleSwitch:
Expand All @@ -81,24 +83,20 @@ jobs:
platform-url: http://arduino.esp8266.com/stable/package_esp8266com_index.json
examples-exclude: WhistleSwitch 50Hz SimpleFrequencyDetector

######################################################
# End of configuration, start of fixed script section
######################################################
- arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80
platform-url: https://dl.espressif.com/dl/package_esp32_index.json
examples-exclude: WhistleSwitch 50Hz SimpleFrequencyDetector

# 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@master


# Test the action of this repository
# Test of the arduino-test-compile action
- name: Compile all examples
uses: ./ # Uses an action in the root directory
uses: ArminJo/arduino-test-compile@master
with:
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
platform-url: ${{ matrix.platform-url }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:latest

# Install wget
RUN apt-get update --quiet=2 && apt-get install --quiet=2 --assume-yes wget
RUN apt-get update --quiet=2 > /dev/null && apt-get install --quiet=2 --assume-yes wget > /dev/null
CMD /bin/bash

# Copies your code file from your action repository to the filesystem path `/` of the container
Expand Down
95 changes: 70 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,57 @@
# arduino-compile-examples action
# arduino-test-compile action

This action uses the arduino-cli to compiles all of the examples contained in the library.
This action does a test-compile of one or more [Arduino programs](https://github.com/ArminJo/Arduino-Simple-DSO/actions) in a repository each with different compile parameters.<br/>
It can be used e.g. to test-compile all examples contained in an [Arduino library repository](https://github.com/ArminJo/NeoPatterns/actions).<br/>
It uses the [arduino-cli program](https://github.com/arduino/arduino-cli) for compiling.<br/>
It is not required, that the sketch resides in a directory with the same name (as Arduino IDE requires it). The appropriate directory is then created on the fly before test-compiling.

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html)

[![Build Status](https://github.com/ArminJo/Github-Actions/workflows/arduino-test-compile-Test/badge.svg)](https://github.com/ArminJo/Github-Actions/actions)

# Inputs
See action.yml for comprehensive list of parameters.
See [action.yml](https://github.com/ArminJo/arduino-test-compile/blob/master/action.yml) for comprehensive list of parameters.

### `cli-version`
The version of `arduino-cli` to use. Default `latest`.
The version of `arduino-cli` to use.<br/>
Default `latest`.

```yaml
cli-version: 0.9.0 # The current one (3/2020)
```
### `sketch-name`
Pattern or filename 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.<br/>
Default `*.ino`.

```yaml
sketch-name: SimpleTouchScreenDSO.cpp
```
if the sketch is not contained in a directory with the same name as the sketch, such a directory will be created and the content of the sketch directory will be recursively copied to it. This is required by the arduino-cli to successful compile a sketch.

### `arduino-board-fqbn`
The fully qualified board name to use when compiling. Default `arduino:avr:uno`.<br/>
For 3rd party boards, you must also specify the Boards Manager URL `platform-url:`.
The fully qualified board name to use when compiling.<br/>
Default `arduino:avr:uno`.<br/>

```yaml
arduino-board-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
```
**For 3rd party boards**, you must also specify the Boards Manager URL `platform-url:`.

### `platform-url`
Required for 3rd party boards.<br/>
Required for 3rd party boards.

```yaml
arduino-board-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
```

Sample URL's are:
- http://drazzy.com/package_drazzy.com_index.json
- http://digistump.com/package_digistump_index.json
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
- https://dl.espressif.com/dl/package_esp32_index.json
- https://github.com/stm32duino/BoardManagerFiles/raw/dev/STM32/package_stm_index.json
- https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
- https://files.pololu.com/arduino/package_pololu_index.json
- http://drazzy.com/package_drazzy.com_index.json - for ATTiny boards
- http://digistump.com/package_digistump_index.json - for Digispark boards
- http://arduino.esp8266.com/stable/package_esp8266com_index.json - for ESP8266 based boards
- https://dl.espressif.com/dl/package_esp32_index.json - for ESP32 based boards
- https://github.com/stm32duino/BoardManagerFiles/raw/dev/STM32/package_stm_index.json - for STM32 boards
- https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json - for Sparkfun boards, esp. Apollo3 boards
- https://files.pololu.com/arduino/package_pololu_index.json - for Pololu boards, esp. ATMega328PB boards

```yaml
platform-url: http://arduino.esp8266.com/stable/package_esp8266com_index.json
Expand All @@ -34,6 +61,10 @@ platform-url: http://arduino.esp8266.com/stable/package_esp8266com_index.json
List of library dependencies to install. Default `""`.
Space separated list without double quotes around the list. If you need a library with a space in its name, like Adafruit NeoPixel or Adafruit INA219, you must use double quotes around the name and have at least 2 entries, where the first must be without double quotes! You may use Servo as dummy entry.

```yaml
libraries: Servo "Adafruit NeoPixel"
```

#### `examples-exclude`
Examples to be **excluded from build**. Space separated list of (unique substrings of) example names to exclude in build.

Expand All @@ -44,12 +75,16 @@ Examples to be **excluded from build**. Space separated list of (unique substrin
#### `examples-build-properties`
Build parameter like `-DDEBUG` for each example

```yaml
examples-build-properties: QuadrupedControl RobotArmControl # QuadrupedControl and RobotArmControl because of missing EEprom
```

# Workflows examples
## Simple - without any input
Compile all examples for the UNO board.

```yaml
name: LibraryBuild
name: SimpleLibraryBuild
on: push
jobs:
build:
Expand All @@ -58,10 +93,10 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Compile all examples
uses: ArminJo/arduino-compile-examples@master
uses: actions/arduino-test-compile@master
```

## One board with parameter
## One ESP8266 board with parameter
```yaml
name: LibraryBuild
on: [push, pull_request]
Expand All @@ -75,7 +110,7 @@ jobs:
uses: actions/checkout@master
- name: Compile all examples
uses: ArminJo/arduino-compile-examples@master
uses: actions/arduino-test-compile@master
with:
arduino-board-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
platform-url: http://arduino.esp8266.com/stable/package_esp8266com_index.json
Expand All @@ -91,6 +126,8 @@ jobs:
build:
name: ${{ matrix.arduino-boards-fqbn }} - test compiling examples
runs-on: ubuntu-latest
env:
REQUIRED_LIBRARIES: Servo "Adafruit NeoPixel"
strategy:
matrix:
arduino-boards-fqbn:
Expand All @@ -101,16 +138,15 @@ jobs:
include:
- arduino-boards-fqbn: arduino:avr:uno
examples-exclude: 50Hz # Space separated list of (unique substrings of) example names to exclude in build
SimpleFrequencyDetector: -DDEBUG
WhistleSwitch: -DINFO
examples-build-properties:
WhistleSwitch:
-DDEBUG
-DFREQUENCY_RANGE_LOW
SimpleFrequencyDetector:
-DINFO
- arduino-boards-fqbn: arduino:avr:uno|trace
- arduino-boards-fqbn: arduino:avr:uno|trace # UNO board with different build properties
examples-exclude: 50Hz # Space separated list of (unique substrings of) example names to exclude in build
SimpleFrequencyDetector: -DTRACE
WhistleSwitch: -DTRACE
examples-build-properties:
WhistleSwitch:
-DDEBUG
Expand All @@ -127,11 +163,20 @@ jobs:
uses: actions/checkout@master
- name: Compile all examples
uses: actions/arduino-compile-examples@master
uses: actions/arduino-test-compile@master
with:
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
platform-url: ${{ matrix.platform-url }}
libraries: ${{ env.REQUIRED_LIBRARIES }}
examples-exclude: ${{ matrix.examples-exclude }}
examples-build-properties: ${{ toJson(matrix.examples-build-properties) }}
```

# Revision History
### Version 1.0.0
- Initial tested version

## Requests for modifications / extensions
Please write me a PM including your motivation/problem if you need a modification or an extension.

#### If you find this library useful, please give it a star.
27 changes: 19 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
name: 'arduino-compile-examples'
description: 'Compile all examples of an Arduino library for one board and check for errors'
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 builing. Current one is 0.9.0'
description: 'Version of arduino-cli to use when builing. Current (3/2020) one is 0.9.0.'
default: 'latest'
required: false

sketch-name:
description: 'Pattern or filename 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

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'
description: 'Fully Qualified Board Name of the Arduino board.'
default: 'arduino:avr:uno'
required: false

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

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

examples-exclude:
description: 'List of significant prefixes of all examples to be excluded in the build for this board'
description: 'List of significant prefixes of all examples to be excluded in the build for this board.'
default: ''
required: false

Expand All @@ -34,18 +39,24 @@ inputs:
For example { "WhistleSwitch": "-DDEBUG -DFREQUENCY_RANGE_LOW", "SimpleFrequencyDetector": "-DINFO" }
default: ''
required: false


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

runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.cli-version }}
- ${{ inputs.sketch-name }}
- ${{ inputs.arduino-board-fqbn }}
- ${{ inputs.platform-url }}
- ${{ inputs.libraries }}
- ${{ inputs.examples-exclude }}
- ${{ inputs.examples-build-properties }}
- ${{ inputs.debug }}

branding:
icon: 'eye'
Expand Down
Loading

0 comments on commit 87d3986

Please sign in to comment.