From 195a1d06c903c5a4085c99c8118b0b9c8a87dc9b Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 04:37:29 -0700 Subject: [PATCH 1/6] Configure Dependabot to check for outdated actions used in workflows Dependabot will periodically check the versions of all actions used in the repository's workflows. If any are found to be outdated, it will submit a pull request to update them. NOTE: Dependabot's PRs will sometimes try to pin to the patch version of the action (e.g., updating `uses: foo/bar@v1` to `uses: foo/bar@v2.3.4`). When the action author has provided a major version ref, use that instead (e.g., `uses: foo/bar@v2`). Dependabot will automatically close its PR once the workflow has been updated. More information: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..03600dd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file +version: 2 + +updates: + # Configure check for outdated GitHub Actions actions in workflows. + # See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot + - package-ecosystem: github-actions + directory: / # Check the repository's workflows under /.github/workflows/ + schedule: + interval: daily From 6717e0c45228ad1f044878ec2d07e8fd3418bfbf Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 04:40:32 -0700 Subject: [PATCH 2/6] Update "smoke test" examples compilation CI workflow On every push or pull request that affects library source or example files, and periodically, compile all example sketches for the specified boards. --- .github/workflows/compile-examples.yml | 93 +++++++++++++++++++++----- README.md | 2 +- 2 files changed, 78 insertions(+), 17 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 83ad23e..ccc1c57 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -1,20 +1,81 @@ name: Compile Examples -on: [push, pull_request] + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + pull_request: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms). + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + jobs: - build: - runs-on: ubuntu-latest + build: + name: ${{ matrix.board.fqbn }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + board: + - fqbn: arduino:samd:arduino_zero_edbg + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkr1000 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrzero + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwifi1010 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrfox1200 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwan1300 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwan1310 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrgsm1400 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrnb1500 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrvidor4000 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:nano_33_iot + platforms: | + - name: arduino:samd + + steps: + - name: Checkout repository + uses: actions/checkout@v2 - strategy: - matrix: - fqbn: [ - "arduino:samd:mkrzero" - ] + - name: Compile examples + uses: arduino/compile-sketches@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fqbn: ${{ matrix.board.fqbn }} + platforms: ${{ matrix.board.platforms }} + libraries: | + # Install the library from the local path. + - source-path: ./ + - name: SD + sketch-paths: | + - examples - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - uses: arduino/actions/libraries/compile-examples@master - with: - fqbn: ${{ matrix.fqbn }} - libraries: SD diff --git a/README.md b/README.md index ed7d056..b941306 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ArduinoSound -[![Compile Examples Status](https://github.com/arduino-libraries/ArduinoSound/workflows/Compile%20Examples/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions?workflow=Compile+Examples) [![Spell Check Status](https://github.com/arduino-libraries/ArduinoSound/workflows/Spell%20Check/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions?workflow=Spell+Check) +[![Compile Examples status](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/compile-examples.yml) A simple way to play and analyze audio data using Arduino. Currently only supports SAMD21 boards and I2S audio devices. From 4c9406d276ab40a6e0fdc6f74921ecfc0a277f9d Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 04:40:48 -0700 Subject: [PATCH 3/6] Report changes in memory usage that would result from merging a PR On creation or commit to a pull request, a report of the resulting change in memory usage of the examples will be commented to the PR thread. --- .github/workflows/compile-examples.yml | 11 +++++++++++ .github/workflows/report-size-deltas.yml | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index ccc1c57..18ead85 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -23,6 +23,9 @@ jobs: name: ${{ matrix.board.fqbn }} runs-on: ubuntu-latest + env: + SKETCHES_REPORTS_PATH: sketches-reports + strategy: fail-fast: false @@ -78,4 +81,12 @@ jobs: - name: SD sketch-paths: | - examples + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + - name: Save sketches report as workflow artifact + uses: actions/upload-artifact@v2 + with: + if-no-files-found: error + path: ${{ env.SKETCHES_REPORTS_PATH }} + name: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml new file mode 100644 index 0000000..652be5d --- /dev/null +++ b/.github/workflows/report-size-deltas.yml @@ -0,0 +1,24 @@ +name: Report Size Deltas + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/report-size-deltas.yml" + schedule: + # Run at the minimum interval allowed by GitHub Actions. + # Note: GitHub Actions periodically has outages which result in workflow failures. + # In this event, the workflows will start passing again once the service recovers. + - cron: "*/5 * * * *" + workflow_dispatch: + repository_dispatch: + +jobs: + report: + runs-on: ubuntu-latest + steps: + - name: Comment size deltas reports to PRs + uses: arduino/report-size-deltas@v1 + with: + # The name of the workflow artifact created by the sketch compilation workflow + sketches-reports-source: sketches-reports From 2e48cfe379206452076d5934eea35b0ac3cf9057 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 04:41:08 -0700 Subject: [PATCH 4/6] Add CI workflow to check for commonly misspelled words On every push, pull request, and periodically, use the codespell-project/actions-codespell action to check for commonly misspelled words. In the event of a false positive, the problematic word should be added, in all lowercase, to the ignore-words-list field of ./.codespellrc. Regardless of the case of the word in the false positive, it must be in all lowercase in the ignore list. The ignore list is comma-separated with no spaces. --- .codespellrc | 7 +++++++ .github/workflows/spell-check.yml | 29 ++++++++++++++++++++--------- README.md | 1 + 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..101edae --- /dev/null +++ b/.codespellrc @@ -0,0 +1,7 @@ +# See: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = , +check-filenames = +check-hidden = +skip = ./.git diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 7b45d77..01bee87 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -1,11 +1,22 @@ name: Spell Check -on: [push, pull_request] + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + pull_request: + schedule: + # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - uses: arduino/actions/libraries/spell-check@master + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Spell check + uses: codespell-project/actions-codespell@master diff --git a/README.md b/README.md index b941306..938e950 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # ArduinoSound [![Compile Examples status](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/compile-examples.yml) +[![Spell Check status](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/spell-check.yml) A simple way to play and analyze audio data using Arduino. Currently only supports SAMD21 boards and I2S audio devices. From bc6d99a0d9d074e3406a2d97defd8c43ff456051 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 04:54:39 -0700 Subject: [PATCH 5/6] Correct typos in comments and documentation --- .../AmplitudeSerialPlotter.ino | 20 +++++++++---------- examples/ClapDetector/ClapDetector.ino | 16 +++++++-------- .../SpectrumSerialPlotter.ino | 20 +++++++++---------- examples/WavePlayback/WavePlayback.ino | 12 +++++------ examples/WhistleDetector/WhistleDetector.ino | 18 ++++++++--------- src/SDWaveFile.cpp | 2 +- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/examples/AmplitudeSerialPlotter/AmplitudeSerialPlotter.ino b/examples/AmplitudeSerialPlotter/AmplitudeSerialPlotter.ino index 394c9e2..bc5309a 100644 --- a/examples/AmplitudeSerialPlotter/AmplitudeSerialPlotter.ino +++ b/examples/AmplitudeSerialPlotter/AmplitudeSerialPlotter.ino @@ -1,17 +1,17 @@ /* - This example reads audio data from an Invensense's ICS43432 I2S microphone - breakout board, and prints out the amplitude to the Serial console. The - Serial Plotter built into the Arduino IDE can be used to plot the audio - amplitude data (Tools -> Serial Plotter) + This example reads audio data from an InvenSense ICS-43432 I2S microphone + breakout board, and prints out the amplitude to the Serial Monitor. The + Serial Plotter built into the Arduino IDE (Tools -> Serial Plotter) can be + used to plot the audio amplitude data. Circuit: - * Arduino/Genuino Zero, MKRZero or MKR1000 board - * ICS43432: + * Arduino Zero, MKR Zero or MKR1000 board + * ICS-43432: * GND connected GND - * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKRZero) - * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) - * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) - * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) + * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKR Zero) + * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKR Zero) + * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKR Zero) + * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKR Zero) created 23 November 2016 by Sandeep Mistry diff --git a/examples/ClapDetector/ClapDetector.ino b/examples/ClapDetector/ClapDetector.ino index 8442b83..950030a 100644 --- a/examples/ClapDetector/ClapDetector.ino +++ b/examples/ClapDetector/ClapDetector.ino @@ -1,16 +1,16 @@ /* - This example reads audio data from an Invensense's ICS43432 I2S microphone + This example reads audio data from an InvenSense ICS-43432 I2S microphone breakout board, and uses the input to detect clapping sounds. An LED is - togggled when a clapp is detected. + toggled when a clap is detected. Circuit: - * Arduino/Genuino Zero, MKRZero or MKR1000 board - * ICS43432: + * Arduino Zero, MKR Zero or MKR1000 board + * ICS-43432: * GND connected GND - * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKRZero) - * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) - * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) - * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) + * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKR Zero) + * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKR Zero) + * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKR Zero) + * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKR Zero) created 18 November 2016 by Sandeep Mistry diff --git a/examples/SpectrumSerialPlotter/SpectrumSerialPlotter.ino b/examples/SpectrumSerialPlotter/SpectrumSerialPlotter.ino index 7529541..69d36c7 100644 --- a/examples/SpectrumSerialPlotter/SpectrumSerialPlotter.ino +++ b/examples/SpectrumSerialPlotter/SpectrumSerialPlotter.ino @@ -1,17 +1,17 @@ /* - This example reads audio data from an Invensense's ICS43432 I2S microphone - breakout board, and prints out the spectrum to the Serial console. The - Serial Plotter built into the Arduino IDE can be used to plot the audio - amplitude data (Tools -> Serial Plotter) + This example reads audio data from an InvenSense ICS-43432 I2S microphone + breakout board, and prints out the spectrum to the Serial Monitor. The + Serial Plotter built into the Arduino IDE (Tools -> Serial Plotter) can be + used to plot the audio amplitude data. Circuit: - * Arduino/Genuino Zero, MKRZero or MKR1000 board - * ICS43432: + * Arduino Zero, MKR Zero or MKR1000 board + * ICS-43432: * GND connected GND - * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKRZero) - * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) - * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) - * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) + * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKR Zero) + * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKR Zero) + * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKR Zero) + * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKR Zero) created 21 November 2016 by Sandeep Mistry diff --git a/examples/WavePlayback/WavePlayback.ino b/examples/WavePlayback/WavePlayback.ino index 6ccf8d4..ba8084b 100644 --- a/examples/WavePlayback/WavePlayback.ino +++ b/examples/WavePlayback/WavePlayback.ino @@ -1,16 +1,16 @@ /* This reads a wave file from an SD card and plays it using the I2S interface to - a MAX08357 I2S Amp Breakout board. + a MAX98357 I2S Amp Breakout board. Circuit: - * Arduino/Genuino Zero, MKRZero or MKR1000 board + * Arduino Zero, MKR Zero or MKR1000 board * SD breakout or shield connected - * MAX08357: + * MAX98357: * GND connected GND * VIN connected 5V - * LRC connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) - * BCLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) - * DIN connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) + * LRC connected to pin 0 (Zero) or pin 3 (MKR1000, MKR Zero) + * BCLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKR Zero) + * DIN connected to pin 9 (Zero) or pin A6 (MKR1000, MKR Zero) created 15 November 2016 by Sandeep Mistry diff --git a/examples/WhistleDetector/WhistleDetector.ino b/examples/WhistleDetector/WhistleDetector.ino index 57c7cbf..3bcab0a 100644 --- a/examples/WhistleDetector/WhistleDetector.ino +++ b/examples/WhistleDetector/WhistleDetector.ino @@ -1,17 +1,17 @@ /* - This example reads audio data from an Invensense's ICS43432 I2S microphone + This example reads audio data from an InvenSense ICS-43432 I2S microphone breakout board, and uses the input to detect whistling sounds at a particular - frequency. When a whistle is detected, it's level is used to control the - brightness of an LED + frequency. When a whistle is detected, its level is used to control the + brightness of an LED. Circuit: - * Arduino/Genuino Zero, MKRZero or MKR1000 board - * ICS43432: + * Arduino Zero, MKR Zero or MKR1000 board + * ICS-43432: * GND connected GND - * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKRZero) - * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) - * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) - * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) + * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKR Zero) + * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKR Zero) + * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKR Zero) + * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKR Zero) created 30 November 2016 by Sandeep Mistry diff --git a/src/SDWaveFile.cpp b/src/SDWaveFile.cpp index 266084a..f20cad2 100644 --- a/src/SDWaveFile.cpp +++ b/src/SDWaveFile.cpp @@ -150,7 +150,7 @@ int SDWaveFile::cue(long time) offset = 0; } - // make sure it's multiple of 512 + // make sure it's a multiple of 512 offset = (offset / 512) * 512; if ((uint32_t)offset > _file.size()) { From 7d525b50bba1d40b69e0014a069a606113284b8d Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 04:54:55 -0700 Subject: [PATCH 6/6] Add CI workflow to do Arduino project-specific linting On every push, pull request, and periodically, run Arduino Lint to check for common problems not related to the project code. --- .github/workflows/check-arduino.yml | 28 ++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/check-arduino.yml diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml new file mode 100644 index 0000000..0d969f6 --- /dev/null +++ b/.github/workflows/check-arduino.yml @@ -0,0 +1,28 @@ +name: Check Arduino + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + pull_request: + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Arduino Lint + uses: arduino/arduino-lint-action@v1 + with: + compliance: specification + library-manager: update + # Always use this setting for official repositories. Remove for 3rd party projects. + official: true + project-type: library diff --git a/README.md b/README.md index 938e950..5e8b15b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # ArduinoSound +[![Check Arduino status](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/check-arduino.yml) [![Compile Examples status](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/compile-examples.yml) [![Spell Check status](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoSound/actions/workflows/spell-check.yml)