Skip to content

Use GitHub Actions for CI #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Compile Examples

on:
pull_request:
paths:
- ".github/workflows/compile-examples.yml"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/compile-examples.yml"
- "examples/**"
- "src/**"
schedule:
# run every Tuesday at 3 AM UTC to catch breakage caused by changes to external dependencies (libraries, platforms)
- cron: "0 3 * * 2"
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

env:
SKETCHES_REPORTS_PATH: sketches-reports
# Libraries to install for all boards
UNIVERSAL_LIBRARIES: |
# Install the ArduinoModbus library from the local path
- source-path: ./
- name: ArduinoRS485
UNIVERSAL_SKETCH_PATHS: |
- examples/RTU

strategy:
fail-fast: false

matrix:
board:
- fqbn: arduino:avr:nano
nina: false
- fqbn: arduino:avr:leonardo
nina: false
- fqbn: arduino:megaavr:uno2018:mode=off
nina: true
- fqbn: arduino:samd:mkrwifi1010
nina: true
- fqbn: arduino:mbed:nano33ble
nina: false
- fqbn: arduino:mbed:envie_m7
nina: false

# Make board type-specific customizations to the matrix jobs
include:
- board:
# Boards with NINA-W102 module
nina: true
# Install these libraries in addition to the ones defined by env.UNIVERSAL_LIBRARIES
nina-libraries: |
- name: WiFiNINA
# Compile these sketches in addition to the ones defined by env.UNIVERSAL_SKETCH_PATHS
nina-sketch-paths: |
- examples/TCP
- board:
nina: false
nina-libraries: ""
nina-sketch-paths: ""

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Compile examples
uses: arduino/compile-sketches@main
with:
fqbn: ${{ matrix.board.fqbn }}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
${{ matrix.nina-libraries }}
sketch-paths: |
${{ env.UNIVERSAL_SKETCH_PATHS }}
${{ matrix.nina-sketch-paths }}
enable-deltas-report: true
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Save memory usage change report as artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.SKETCHES_REPORTS_PATH }}
path: ${{ env.SKETCHES_REPORTS_PATH }}
18 changes: 18 additions & 0 deletions .github/workflows/report-size-deltas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Report Size Deltas

on:
schedule:
- cron: "*/5 * * * *"
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:

jobs:
report:
runs-on: ubuntu-latest

steps:
- name: Comment size deltas reports to PRs
uses: arduino/report-size-deltas@main
with:
# The name of the workflow artifact created by the "Compile Examples" workflow
sketches-reports-source: sketches-reports
26 changes: 26 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Spell Check

on:
pull_request:
push:
schedule:
# run every Tuesday at 3 AM UTC
- cron: "0 3 * * 2"

jobs:
spellcheck:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

# See: https://github.com/codespell-project/actions-codespell/blob/master/README.md
- name: Spell check
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
# In the event of a false positive, add the word in all lower case to this file:
ignore_words_file: extras/codespell-ignore-words-list.txt
skip: ./.git,./src/libmodbus
7 changes: 7 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// Define the repository information in these attributes
:repository-owner: arduino-libraries
:repository-name: ArduinoModbus

= Modbus Library for Arduino =

image:https://github.com/{repository-owner}/{repository-name}/workflows/Compile%20Examples/badge.svg["Compile Examples Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Compile+Examples"]
image:https://github.com/{repository-owner}/{repository-name}/workflows/Spell%20Check/badge.svg["Spell Check Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Spell+Check"]

Use http://www.modbus.org/[Modbus] with your Arduino.

Using TCP or RS485 shields, like the MKR 485 Shield. This library depends on the ArduinoRS485 library.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Modbus RTU Client Kitchen Sink

This sketch creates a Modbus RTU Client and demostrates
This sketch creates a Modbus RTU Client and demonstrates
how to use various Modbus Client APIs.

Circuit:
Expand Down Expand Up @@ -164,7 +164,7 @@ void readHoldingRegisterValues() {
void readInputRegisterValues() {
Serial.print("Reading input register values ... ");

// read 10 dsicrete input values from (slave) id 42,
// read 10 discrete input values from (slave) id 42,
if (!ModbusRTUClient.requestFrom(42, INPUT_REGISTERS, 0x00, 10)) {
Serial.print("failed! ");
Serial.println(ModbusRTUClient.lastError());
Expand All @@ -181,4 +181,3 @@ void readInputRegisterValues() {
// Alternatively, to read a single Input Register value use:
// ModbusRTUClient.inputRegisterRead(...)
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Modbus RTU Server Kitchen Sink

This sketch creates a Modbus RTU Server and demostrates
This sketch creates a Modbus RTU Server and demonstrates
how to use various Modbus Server APIs.

Circuit:
Expand Down Expand Up @@ -62,7 +62,7 @@ void loop() {
ModbusRTUServer.discreteInputWrite(i, coilValue);
}

// map the holiding register values to the input register values
// map the holding register values to the input register values
for (int i = 0; i < numHoldingRegisters; i++) {
long holdingRegisterValue = ModbusRTUServer.holdingRegisterRead(i);

Expand Down
2 changes: 1 addition & 1 deletion examples/RTU/ModbusRTUServerLED/ModbusRTUServerLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void loop() {
// coil value set, turn LED on
digitalWrite(ledPin, HIGH);
} else {
// coild value clear, turn LED off
// coil value clear, turn LED off
digitalWrite(ledPin, LOW);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Modbus RTU Temeperature Sensor
Modbus RTU Temperature Sensor

This sketch shows you how to interact with a Modbus RTU temperature and humidity sensor.
It reads the temperature and humidity values every 5 seconds and outputs them to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void setup() {

Serial.println("Modbus TCP Client Toggle");

// attempt to connect to Wifi network:
// attempt to connect to WiFi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
Expand Down
2 changes: 1 addition & 1 deletion examples/TCP/WiFiModbusServerLED/WiFiModbusServerLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void setup() {

Serial.println("Modbus TCP Server LED");

// attempt to connect to Wifi network:
// attempt to connect to WiFi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion src/ModbusClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ModbusClient {
* @param id (slave) id of target, defaults to 0x00 if not specified
* @param address start address to use for operation
*
* @return holiding register value on success, -1 on failure.
* @return holding register value on success, -1 on failure.
*/
long holdingRegisterRead(int address);
long holdingRegisterRead(int id, int address);
Expand Down