From 897df2ca88b344d0aec9b456284c252b72ea95ee Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 25 Oct 2021 17:29:15 -0700 Subject: [PATCH 01/17] Adding super-linter CI --- .github/workflows/linter.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/linter.yaml diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml new file mode 100644 index 00000000..b2406fa1 --- /dev/null +++ b/.github/workflows/linter.yaml @@ -0,0 +1,28 @@ +--- +name: Lint Code Base + +on: + push: + branches-ignore: [master, main] + # Remove the line above to run when pushing to master + pull_request: + branches: [master, main] + +jobs: + build: + name: Lint Code Base + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: Lint Code Base + uses: github/super-linter/slim@v4 + env: + VALIDATE_ALL_CODEBASE: true + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a9ac4c46e0877d82e72c1139e5f1f966d80d1d41 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 25 Oct 2021 17:55:33 -0700 Subject: [PATCH 02/17] Adding comment to changelog --- .github/workflows/linter.yaml | 2 +- CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index b2406fa1..d437d55f 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -23,6 +23,6 @@ jobs: - name: Lint Code Base uses: github/super-linter/slim@v4 env: - VALIDATE_ALL_CODEBASE: true + VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: master GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9f9bd3..b2ca9b18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `--min-free-space=N` command-line argument to fail if free space is below requred value - Add `_BV()` macro. - Support for `dtostrf()` +- Added a CI workflow to lint the code base ### Changed - We now compile a shared library to be used for each test. From b8bd47452a9add6a3cdba6e4645ab2ef7b9d2c39 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 25 Oct 2021 18:03:11 -0700 Subject: [PATCH 03/17] Linting update to changelog --- CHANGELOG.md | 184 +++++++++++++++++++++++++-------------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2ca9b18..03eeaf29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -### Added +**Added** - Allow use of watchdog timer in application code (though it doesn't do anything) - Show output from successful compile - `--min-free-space=N` command-line argument to fail if free space is below requred value @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Support for `dtostrf()` - Added a CI workflow to lint the code base -### Changed +**Changed** - We now compile a shared library to be used for each test. - Put build artifacts in a separate directory to reduce clutter. - Replace `#define yield() _NOP()` with `inline void yield() { _NOP(); }` so that other code can define a `yield()` function. @@ -22,31 +22,31 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Change 266 files from CRLF to LF. - Run tests on push as well as on a pull request so developers can see impact -### Deprecated +**Deprecated** -### Removed +**Removed** -### Fixed +**Fixed** - Properly report compile errors in GitHub Actions. - Fix copy/paste error to allow additional warnings for a platform - Apply "rule of three" to Client copy constructor and copy assignment operator -### Security +**Security** ## [1.3.0] - 2021-01-13 -### Added +**Added** - Better indications of the build phases in the test runner `arduino_ci.rb` - Better indications of which example sketch is being compiled as part of testing -### Changed +**Changed** - Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. - Stream::readStreamUntil() no longer returns delimiter -### Removed +**Removed** - scanning of `library.properties`; this can and should now be performed by the standalone [`arduino-lint` tool](https://arduino.github.io/arduino-lint). -### Fixed +**Fixed** - Example sketches with no configured platforms were printing the wrong configuration values to the debug message - Libraries directory was not being automatically created prior to attempting to change directory into it - A style error whose "fix" caused an _actual_ error. @@ -54,7 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.2.0] - 2021-01-06 -### Added +**Added** - Environment variable to run a custom initialization script during CI testing: `CUSTOM_INIT_SCRIPT` - Environment variable to run from a subdirectory during CI testing: `USE_SUBDIR` - `assertComparativeEquivalent()` and `assertComparativeNotEquivalent()` to evaluate equality on an `a - b == 0` basis (and/or `!(a > b) && !(a < b)`) @@ -69,14 +69,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `ArduinoBackend.library_available?` to detect whether the library manager knows of a library - Sanity checks for `library.properties` `includes=` and `depends=` entries -### Changed +**Changed** - Rubocop expected syntax downgraded from ruby 2.6 to 2.5 - `assertEqual()` and `assertNotEqual()` use actual `==` and `!=` -- they no longer require a type to be totally ordered just to do equality tests - Evaluative assertions (is true/false/null/etc) now produce simpler error messages instead of masquerading as an operation (e.g. "== true") - `LibraryProperties.to_h` now properly uses formatters and symbolic keys, in order to support a `.to_s` - Architectures from `library.properties` are considered when iterating over unit test or examples compilation, as well as the configured platforms -### Fixed +**Fixed** - Warnings about directory name mismatches are now based on proper comparison of strings - Now using the recommended "stable" URL for the `esp32` board family - `esp8266:huzzah` options updated as per upstream @@ -86,20 +86,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.1.0] - 2020-12-02 -### Added +**Added** - `ensure_arduino_installation.rb` now ensures the existence of the library directory as well - Environment variables to escalate unit tests or examples not being found during CI testing - `EXPECT_EXAMPLES` and `EXPECT_UNITTESTS` -### Changed +**Changed** - Conserve CI testing minutes by grouping CI into fewer runs -### Fixed +**Fixed** - Improper reference to `Host` in `arduino_ci.rb` test runner is now properly qualified - Failure to set board manager URLs (for 3rd party board providers) has been fixed ## [1.0.0] - 2020-11-29 -### Added +**Added** - Special handling of attempts to run the `arduino_ci.rb` CI script against the ruby library instead of an actual Arduino project - Explicit checks for attemping to test `arduino_ci` itself as if it were a library, resolving a minor annoyance to this developer. - Code coverage tooling @@ -109,7 +109,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Allow tests to run on GitHub without external set up, via GitHub Actions (Windows, Linux, MacOS) - Exposed desired CLI backend version as `ArduinoInstallation::DESIRED_ARDUINO_CLI_VERSION` -### Changed +**Changed** - Arduino backend is now `arduino-cli` version `0.13.0` - `ArduinoCmd` is now `ArduinoBackend` - `CppLibrary` now relies largely on `ArduinoBackend` instead of making its own judgements about libraries (metadata, includes, and examples) @@ -118,23 +118,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `CppLibrary` forces just-in-time recursive dependency installation in order to work sensibly - `ArduinoBackend` maintains the central "best guess" logic on what a library (on disk) might be named -### Deprecated +**Deprecated** - `arduino_ci_remote.rb` CLI switch `--skip-compilation` - Deprecated `arduino_ci_remote.rb` in favor of `arduino_ci.rb` -### Removed +**Removed** - `ARDUINO_CI_SKIP_SPLASH_SCREEN_RSPEC_TESTS` no longer affects any tests because there are no longer splash screens since switching to `arduino-cli` - `CIConfig.package_builtin?` as this is no longer relevant to the `arduino-cli` backend (which has no built-in packages) - Travis and Appveyor CI -### Fixed +**Fixed** - Missing include of `IPAddress.h` in `Client.h` - Mismatches between library names in `library.properties` and the directory names, which can cause cryptic failures - `LibraryProperties` skips over parse errors instead of crashing: only lines with non-empty keys and non-nil values are recorded ## [0.4.0] - 2020-11-21 -### Added +**Added** - `arduino_ci_remote.rb` CLI switch `--skip-examples-compilation` - Add support for `diditalPinToPort()`, `digitalPinToBitMask()`, `portOutputRegister()`, and `portInputRegister()` - `CppLibrary.header_files` to find header files @@ -148,19 +148,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `Wire` now has a mock support for the master role - Sample project for `BusIO` to show problem finding header file -### Changed -- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci +**Changed** +- Move repository from to - Revise math macros to avoid name clashes - `CppLibrary` functions returning C++ header or code files now respect the 1.0/1.5 library specification - Mocks of built-in macros made more accurate - NUM_SERIAL_PORTS can now be set explicitly - Improve SPI header strategy -### Deprecated +**Deprecated** - `arduino_ci_remote.rb` CLI switch `--skip-compilation` - Deprecated `arduino_ci_remote.rb` in favor of `arduino_ci.rb` -### Fixed +**Fixed** - Don't define `ostream& operator<<(nullptr_t)` if already defined by Apple - `CppLibrary.in_tests_dir?` no longer produces an error if there is no tests directory - The definition of the `_SFR_IO8` macro no longer produces errors about rvalues @@ -168,30 +168,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.3.0] - 2019-09-03 -### Added +**Added** - Unit testing configuration now allows `exclude_dirs` to be set, which prevents stray source files from as part of unit testing allows ## [0.2.1] - 2019-08-12 -### Added +**Added** - Minimal Wire mocks. Will not provide support for unit testing I2C communication yet, but will allow compilation of libraries that use I2C. - `StreamTape` class now bridges `Stream` and `HardwareSerial` to allow general-purpose stream mocking & history -### Changed +**Changed** - Arduino command failures (to read preferences) now causes a fatal error, with help for troubleshooting the underlying command -### Fixed +**Fixed** - Arduino library dependencies are now installed prior to unit testing, instead of prior to compilation testing. Whoops. - Arduino library dependencies with spaces in their names are now handled properly during compilation -- spaces are automatically coerced to underscores ## [0.2.0] - 2019-02-20 -### Added +**Added** - `release-new-version.sh` script - outputs for `PinHistory` can now report timestamps - Fibonacci Clock for clock testing purposes (internal to this library) -### Changed +**Changed** - Shortened `ArduinoQueue` push and pop operations - `ci/Queue.h` is now `MockEventQueue.h`, with timing data - `MockEventQueue::Node` now contains struct `MockEventQueue::Event`, which contains both the templated type `T` and a field for a timestamp. @@ -201,46 +201,46 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `GodmodeState` is now a singleton pattern, which is necessary to support the globality of Arduino functions - `GodmodeState` now uses timestamped PinHistory for Analog and Digital -### Fixed +**Fixed** * `ArduinoQueue` no longer leaks memory ## [0.1.21] - 2019-02-07 -### Added +**Added** - Proper `ostream operator <<` for `nullptr` - Proper comparison operations fro `nullptr` -### Changed +**Changed** - `Compare.h` heavily refactored to use a smallish macro -### Removed +**Removed** - Homegrown implementation of `nullptr` -### Fixed +**Fixed** - `nullptr` support (again) ## [0.1.20] - 2019-01-31 -### Fixed +**Fixed** - `unittest_setup()` and `unittest_teardown()` were not being executed for each unit test, only for the set of all tests. My bad. ## [0.1.19] - 2019-01-30 -### Added +**Added** - Added rspec sensitivity to the environment variable `$ARDUINO_CI_SELECT_CPP_TESTS=` (for `arduino_ci` gem hackers) - `assertNotNull()` and `assureNotNull()` C++ comparisons -### Changed +**Changed** - `CiConfig::allowable_unittest_files` now uses `Pathname` to full effect - `nullptr` now defined in its own class -### Fixed +**Fixed** - Assertions on `nullptr` - The defintion of `nullptr` ## [0.1.18] - 2019-01-29 -### Added +**Added** - `ArduinoInstallation` and `ArduinoDownloader` now allow console output to optionally be set to an `IO` object of choice during `force_install` - `ArduinoInstallation::force_install` now optionally accepts a version string - `arduino_library_location.rb` script to print Arduino library location to stdout @@ -253,12 +253,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `nullptr` definition in C++ - `assertNull()` for unit tests -### Changed +**Changed** - Unit tests and examples are now executed alphabetically by filename - The `pgm_read_...` preprocessor macros in cpp/arduino/avr/pgmspace.h now expands to an expression with applicable type. - Unit tests for interrupts (`attachInterrupt` and `detachInterrupt`) get their own file -### Fixed +**Fixed** - Library installation no longer "fails" if the library is already installed - Platform definition for `mega2560` now includes proper AVR compiler flag - `CppLibrary::vendor_bundle?` now asks where gems are, instead of assuming `vendor/bundle/` @@ -266,78 +266,78 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.17] - 2019-01-14 -### Added +**Added** - Provide an `itoa` function. It is present in Arduino's runtime environment but not on most (all?) host systems because itoa is not a portable standard function. - `to_h` and `to_s` functions for `ci_config.rb` - `CIConfig::clone` - Ability to override `CIConfig` from a hash instead of just a file - `arduino_ci_remote.rb` now supports command line switches `--testfile-select=GLOB` and `--testfile-reject=GLOB` (which can both be repeated) -### Changed +**Changed** - Simplified the use of `Array.each` with a return statement; it's now simply `Array.find` - `autolocate!` for Arduino installations now raises `ArduinoInstallationError` if `force_install` fails - Errors due to missing YAML are now named `ConfigurationError` -### Fixed +**Fixed** - Determining a working OSX launch command no longer breaks on non-English installations - `arduino_ci_remote.rb` now honors selected and rejected test files ## [0.1.16] - 2019-01-06 -### Changed +**Changed** - Finally put some factorization into the `arduino_ci_remote.rb` script: testing unit and testing compilation are now standalone functions -### Removed +**Removed** - Unnecessary board changes during unit tests no longer happen -### Fixed +**Fixed** - Proper casting for `pgm_read_byte` ## [0.1.15] - 2019-01-04 -### Added +**Added** - Checking for (empty) set of platforms to build now precedes the check for examples to build; this avoids assuming that all libraries will have an example and dumping the file set when none are found -### Fixed +**Fixed** - Spaces in the names of project directores no longer cause unit test binaries to fail execution - Configuration file overrides with `nil`s (or empty arrays) now properly override their base configuration ## [0.1.14] - 2018-09-21 -### Added +**Added** - Arduino command wrapper now natively supports board manager URLs - `arduino_ci_remote.rb` checks for proper board manager URLs for requested platforms - `arduino_ci_remote.rb` reports on Arduino executable location - exposed `index_libraries` in `ArduinoCmd` so it can be used as an explicit build step -### Changed +**Changed** - Centralized file listing code in `arduino_ci_remote.rb` - `arduino_ci_remote.rb` is verbose about platforms, packages, and URLs -### Removed +**Removed** - Linux wrapper no longer bails out on long-running commands. That behavior was possible in Arduino 1.6.x that might pop up a graphical error message, but with the display manager removed this is no longer a concern ## [0.1.13] - 2018-09-19 -### Changed +**Changed** - `arduino_ci_remote.rb` now iterates over example platforms before examples (saves time) -### Fixed +**Fixed** - `arduino_ci_remote.rb` no longer crashes if `test/` directory doesn't exist ## [0.1.12] - 2018-09-13 -### Added +**Added** - Explicit `libasan` checking (reporting) in build script -### Fixed +**Fixed** - Test file `int main(){}` needed a CPP extension in order to properly compile - Fixed build script reporting for `inform()` when it returns a non-string value from its block - Don't count false returns from `inform()` blocks as failures ## [0.1.11] - 2018-09-13 -### Added +**Added** - Explicit checks that the requested test platforms are defined in YML - Arduino command wrapper can now guess whether a library is installed - CPP library class now reaches into included Arduino libraries for source files @@ -346,17 +346,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Copy constructor for `ArduinoCITable` - Some error information on failures to download the Arduino binary -### Changed +**Changed** - Refactored documentation - External libraries aren't forcibly installed via the Arduino binary (in `arduino_cmd_remote.rb`) if they appear to exist on disk already - `attachInterrupt` and `detachInterrupt` are now mocked instead of `_NOP` - Unit test binaries now run with debugging symbols and address sanitization (if available), to help isolate the causes of segfaults - `ArduinoCommand::libdir` logic is now centralized, using `sketchbook.path` from prefs instead of hard-coding -### Removed +**Removed** - Display Manager became no longer necessary with Arduino 1.8.X -### Fixed +**Fixed** - OSX splash screen re-disabled - ArduinoCITable didn't initialize its size on `clear()` - CPP file aggregation now ignores dotfiles @@ -367,7 +367,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.10] - 2018-05-06 -### Added +**Added** - Arduino `force_install` on Linux now attempts downloading 3 times and provides more information on failure - Explicit check for `wget` - Windows / Appveyor support, enabled largely by contributions from @tomduff @@ -376,17 +376,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Cross-platform symlinking in `Host` - OSX CI via Travis, with separate badges -### Changed +**Changed** - Author - Splash-screen-skip hack on OSX now falls back on "official" launch method if the hack doesn't work - Refactored download/install code in prepration for windows CI - Explicitly use 32-bit math for mocked Random() - Ruby-centric download and unzipping of Arduino IDE packages, now with progress dots -### Removed +**Removed** - `ArduinoDownloaderPosix` became empty, so it was removed -### Fixed +**Fixed** - `Gemfile.lock` files are properly ignored - Windows hosts won't try to open a display manager - `isnan` portability @@ -394,40 +394,40 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.9] - 2018-04-12 -### Added +**Added** - Explicit tests of `.arduino-ci.yml` in `TestSomething` example -### Fixed +**Fixed** - Malformed YAML (duplicate unittests section) now has no duplicate section - arduino_ci_remote.rb script now has correct arguments in build_for_test ## [0.1.8] - 2018-04-03 -### Added +**Added** - Definition of `LED_BUILTIN`, first reported by `dfrencham` on GitHub - Stubs for `tone` and `noTone`, first suggested by `dfrencham` on GitHub - Ability to specify multiple compilers for unit testing -### Fixed +**Fixed** - Compile errors / portability issues in `WString.h` and `Print.h`, first reported by `dfrencham` on GitHub - Compile errors / inheritance issues in `Print.h` and `Stream.h`, first reported by `dfrencham` on GitHub - Print functions for int, double, long, etc ## [0.1.7] - 2018-03-07 -### Changed +**Changed** - Queue and Table are now ArduinoCIQueue and ArduinoCITable to avoid name collisions ## [0.1.6] - 2018-03-07 -### Added +**Added** - `CppLibrary` can now report `gcc_version` -### Changed +**Changed** - `arduino_ci_remote.rb` now formats tasks with multiple output lines more nicely - Templates for CI classes are now pass-by-value (no const reference) -### Fixed +**Fixed** - Replaced pipes with `Open3.capture3` to avoid deadlocks when commands have too much output - `ci_config.rb` now returns empty arrays (instead of nil) for undefined config keys - `pgmspace.h` explictly includes `` @@ -436,7 +436,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.5] - 2018-03-05 -### Added +**Added** - Yaml files can have either `.yml` or `.yaml` extensions - Yaml files support select/reject critera for paths of unit tests for targeted testing - Pins now track history and can report it in Ascii (big- or little-endian) for digital sequences @@ -448,10 +448,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - ObservableDataStream and DataStreamObserver pattern implementation - DeviceUsingBytes and implementation of mocked serial device -### Changed +**Changed** - Unit test executables print to STDERR just in case there are segfaults. Uh, just in case I ever write any. -### Fixed +**Fixed** - OSX no longer experiences `javax.net.ssl.SSLKeyException: RSA premaster secret error` messages when downloading board package files - `arduino_ci_remote.rb` no longer makes unnecessary changes to the board being tested - Scripts no longer crash if there is no `test/` directory @@ -460,11 +460,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.4] - 2018-02-01 -### Added -- Support for all builtin Math functions https://www.arduino.cc/reference/en/ -- Support for all builtin Bits and Bytes functions https://www.arduino.cc/reference/en/ +**Added** +- Support for all builtin Math functions +- Support for all builtin Bits and Bytes functions - Support for GODMODE and time functions -- Support for Character functions https://www.arduino.cc/reference/en/ +- Support for Character functions - Mocks for `random` functions with seed control - Many original Arduino `#define`s - Mocks for pinMode, analog/digital read/write @@ -474,21 +474,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - All the IO stuff (pins, serial port support flags, etc) from the Arduino library - Support for Serial (backed by GODMODE) -### Changed +**Changed** - Made `wget` have quieter output ## [0.1.3] - 2018-01-25 -### Added +**Added** - C++ functions for `assure`; `assert`s will run tests and continue, `assure`s will abort on failures - Missing dotfiles in the `DoSomething` project have been committed -### Changed +**Changed** - `arduino_ci_remote.rb` doesn't attempt to set URLs if nothing needs to be downloaded - `arduino_ci_remote.rb` does unit tests first - `unittest_main()` is now the macro for the `int main()` of test files -### Fixed +**Fixed** - All test files were reporting "not ok" in TAP output. Now they are OK iff all asserts pass. - Directories with a C++ extension in their name could cause problems. Now they are ignored. - `CppLibrary` had trouble with symlinks. It shoudn't anymore. @@ -496,17 +496,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.2] - 2018-01-25 -### Fixed +**Fixed** - Actually package CPP and YAML files into the gem. Whoops. ## [0.1.1] - 2018-01-24 -### Added +**Added** - README documentation for the actual unit tests ## [0.1.0] - 2018-01-24 -### Added +**Added** - Unit testing support - Documentation for all Ruby methods - `ArduinoInstallation` class for managing lib / executable paths @@ -521,16 +521,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `CppLibrary` manages GCC for unittests - `CIConfig` manages overridable config for all testing -### Changed +**Changed** - `DisplayManger.with_display` doesn't `disable` if the display was enabled prior to starting the block -### Fixed +**Fixed** - Built gems are `.gitignore`d - Updated gems based on Github's security advisories ## [0.0.1] - 2018-01-10 -### Added +**Added** - Skeleton for gem with working unit tests From 02034942821094e0ef2b30fee086ea4caccc7f14 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 25 Oct 2021 18:03:11 -0700 Subject: [PATCH 04/17] Revert "Linting update to changelog" This reverts commit b8bd47452a9add6a3cdba6e4645ab2ef7b9d2c39. --- CHANGELOG.md | 184 +++++++++++++++++++++++++-------------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 096a0672..a8068926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -**Added** +### Added - Allow use of watchdog timer in application code (though it doesn't do anything) - Show output from successful compile - `--min-free-space=N` command-line argument to fail if free space is below required value @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added a CI workflow to lint the code base - Added a CI workflow to check for spelling errors -**Changed** +### Changed - We now compile a shared library to be used for each test. - Put build artifacts in a separate directory to reduce clutter. - Replace `#define yield() _NOP()` with `inline void yield() { _NOP(); }` so that other code can define a `yield()` function. @@ -23,33 +23,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Change 266 files from CRLF to LF. - Run tests on push as well as on a pull request so developers can see impact -**Deprecated** +### Deprecated -**Removed** +### Removed -**Fixed** +### Fixed - Properly report compile errors in GitHub Actions. - Fix copy/paste error to allow additional warnings for a platform - Apply "rule of three" to Client copy constructor and copy assignment operator -**Security** +### Security ## [1.3.0] - 2021-01-13 -**Added** +### Added - Better indications of the build phases in the test runner `arduino_ci.rb` - Better indications of which example sketch is being compiled as part of testing -**Changed** +### Changed - Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. ### Changed - Topmost installation instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. - Stream::readStreamUntil() no longer returns delimiter -**Removed** +### Removed - scanning of `library.properties`; this can and should now be performed by the standalone [`arduino-lint` tool](https://arduino.github.io/arduino-lint). -**Fixed** +### Fixed - Example sketches with no configured platforms were printing the wrong configuration values to the debug message - Libraries directory was not being automatically created prior to attempting to change directory into it - A style error whose "fix" caused an _actual_ error. @@ -57,7 +57,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.2.0] - 2021-01-06 -**Added** +### Added - Environment variable to run a custom initialization script during CI testing: `CUSTOM_INIT_SCRIPT` - Environment variable to run from a subdirectory during CI testing: `USE_SUBDIR` - `assertComparativeEquivalent()` and `assertComparativeNotEquivalent()` to evaluate equality on an `a - b == 0` basis (and/or `!(a > b) && !(a < b)`) @@ -72,14 +72,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `ArduinoBackend.library_available?` to detect whether the library manager knows of a library - Sanity checks for `library.properties` `includes=` and `depends=` entries -**Changed** +### Changed - Rubocop expected syntax downgraded from ruby 2.6 to 2.5 - `assertEqual()` and `assertNotEqual()` use actual `==` and `!=` -- they no longer require a type to be totally ordered just to do equality tests - Evaluative assertions (is true/false/null/etc) now produce simpler error messages instead of masquerading as an operation (e.g. "== true") - `LibraryProperties.to_h` now properly uses formatters and symbolic keys, in order to support a `.to_s` - Architectures from `library.properties` are considered when iterating over unit test or examples compilation, as well as the configured platforms -**Fixed** +### Fixed - Warnings about directory name mismatches are now based on proper comparison of strings - Now using the recommended "stable" URL for the `esp32` board family - `esp8266:huzzah` options updated as per upstream @@ -89,20 +89,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.1.0] - 2020-12-02 -**Added** +### Added - `ensure_arduino_installation.rb` now ensures the existence of the library directory as well - Environment variables to escalate unit tests or examples not being found during CI testing - `EXPECT_EXAMPLES` and `EXPECT_UNITTESTS` -**Changed** +### Changed - Conserve CI testing minutes by grouping CI into fewer runs -**Fixed** +### Fixed - Improper reference to `Host` in `arduino_ci.rb` test runner is now properly qualified - Failure to set board manager URLs (for 3rd party board providers) has been fixed ## [1.0.0] - 2020-11-29 -**Added** +### Added - Special handling of attempts to run the `arduino_ci.rb` CI script against the ruby library instead of an actual Arduino project - Explicit checks for attempting to test `arduino_ci` itself as if it were a library, resolving a minor annoyance to this developer. - Code coverage tooling @@ -112,7 +112,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Allow tests to run on GitHub without external set up, via GitHub Actions (Windows, Linux, MacOS) - Exposed desired CLI backend version as `ArduinoInstallation::DESIRED_ARDUINO_CLI_VERSION` -**Changed** +### Changed - Arduino backend is now `arduino-cli` version `0.13.0` - `ArduinoCmd` is now `ArduinoBackend` - `CppLibrary` now relies largely on `ArduinoBackend` instead of making its own judgements about libraries (metadata, includes, and examples) @@ -121,23 +121,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `CppLibrary` forces just-in-time recursive dependency installation in order to work sensibly - `ArduinoBackend` maintains the central "best guess" logic on what a library (on disk) might be named -**Deprecated** +### Deprecated - `arduino_ci_remote.rb` CLI switch `--skip-compilation` - Deprecated `arduino_ci_remote.rb` in favor of `arduino_ci.rb` -**Removed** +### Removed - `ARDUINO_CI_SKIP_SPLASH_SCREEN_RSPEC_TESTS` no longer affects any tests because there are no longer splash screens since switching to `arduino-cli` - `CIConfig.package_builtin?` as this is no longer relevant to the `arduino-cli` backend (which has no built-in packages) - Travis and Appveyor CI -**Fixed** +### Fixed - Missing include of `IPAddress.h` in `Client.h` - Mismatches between library names in `library.properties` and the directory names, which can cause cryptic failures - `LibraryProperties` skips over parse errors instead of crashing: only lines with non-empty keys and non-nil values are recorded ## [0.4.0] - 2020-11-21 -**Added** +### Added - `arduino_ci_remote.rb` CLI switch `--skip-examples-compilation` - Add support for `diditalPinToPort()`, `digitalPinToBitMask()`, `portOutputRegister()`, and `portInputRegister()` - `CppLibrary.header_files` to find header files @@ -151,19 +151,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `Wire` now has a mock support for the master role - Sample project for `BusIO` to show problem finding header file -**Changed** -- Move repository from to +### Changed +- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci - Revise math macros to avoid name clashes - `CppLibrary` functions returning C++ header or code files now respect the 1.0/1.5 library specification - Mocks of built-in macros made more accurate - NUM_SERIAL_PORTS can now be set explicitly - Improve SPI header strategy -**Deprecated** +### Deprecated - `arduino_ci_remote.rb` CLI switch `--skip-compilation` - Deprecated `arduino_ci_remote.rb` in favor of `arduino_ci.rb` -**Fixed** +### Fixed - Don't define `ostream& operator<<(nullptr_t)` if already defined by Apple - `CppLibrary.in_tests_dir?` no longer produces an error if there is no tests directory - The definition of the `_SFR_IO8` macro no longer produces errors about rvalues @@ -171,30 +171,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.3.0] - 2019-09-03 -**Added** +### Added - Unit testing configuration now allows `exclude_dirs` to be set, which prevents stray source files from as part of unit testing allows ## [0.2.1] - 2019-08-12 -**Added** +### Added - Minimal Wire mocks. Will not provide support for unit testing I2C communication yet, but will allow compilation of libraries that use I2C. - `StreamTape` class now bridges `Stream` and `HardwareSerial` to allow general-purpose stream mocking & history -**Changed** +### Changed - Arduino command failures (to read preferences) now causes a fatal error, with help for troubleshooting the underlying command -**Fixed** +### Fixed - Arduino library dependencies are now installed prior to unit testing, instead of prior to compilation testing. Whoops. - Arduino library dependencies with spaces in their names are now handled properly during compilation -- spaces are automatically coerced to underscores ## [0.2.0] - 2019-02-20 -**Added** +### Added - `release-new-version.sh` script - outputs for `PinHistory` can now report timestamps - Fibonacci Clock for clock testing purposes (internal to this library) -**Changed** +### Changed - Shortened `ArduinoQueue` push and pop operations - `ci/Queue.h` is now `MockEventQueue.h`, with timing data - `MockEventQueue::Node` now contains struct `MockEventQueue::Event`, which contains both the templated type `T` and a field for a timestamp. @@ -204,46 +204,46 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `GodmodeState` is now a singleton pattern, which is necessary to support the globality of Arduino functions - `GodmodeState` now uses timestamped PinHistory for Analog and Digital -**Fixed** +### Fixed * `ArduinoQueue` no longer leaks memory ## [0.1.21] - 2019-02-07 -**Added** +### Added - Proper `ostream operator <<` for `nullptr` - Proper comparison operations for `nullptr` -**Changed** +### Changed - `Compare.h` heavily refactored to use a smallish macro -**Removed** +### Removed - Homegrown implementation of `nullptr` -**Fixed** +### Fixed - `nullptr` support (again) ## [0.1.20] - 2019-01-31 -**Fixed** +### Fixed - `unittest_setup()` and `unittest_teardown()` were not being executed for each unit test, only for the set of all tests. My bad. ## [0.1.19] - 2019-01-30 -**Added** +### Added - Added rspec sensitivity to the environment variable `$ARDUINO_CI_SELECT_CPP_TESTS=` (for `arduino_ci` gem hackers) - `assertNotNull()` and `assureNotNull()` C++ comparisons -**Changed** +### Changed - `CiConfig::allowable_unittest_files` now uses `Pathname` to full effect - `nullptr` now defined in its own class -**Fixed** +### Fixed - Assertions on `nullptr` - The definition of `nullptr` ## [0.1.18] - 2019-01-29 -**Added** +### Added - `ArduinoInstallation` and `ArduinoDownloader` now allow console output to optionally be set to an `IO` object of choice during `force_install` - `ArduinoInstallation::force_install` now optionally accepts a version string - `arduino_library_location.rb` script to print Arduino library location to stdout @@ -256,12 +256,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `nullptr` definition in C++ - `assertNull()` for unit tests -**Changed** +### Changed - Unit tests and examples are now executed alphabetically by filename - The `pgm_read_...` preprocessor macros in cpp/arduino/avr/pgmspace.h now expands to an expression with applicable type. - Unit tests for interrupts (`attachInterrupt` and `detachInterrupt`) get their own file -**Fixed** +### Fixed - Library installation no longer "fails" if the library is already installed - Platform definition for `mega2560` now includes proper AVR compiler flag - `CppLibrary::vendor_bundle?` now asks where gems are, instead of assuming `vendor/bundle/` @@ -269,39 +269,39 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.17] - 2019-01-14 -**Added** +### Added - Provide an `itoa` function. It is present in Arduino's runtime environment but not on most (all?) host systems because itoa is not a portable standard function. - `to_h` and `to_s` functions for `ci_config.rb` - `CIConfig::clone` - Ability to override `CIConfig` from a hash instead of just a file - `arduino_ci_remote.rb` now supports command line switches `--testfile-select=GLOB` and `--testfile-reject=GLOB` (which can both be repeated) -**Changed** +### Changed - Simplified the use of `Array.each` with a return statement; it's now simply `Array.find` - `autolocate!` for Arduino installations now raises `ArduinoInstallationError` if `force_install` fails - Errors due to missing YAML are now named `ConfigurationError` -**Fixed** +### Fixed - Determining a working OSX launch command no longer breaks on non-English installations - `arduino_ci_remote.rb` now honors selected and rejected test files ## [0.1.16] - 2019-01-06 -**Changed** +### Changed - Finally put some factorization into the `arduino_ci_remote.rb` script: testing unit and testing compilation are now standalone functions -**Removed** +### Removed - Unnecessary board changes during unit tests no longer happen -**Fixed** +### Fixed - Proper casting for `pgm_read_byte` ## [0.1.15] - 2019-01-04 -**Added** +### Added - Checking for (empty) set of platforms to build now precedes the check for examples to build; this avoids assuming that all libraries will have an example and dumping the file set when none are found -**Fixed** +### Fixed - Spaces in the names of project directores no longer cause unit test binaries to fail execution ### Fixed - Spaces in the names of project directories no longer cause unit test binaries to fail execution @@ -309,40 +309,40 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.14] - 2018-09-21 -**Added** +### Added - Arduino command wrapper now natively supports board manager URLs - `arduino_ci_remote.rb` checks for proper board manager URLs for requested platforms - `arduino_ci_remote.rb` reports on Arduino executable location - exposed `index_libraries` in `ArduinoCmd` so it can be used as an explicit build step -**Changed** +### Changed - Centralized file listing code in `arduino_ci_remote.rb` - `arduino_ci_remote.rb` is verbose about platforms, packages, and URLs -**Removed** +### Removed - Linux wrapper no longer bails out on long-running commands. That behavior was possible in Arduino 1.6.x that might pop up a graphical error message, but with the display manager removed this is no longer a concern ## [0.1.13] - 2018-09-19 -**Changed** +### Changed - `arduino_ci_remote.rb` now iterates over example platforms before examples (saves time) -**Fixed** +### Fixed - `arduino_ci_remote.rb` no longer crashes if `test/` directory doesn't exist ## [0.1.12] - 2018-09-13 -**Added** +### Added - Explicit `libasan` checking (reporting) in build script -**Fixed** +### Fixed - Test file `int main(){}` needed a CPP extension in order to properly compile - Fixed build script reporting for `inform()` when it returns a non-string value from its block - Don't count false returns from `inform()` blocks as failures ## [0.1.11] - 2018-09-13 -**Added** +### Added - Explicit checks that the requested test platforms are defined in YML - Arduino command wrapper can now guess whether a library is installed - CPP library class now reaches into included Arduino libraries for source files @@ -351,17 +351,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Copy constructor for `ArduinoCITable` - Some error information on failures to download the Arduino binary -**Changed** +### Changed - Refactored documentation - External libraries aren't forcibly installed via the Arduino binary (in `arduino_cmd_remote.rb`) if they appear to exist on disk already - `attachInterrupt` and `detachInterrupt` are now mocked instead of `_NOP` - Unit test binaries now run with debugging symbols and address sanitization (if available), to help isolate the causes of segfaults - `ArduinoCommand::libdir` logic is now centralized, using `sketchbook.path` from prefs instead of hard-coding -**Removed** +### Removed - Display Manager became no longer necessary with Arduino 1.8.X -**Fixed** +### Fixed - OSX splash screen re-disabled - ArduinoCITable didn't initialize its size on `clear()` - CPP file aggregation now ignores dotfiles @@ -372,7 +372,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.10] - 2018-05-06 -**Added** +### Added - Arduino `force_install` on Linux now attempts downloading 3 times and provides more information on failure - Explicit check for `wget` - Windows / Appveyor support, enabled largely by contributions from @tomduff @@ -381,17 +381,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Cross-platform symlinking in `Host` - OSX CI via Travis, with separate badges -**Changed** +### Changed - Author - Splash-screen-skip hack on OSX now falls back on "official" launch method if the hack doesn't work - Refactored download/install code in prepration for windows CI - Explicitly use 32-bit math for mocked Random() - Ruby-centric download and unzipping of Arduino IDE packages, now with progress dots -**Removed** +### Removed - `ArduinoDownloaderPosix` became empty, so it was removed -**Fixed** +### Fixed - `Gemfile.lock` files are properly ignored - Windows hosts won't try to open a display manager - `isnan` portability @@ -399,40 +399,40 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.9] - 2018-04-12 -**Added** +### Added - Explicit tests of `.arduino-ci.yml` in `TestSomething` example -**Fixed** +### Fixed - Malformed YAML (duplicate unittests section) now has no duplicate section - arduino_ci_remote.rb script now has correct arguments in build_for_test ## [0.1.8] - 2018-04-03 -**Added** +### Added - Definition of `LED_BUILTIN`, first reported by `dfrencham` on GitHub - Stubs for `tone` and `noTone`, first suggested by `dfrencham` on GitHub - Ability to specify multiple compilers for unit testing -**Fixed** +### Fixed - Compile errors / portability issues in `WString.h` and `Print.h`, first reported by `dfrencham` on GitHub - Compile errors / inheritance issues in `Print.h` and `Stream.h`, first reported by `dfrencham` on GitHub - Print functions for int, double, long, etc ## [0.1.7] - 2018-03-07 -**Changed** +### Changed - Queue and Table are now ArduinoCIQueue and ArduinoCITable to avoid name collisions ## [0.1.6] - 2018-03-07 -**Added** +### Added - `CppLibrary` can now report `gcc_version` -**Changed** +### Changed - `arduino_ci_remote.rb` now formats tasks with multiple output lines more nicely - Templates for CI classes are now pass-by-value (no const reference) -**Fixed** +### Fixed - Replaced pipes with `Open3.capture3` to avoid deadlocks when commands have too much output - `ci_config.rb` now returns empty arrays (instead of nil) for undefined config keys - `pgmspace.h` explicitly includes `` @@ -441,7 +441,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.5] - 2018-03-05 -**Added** +### Added - Yaml files can have either `.yml` or `.yaml` extensions - Yaml files support select/reject criteria for paths of unit tests for targeted testing - Pins now track history and can report it in Ascii (big- or little-endian) for digital sequences @@ -453,10 +453,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - ObservableDataStream and DataStreamObserver pattern implementation - DeviceUsingBytes and implementation of mocked serial device -**Changed** +### Changed - Unit test executables print to STDERR just in case there are segfaults. Uh, just in case I ever write any. -**Fixed** +### Fixed - OSX no longer experiences `javax.net.ssl.SSLKeyException: RSA premaster secret error` messages when downloading board package files - `arduino_ci_remote.rb` no longer makes unnecessary changes to the board being tested - Scripts no longer crash if there is no `test/` directory @@ -465,11 +465,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.4] - 2018-02-01 -**Added** -- Support for all builtin Math functions -- Support for all builtin Bits and Bytes functions +### Added +- Support for all builtin Math functions https://www.arduino.cc/reference/en/ +- Support for all builtin Bits and Bytes functions https://www.arduino.cc/reference/en/ - Support for GODMODE and time functions -- Support for Character functions +- Support for Character functions https://www.arduino.cc/reference/en/ - Mocks for `random` functions with seed control - Many original Arduino `#define`s - Mocks for pinMode, analog/digital read/write @@ -479,21 +479,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - All the IO stuff (pins, serial port support flags, etc) from the Arduino library - Support for Serial (backed by GODMODE) -**Changed** +### Changed - Made `wget` have quieter output ## [0.1.3] - 2018-01-25 -**Added** +### Added - C++ functions for `assure`; `assert`s will run tests and continue, `assure`s will abort on failures - Missing dotfiles in the `DoSomething` project have been committed -**Changed** +### Changed - `arduino_ci_remote.rb` doesn't attempt to set URLs if nothing needs to be downloaded - `arduino_ci_remote.rb` does unit tests first - `unittest_main()` is now the macro for the `int main()` of test files -**Fixed** +### Fixed - All test files were reporting "not ok" in TAP output. Now they are OK iff all asserts pass. - Directories with a C++ extension in their name could cause problems. Now they are ignored. - `CppLibrary` had trouble with symlinks. It shouldn't anymore. @@ -501,17 +501,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.2] - 2018-01-25 -**Fixed** +### Fixed - Actually package CPP and YAML files into the gem. Whoops. ## [0.1.1] - 2018-01-24 -**Added** +### Added - README documentation for the actual unit tests ## [0.1.0] - 2018-01-24 -**Added** +### Added - Unit testing support - Documentation for all Ruby methods - `ArduinoInstallation` class for managing lib / executable paths @@ -526,16 +526,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `CppLibrary` manages GCC for unittests - `CIConfig` manages overridable config for all testing -**Changed** +### Changed - `DisplayManger.with_display` doesn't `disable` if the display was enabled prior to starting the block -**Fixed** +### Fixed - Built gems are `.gitignore`d - Updated gems based on Github's security advisories ## [0.0.1] - 2018-01-10 -**Added** +### Added - Skeleton for gem with working unit tests From 8b90360ae4ca7101390d0582a2e13a85b2c5ede0 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 12:33:31 -0700 Subject: [PATCH 05/17] Beginning to test CPP, Markdown and YAML linters --- .github/workflows/linter.yaml | 7 ++++++- .markdownlint.json | 3 +++ CHANGELOG.md | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .markdownlint.json diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index d437d55f..ca387630 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -23,6 +23,11 @@ jobs: - name: Lint Code Base uses: github/super-linter/slim@v4 env: - VALIDATE_ALL_CODEBASE: false + VALIDATE_ALL_CODEBASE: true + FILTER_REGEX_EXCLUDE: ./cpp/arduino/avr/* DEFAULT_BRANCH: master GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_CPP: true + VALIDATE_MARKDOWN: true + VALIDATE_RUBY: true + VALIDATE_YAML: true diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 00000000..316ba781 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,3 @@ +{ + "no-duplicate-heading": "siblings_only" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a8068926..0550f874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,7 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Better indications of which example sketch is being compiled as part of testing ### Changed -- Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. +- Topmost installation instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. ### Changed - Topmost installation instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. - Stream::readStreamUntil() no longer returns delimiter @@ -302,7 +302,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Checking for (empty) set of platforms to build now precedes the check for examples to build; this avoids assuming that all libraries will have an example and dumping the file set when none are found ### Fixed -- Spaces in the names of project directores no longer cause unit test binaries to fail execution +- Spaces in the names of project directories no longer cause unit test binaries to fail execution ### Fixed - Spaces in the names of project directories no longer cause unit test binaries to fail execution - Configuration file overrides with `nil`s (or empty arrays) now properly override their base configuration From 15a7ebac721393280c6472eb9b6c54a9df1fd746 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 14:52:42 -0700 Subject: [PATCH 06/17] Linting for consistency for markdown --- .markdownlint.json | 3 --- .markdownlint.yml | 14 ++++++++++++++ CHANGELOG.md | 2 +- CONTRIBUTING.md | 4 ++-- README.md | 4 ++-- REFERENCE.md | 5 ++--- SampleProjects/DoSomething/README.md | 6 +++--- SampleProjects/DoSomething/test/README.md | 2 +- 8 files changed, 25 insertions(+), 15 deletions(-) delete mode 100644 .markdownlint.json create mode 100644 .markdownlint.yml diff --git a/.markdownlint.json b/.markdownlint.json deleted file mode 100644 index 316ba781..00000000 --- a/.markdownlint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "no-duplicate-heading": "siblings_only" -} \ No newline at end of file diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 00000000..12e88b08 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,14 @@ +--- +blanks-around-fences: false +blanks-around-headings: false +blanks-around-lists: false +commands-show-output: false +first-line-h1: false +line_length: + line_length: 600 +no-bare-urls: false +no-duplicate-heading: false +no-multiple-blanks: + maximum: 2 +ul-indent: + indent: 4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0550f874..9c4e3082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -205,7 +205,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `GodmodeState` now uses timestamped PinHistory for Analog and Digital ### Fixed -* `ArduinoQueue` no longer leaks memory +- `ArduinoQueue` no longer leaks memory ## [0.1.21] - 2019-02-07 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0a691e7..e8ac9750 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,8 +11,8 @@ ArduinoCI uses a very standard GitHub workflow. Pull requests will trigger a Travis CI job. The following two commands will be expected to pass (so you may want to run them locally before opening the pull request): - * `bundle exec rubocop -D .` - code style tests - * `bundle exec rspec` - functional tests +* `bundle exec rubocop -D .` - code style tests +* `bundle exec rspec` - functional tests If you do not already have a working ruby development environment set up, run the following commands: diff --git a/README.md b/README.md index 528f3d99..07a2eec9 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,8 @@ gem 'arduino_ci', path: '/path/to/development/dir/for/arduino_ci' ### Installing the Dependencies Fulfilling the `arduino_ci` library dependency is as easy as running either of these two commands: -``` + +```sh $ bundle install # adds packages to global library (may require admin rights) $ bundle install --path vendor/bundle # adds packages to local library ``` @@ -128,7 +129,6 @@ $ bundle install --path vendor/bundle # adds packages to local library This will create a `Gemfile.lock` in your project directory, which you may optionally check into source control. A broader introduction to ruby dependencies is outside the scope of this document. - ### Running `arduino_ci.rb` To Test Your Library With that installed, just the following shell command each time you want the tests to execute: diff --git a/REFERENCE.md b/REFERENCE.md index c248abd1..bb3f5f57 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -273,7 +273,7 @@ unittest_main() ``` -# Build Scripts +## Build Scripts For most build environments, the only script that need be executed by the CI system is @@ -314,8 +314,7 @@ bundle exec arduino_ci.rb Note the use of subshell to execute `bundle exec arduino_library_location.rb`. This command simply returns the directory in which Arduino Libraries are (or should be) installed. - -# Mocks of Arduino Hardware Functions +## Mocks of Arduino Hardware Functions Unless your library peforms something general (e.g. a mathematical or string function, a data structure like Queue, etc), you may need to ensure that your code interacts properly with the Arduino hardware. There are a series of mocks to assist in this. diff --git a/SampleProjects/DoSomething/README.md b/SampleProjects/DoSomething/README.md index 2d0877ae..b3452532 100644 --- a/SampleProjects/DoSomething/README.md +++ b/SampleProjects/DoSomething/README.md @@ -3,13 +3,13 @@ This project is a template for a CI-enabled (and unit testable) Arduino project of your own. -### Features +## Features * Travis CI * Unit tests * Development workflow matches CI workflow -# Where The Magic Happens +## Where The Magic Happens Here is the minimal set of files that you will need to adapt to your own project: @@ -104,6 +104,6 @@ unittest_main() This test defines one `unittest` (a macro provided by `ArduinoUnitTests.h`), called `your_test_name`, which makes some assertions on the target library. The `int main` section is boilerplate. -# Credits +## Credits This Arduino example was created in January 2018 by Ian Katz . diff --git a/SampleProjects/DoSomething/test/README.md b/SampleProjects/DoSomething/test/README.md index 1c958086..b34d6c4e 100644 --- a/SampleProjects/DoSomething/test/README.md +++ b/SampleProjects/DoSomething/test/README.md @@ -4,6 +4,6 @@ These files are designed to test the testing framework (the Ruby gem) itself, li ## Naming convention -Files in this directory are given names that either contains "bad" (if it is expected to fail) or "good" (if it is expected to pass). This provides a signal to `rspec` for how the code is expected to perform (see `spec/cpp_library_spec.rb`). +Files in this directory are given names that either contains "bad" (if it is expected to fail) or "good" (if it is expected to pass). This provides a signal to `rspec` for how the code is expected to perform (see `spec/cpp_library_spec.rb`). When writing your own tests you should not follow this ("bad" and "good") naming convention. You should write all your tests expecting them to pass (relying on this `DoSomething` test to ensure that failures are actually noticed!). From d413158b478a90b8213fc0552580982530705f71 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 15:33:50 -0700 Subject: [PATCH 07/17] Complete rules for cpplint --- .github/workflows/linter.yaml | 4 +++- CPPLINT.cfg | 3 +++ cpp/arduino/avr/CPPLINT.cfg | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 CPPLINT.cfg create mode 100644 cpp/arduino/avr/CPPLINT.cfg diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index ca387630..aa9e12c3 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -29,5 +29,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_CPP: true VALIDATE_MARKDOWN: true - VALIDATE_RUBY: true VALIDATE_YAML: true + # Also run with other tests + RUBY_CONFIG_FILE: .rubocop.yml + VALIDATE_RUBY: true diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 00000000..52dc44e4 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,3 @@ +set noparent +filter=-build/header_guard, -build/include, -build/include_order, -build/include_subdir, -build/include_what_you_use, -build/namespaces, -legal/copyright, -readability/alt_tokens, -readability/braces, -readability/casting, -readability/fn_size, -readability/inheritance, -readability/todo, -runtime/arrays, -runtime/explicit, -runtime/int, -runtime/printf, -runtime/references, -whitespace +linelength=120 diff --git a/cpp/arduino/avr/CPPLINT.cfg b/cpp/arduino/avr/CPPLINT.cfg new file mode 100644 index 00000000..c8f4fb0d --- /dev/null +++ b/cpp/arduino/avr/CPPLINT.cfg @@ -0,0 +1 @@ +exclude_files=.*\.h From 3be0c88b169dc15c37f1ce286a74bb9d5be34227 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 16:01:53 -0700 Subject: [PATCH 08/17] Remove ruby linting --- .github/workflows/linter.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index aa9e12c3..d5406507 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -30,6 +30,3 @@ jobs: VALIDATE_CPP: true VALIDATE_MARKDOWN: true VALIDATE_YAML: true - # Also run with other tests - RUBY_CONFIG_FILE: .rubocop.yml - VALIDATE_RUBY: true From 2e8d9c34b281669e15be57ef31442aa9afd47e6f Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 16:19:55 -0700 Subject: [PATCH 09/17] Fixing file name --- .markdownlint.yml => .markdown-lint.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .markdownlint.yml => .markdown-lint.yml (100%) diff --git a/.markdownlint.yml b/.markdown-lint.yml similarity index 100% rename from .markdownlint.yml rename to .markdown-lint.yml From 803238ec6b33c79f385d65ef028ba6318e3e8c99 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 16:29:15 -0700 Subject: [PATCH 10/17] Explicitly state the config file --- .github/workflows/linter.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index d5406507..ef42179b 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -29,4 +29,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_CPP: true VALIDATE_MARKDOWN: true + MARKDOWN_CONFIG_FILE: .markdown-lint.yml VALIDATE_YAML: true From 904e50f033b1e84dcd2eeb2ca581c10b0739f498 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 17:04:32 -0700 Subject: [PATCH 11/17] Try json format for config file --- .github/workflows/linter.yaml | 2 +- .markdown-lint.json | 18 ++++++++++++++++++ .markdown-lint.yml | 14 -------------- 3 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 .markdown-lint.json delete mode 100644 .markdown-lint.yml diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index ef42179b..52c0de7e 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -29,5 +29,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_CPP: true VALIDATE_MARKDOWN: true - MARKDOWN_CONFIG_FILE: .markdown-lint.yml + MARKDOWN_CONFIG_FILE: .markdown-lint.json VALIDATE_YAML: true diff --git a/.markdown-lint.json b/.markdown-lint.json new file mode 100644 index 00000000..aab6c73e --- /dev/null +++ b/.markdown-lint.json @@ -0,0 +1,18 @@ +{ + "blanks-around-fences": false, + "blanks-around-headings": false, + "blanks-around-lists": false, + "commands-show-output": false, + "first-line-h1": false, + "line_length": { + "line_length": 600 + }, + "no-bare-urls": false, + "no-duplicate-heading": false, + "no-multiple-blanks": { + "maximum": 2 + }, + "ul-indent": { + "indent": 4 + } +} \ No newline at end of file diff --git a/.markdown-lint.yml b/.markdown-lint.yml deleted file mode 100644 index 12e88b08..00000000 --- a/.markdown-lint.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -blanks-around-fences: false -blanks-around-headings: false -blanks-around-lists: false -commands-show-output: false -first-line-h1: false -line_length: - line_length: 600 -no-bare-urls: false -no-duplicate-heading: false -no-multiple-blanks: - maximum: 2 -ul-indent: - indent: 4 From f86e56c7afe98e04b1338d23ec4a7885b63a6ea2 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 17:11:00 -0700 Subject: [PATCH 12/17] Clean up and testing a new path --- .github/workflows/linter.yaml | 2 +- CHANGELOG.md | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 52c0de7e..329e0ff9 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -29,5 +29,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_CPP: true VALIDATE_MARKDOWN: true - MARKDOWN_CONFIG_FILE: .markdown-lint.json + MARKDOWN_CONFIG_FILE: /.markdown-lint.json VALIDATE_YAML: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c4e3082..2fdbffad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,8 +40,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Better indications of the build phases in the test runner `arduino_ci.rb` - Better indications of which example sketch is being compiled as part of testing -### Changed -- Topmost installation instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. ### Changed - Topmost installation instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. - Stream::readStreamUntil() no longer returns delimiter @@ -301,8 +299,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - Checking for (empty) set of platforms to build now precedes the check for examples to build; this avoids assuming that all libraries will have an example and dumping the file set when none are found -### Fixed -- Spaces in the names of project directories no longer cause unit test binaries to fail execution ### Fixed - Spaces in the names of project directories no longer cause unit test binaries to fail execution - Configuration file overrides with `nil`s (or empty arrays) now properly override their base configuration From c90405cae409dc08772792160c0b73ddc3465dcd Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 17:18:18 -0700 Subject: [PATCH 13/17] Needed linter rules root path with the new custom config --- .github/workflows/linter.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 329e0ff9..c1f20c3c 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -30,4 +30,5 @@ jobs: VALIDATE_CPP: true VALIDATE_MARKDOWN: true MARKDOWN_CONFIG_FILE: /.markdown-lint.json + MARKDOWN_LINTER_RULES: / VALIDATE_YAML: true From c874daa0960a503219801d35c05f711a9b82a038 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 17:20:32 -0700 Subject: [PATCH 14/17] Trying a different config option --- .github/workflows/linter.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index c1f20c3c..8ba46782 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -29,6 +29,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_CPP: true VALIDATE_MARKDOWN: true - MARKDOWN_CONFIG_FILE: /.markdown-lint.json - MARKDOWN_LINTER_RULES: / VALIDATE_YAML: true + LINTER_RULES_PATH: / + MARKDOWN_CONFIG_FILE: /.markdown-lint.json + \ No newline at end of file From 4448d4b7ac8984b83d12ce6acb64d1fb5f15e238 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Mon, 1 Nov 2021 17:33:06 -0700 Subject: [PATCH 15/17] Cleaned up the file endings --- .github/workflows/linter.yaml | 1 - .markdown-lint.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 8ba46782..78bb3234 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -32,4 +32,3 @@ jobs: VALIDATE_YAML: true LINTER_RULES_PATH: / MARKDOWN_CONFIG_FILE: /.markdown-lint.json - \ No newline at end of file diff --git a/.markdown-lint.json b/.markdown-lint.json index aab6c73e..0ec76151 100644 --- a/.markdown-lint.json +++ b/.markdown-lint.json @@ -15,4 +15,4 @@ "ul-indent": { "indent": 4 } -} \ No newline at end of file +} From 1f1c292e45d730f40139b9e2997944372b489556 Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Wed, 3 Nov 2021 13:26:03 -0700 Subject: [PATCH 16/17] Removing a few linter changes. --- .markdown-lint.json | 2 ++ README.md | 2 +- REFERENCE.md | 4 ++-- cpp/arduino/avr/CPPLINT.cfg | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.markdown-lint.json b/.markdown-lint.json index 0ec76151..5488151a 100644 --- a/.markdown-lint.json +++ b/.markdown-lint.json @@ -4,6 +4,7 @@ "blanks-around-lists": false, "commands-show-output": false, "first-line-h1": false, + "header-increment": false, "line_length": { "line_length": 600 }, @@ -12,6 +13,7 @@ "no-multiple-blanks": { "maximum": 2 }, + "single-h1": false, "ul-indent": { "indent": 4 } diff --git a/README.md b/README.md index 07a2eec9..d8c84294 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ gem 'arduino_ci', path: '/path/to/development/dir/for/arduino_ci' Fulfilling the `arduino_ci` library dependency is as easy as running either of these two commands: -```sh +```console $ bundle install # adds packages to global library (may require admin rights) $ bundle install --path vendor/bundle # adds packages to local library ``` diff --git a/REFERENCE.md b/REFERENCE.md index bb3f5f57..1253e914 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -273,7 +273,7 @@ unittest_main() ``` -## Build Scripts +# Build Scripts For most build environments, the only script that need be executed by the CI system is @@ -314,7 +314,7 @@ bundle exec arduino_ci.rb Note the use of subshell to execute `bundle exec arduino_library_location.rb`. This command simply returns the directory in which Arduino Libraries are (or should be) installed. -## Mocks of Arduino Hardware Functions +# Mocks of Arduino Hardware Functions Unless your library peforms something general (e.g. a mathematical or string function, a data structure like Queue, etc), you may need to ensure that your code interacts properly with the Arduino hardware. There are a series of mocks to assist in this. diff --git a/cpp/arduino/avr/CPPLINT.cfg b/cpp/arduino/avr/CPPLINT.cfg index c8f4fb0d..9bf134a9 100644 --- a/cpp/arduino/avr/CPPLINT.cfg +++ b/cpp/arduino/avr/CPPLINT.cfg @@ -1 +1,3 @@ -exclude_files=.*\.h +# The files in this directory have been copied from Arduino. +# This file configures cpplint to ignore all files in this directory. +exclude_files=.* From 65bad8f3e1678d27b41da622a89dce2a297b375b Mon Sep 17 00:00:00 2001 From: Preston Carman Date: Wed, 3 Nov 2021 13:32:35 -0700 Subject: [PATCH 17/17] Removing more linting changes --- SampleProjects/DoSomething/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SampleProjects/DoSomething/README.md b/SampleProjects/DoSomething/README.md index b3452532..2d0877ae 100644 --- a/SampleProjects/DoSomething/README.md +++ b/SampleProjects/DoSomething/README.md @@ -3,13 +3,13 @@ This project is a template for a CI-enabled (and unit testable) Arduino project of your own. -## Features +### Features * Travis CI * Unit tests * Development workflow matches CI workflow -## Where The Magic Happens +# Where The Magic Happens Here is the minimal set of files that you will need to adapt to your own project: @@ -104,6 +104,6 @@ unittest_main() This test defines one `unittest` (a macro provided by `ArduinoUnitTests.h`), called `your_test_name`, which makes some assertions on the target library. The `int main` section is boilerplate. -## Credits +# Credits This Arduino example was created in January 2018 by Ian Katz .