From 6d2ab4b4959eb42a457d25389c1aa836e4299437 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Sun, 10 Jan 2021 08:07:55 +0100 Subject: [PATCH 1/4] add Arduino-CI + prepare unit tests --- .arduino-ci.yml | 11 +++ .github/workflows/arduino_test_runner.yml | 13 ++++ test/unit_test_001.cpp_disabled | 95 +++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 .arduino-ci.yml create mode 100644 .github/workflows/arduino_test_runner.yml create mode 100644 test/unit_test_001.cpp_disabled diff --git a/.arduino-ci.yml b/.arduino-ci.yml new file mode 100644 index 0000000..26947a9 --- /dev/null +++ b/.arduino-ci.yml @@ -0,0 +1,11 @@ +compile: + # Choosing to run compilation tests on 2 different Arduino platforms + platforms: + - uno + - leonardo + - due + - zero +unittest: + # These dependent libraries will be installed + libraries: + - "OneWire" \ No newline at end of file diff --git a/.github/workflows/arduino_test_runner.yml b/.github/workflows/arduino_test_runner.yml new file mode 100644 index 0000000..476456b --- /dev/null +++ b/.github/workflows/arduino_test_runner.yml @@ -0,0 +1,13 @@ +--- +name: Arduino CI + +on: [push, pull_request] + +jobs: + arduino_ci: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: Arduino-CI/action@master + # Arduino-CI/action@v0.1.1 diff --git a/test/unit_test_001.cpp_disabled b/test/unit_test_001.cpp_disabled new file mode 100644 index 0000000..ea7fbd6 --- /dev/null +++ b/test/unit_test_001.cpp_disabled @@ -0,0 +1,95 @@ + +// DISABLED AS NOT ALL STD LIBRARIES ARE MOCKED / INCLUDEABLE + + +// +// FILE: unit_test_001.cpp +// AUTHOR: Miles Burton / Rob Tillaart +// DATE: 2021-01-10 +// PURPOSE: unit tests for the Arduino-Temperature-Control-Library +// https://github.com/MilesBurton/Arduino-Temperature-Control-Library +// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md +// + +// supported assertions +// ---------------------------- +// assertEqual(expected, actual); // a == b +// assertNotEqual(unwanted, actual); // a != b +// assertComparativeEquivalent(expected, actual); // abs(a - b) == 0 or (!(a > b) && !(a < b)) +// assertComparativeNotEquivalent(unwanted, actual); // abs(a - b) > 0 or ((a > b) || (a < b)) +// assertLess(upperBound, actual); // a < b +// assertMore(lowerBound, actual); // a > b +// assertLessOrEqual(upperBound, actual); // a <= b +// assertMoreOrEqual(lowerBound, actual); // a >= b +// assertTrue(actual); +// assertFalse(actual); +// assertNull(actual); + +// // special cases for floats +// assertEqualFloat(expected, actual, epsilon); // fabs(a - b) <= epsilon +// assertNotEqualFloat(unwanted, actual, epsilon); // fabs(a - b) >= epsilon +// assertInfinity(actual); // isinf(a) +// assertNotInfinity(actual); // !isinf(a) +// assertNAN(arg); // isnan(a) +// assertNotNAN(arg); // !isnan(a) + +#include + + +#include "Arduino.h" + +/* + + +// BASED UPON SIMPLE +// + + +#include "OneWire.h" +#include "DallasTemperature.h" + +// Data wire is plugged into port 2 on the Arduino +#define ONE_WIRE_BUS 2 + +// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) +OneWire oneWire(ONE_WIRE_BUS); + +// Pass our oneWire reference to Dallas Temperature. +DallasTemperature sensors(&oneWire); + + + +unittest_setup() +{ +} + +unittest_teardown() +{ +} + + + +unittest(test_constructor) +{ + fprintf(stderr, "VERSION: %s\n", DALLASTEMPLIBVERSION); + + sensors.begin(); + sensors.requestTemperatures(); + float tempC = sensors.getTempCByIndex(0); + if(tempC != DEVICE_DISCONNECTED_C) + { + fprintf(stderr, "Temperature for the device 1 (index 0) is: "); + fprintf(stderr, "5f\n", tempC); + } + else + { + fprintf(stderr, "Error: Could not read temperature data\n"); + } + + assertEqual(1, 1); // keep unit test happy +} +*/ + +unittest_main() + +// -------- From 179024575575826f187bcce77d00443e1d979251 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Wed, 7 Apr 2021 11:38:59 +0200 Subject: [PATCH 2/4] add json check --- .github/workflows/jsoncheck.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/jsoncheck.yml diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml new file mode 100644 index 0000000..04603d0 --- /dev/null +++ b/.github/workflows/jsoncheck.yml @@ -0,0 +1,18 @@ +name: JSON check + +on: + push: + paths: + - '**.json' + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: json-syntax-check + uses: limitusus/json-syntax-check@v1 + with: + pattern: "\\.json$" + From 6f6a5d8df2eedb80de8ea65ade4b8ddacc2f0479 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Thu, 27 May 2021 17:37:31 +0200 Subject: [PATCH 3/4] add arduino-lint check --- .github/workflows/jsoncheck.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml index 04603d0..0c002ee 100644 --- a/.github/workflows/jsoncheck.yml +++ b/.github/workflows/jsoncheck.yml @@ -1,18 +1,10 @@ -name: JSON check - -on: - push: - paths: - - '**.json' - pull_request: - +on: [push, pull_request] jobs: - test: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: json-syntax-check - uses: limitusus/json-syntax-check@v1 - with: - pattern: "\\.json$" - + - uses: arduino/arduino-lint-action@v1 +# with: +# library-manager: update +# compliance: strict \ No newline at end of file From 2da19ae0fe9645642f530385357f3870247c2c10 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Thu, 27 May 2021 18:19:40 +0200 Subject: [PATCH 4/4] add arduino-lint check --- .github/workflows/arduino-lint.yml | 10 ++++++++++ .github/workflows/jsoncheck.yml | 20 ++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/arduino-lint.yml diff --git a/.github/workflows/arduino-lint.yml b/.github/workflows/arduino-lint.yml new file mode 100644 index 0000000..87f6b18 --- /dev/null +++ b/.github/workflows/arduino-lint.yml @@ -0,0 +1,10 @@ +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: arduino/arduino-lint-action@v1 + with: + library-manager: update + compliance: strict \ No newline at end of file diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml index 0c002ee..04603d0 100644 --- a/.github/workflows/jsoncheck.yml +++ b/.github/workflows/jsoncheck.yml @@ -1,10 +1,18 @@ -on: [push, pull_request] +name: JSON check + +on: + push: + paths: + - '**.json' + pull_request: + jobs: - lint: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: arduino/arduino-lint-action@v1 -# with: -# library-manager: update -# compliance: strict \ No newline at end of file + - name: json-syntax-check + uses: limitusus/json-syntax-check@v1 + with: + pattern: "\\.json$" +