From 9b21eb708b0886ab2ccda4a9ecf239d247ec3cd6 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:44:16 -0700 Subject: [PATCH 1/8] 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 6dfc9045281be5cb6b26fd53631c33604debb912 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:45:49 -0700 Subject: [PATCH 2/8] Use .codespellrc file to configure spell check The recent 2.0.0 release of the codespell tool used by the "Spell Check" CI workflow added support for configuring the tool via a configuration file. Use of this file allows the spell check to easily be run by contributors locally with the identical configuration as will be done in the CI. It replaces extras/codespell-ignore-words-list.txt. --- .codespellrc | 7 +++++++ .github/workflows/spell-check.yml | 6 ------ extras/codespell-ignore-words-list.txt | 0 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 .codespellrc delete mode 100644 extras/codespell-ignore-words-list.txt 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 b670567..03d26c0 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -18,9 +18,3 @@ jobs: # See: https://github.com/codespell-project/actions-codespell/blob/master/README.md - name: Spell check uses: codespell-project/actions-codespell@master - with: - check_filenames: true - check_hidden: true - # In the event of a false positive, add the word in all lower case to this file: - ignore_words_file: extras/codespell-ignore-words-list.txt - skip: ./.git diff --git a/extras/codespell-ignore-words-list.txt b/extras/codespell-ignore-words-list.txt deleted file mode 100644 index e69de29..0000000 From c9c9c83711d82ce8cd24ab13b997c3cce888f2dc Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:46:29 -0700 Subject: [PATCH 3/8] Update badges markup in readme Since the time the original badges were added, GitHub added support for referencing the workflows via file name in addition to the previous approach of using the `name` value. This links to the specific workflow's runs, rather than a search for the name which might return multiple results. It is also more lightweight in terms of syntax. --- README.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index 3058074..85a7634 100755 --- a/README.adoc +++ b/README.adoc @@ -4,8 +4,8 @@ = {repository-name} library for Arduino = -image:https://github.com/{repository-owner}/{repository-name}/workflows/Compile%20Examples/badge.svg["Compile Examples Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Compile+Examples"] -image:https://github.com/{repository-owner}/{repository-name}/workflows/Spell%20Check/badge.svg["Spell Check Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Spell+Check"] +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml/badge.svg["Compile Examples status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml"] +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"] The {repository-name} library enables an Arduino SAMD Board (e.g., https://store.arduino.cc/catalogsearch/result/?q=mkr[MKR boards], https://store.arduino.cc/arduino-nano-33-iot[Nano 33 IoT], https://store.arduino.cc/arduino-zero[Zero]) to play back .wav files from a storage device like an SD card to the `DAC0`/`A0` pin. For more information about this library please visit us at From 6608e53c41e3146989c54ecb86f614129089f4b2 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:47:11 -0700 Subject: [PATCH 4/8] Add additional trigger events to CI workflows The workflow_dispatch and repository_dispatch events allow manual triggering of the workflow. These can be useful when doing development and maintenance on the CI system, and do no harm when they are not needed, so it makes sense to add them. --- .github/workflows/compile-examples.yml | 1 + .github/workflows/report-size-deltas.yml | 1 + .github/workflows/spell-check.yml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index d3c8181..08d8655 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -16,6 +16,7 @@ on: - cron: "0 3 * * 2" # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch workflow_dispatch: + repository_dispatch: jobs: build: diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index fa5a566..cbf3443 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -5,6 +5,7 @@ on: - cron: "*/5 * * * *" # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch workflow_dispatch: + repository_dispatch: jobs: report: diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 03d26c0..cb681e0 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -6,6 +6,8 @@ on: schedule: # run every Tuesday at 3 AM UTC - cron: "0 3 * * 2" + workflow_dispatch: + repository_dispatch: jobs: spellcheck: From 8539300a568fa0957f021918223b6cdf192287f9 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:47:47 -0700 Subject: [PATCH 5/8] Use custom matrix job names in sketch compilation CI job The "Compile Examples" GitHub Actions workflow generates a matrix job for each board. The default job name is generated from the job's matrix object. This contains the complete board data, which results in a long and somewhat cryptic job name that can make the workflow run more difficult to interpret. The only necessary information is the FQBN. A custom job name allows for only using this information in the job name. --- .github/workflows/compile-examples.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 08d8655..47215f1 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -20,6 +20,7 @@ on: jobs: build: + name: ${{ matrix.fqbn }} runs-on: ubuntu-latest env: From e42e11bc62a22b33cb1d7e1e85d855966bcd441e Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:48:37 -0700 Subject: [PATCH 6/8] Use major version refs of sketch compilation actions Previously, due to the lack of a release, the development versions of the sketch compilation actions were used. Using release versions provides a more stable CI system for the ArduinoCore-mbed project. Use of the major version ref will cause the workflow to benefit from ongoing development to the actions up until such time as a new major release of an action is made, at which time we would need to evaluate whether any changes to the workflow are required by the breaking change that triggered the major release before updating the major ref (e.g., uses: `arduino/compile-sketches@v2`). --- .github/workflows/compile-examples.yml | 2 +- .github/workflows/report-size-deltas.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 47215f1..26dc4e1 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -48,7 +48,7 @@ jobs: uses: actions/checkout@v2 - name: Compile examples - uses: arduino/compile-sketches@main + uses: arduino/compile-sketches@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} fqbn: ${{ matrix.fqbn }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index cbf3443..51b1f7c 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Comment size deltas reports to PRs - uses: arduino/report-size-deltas@main + uses: arduino/report-size-deltas@v1 with: # The name of the workflow artifact created by the "Compile Examples" workflow sketches-reports-source: sketches-reports From 59ae5a76abc183fc12eeb385880fc6dbb362a948 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:49:37 -0700 Subject: [PATCH 7/8] Configure workflow artifact upload step to fail if sketches report file not found This event would indicate that the workflow was misconfigured. So it's a valuable notification. --- .github/workflows/compile-examples.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 26dc4e1..63ef4db 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -65,4 +65,5 @@ jobs: uses: actions/upload-artifact@v2 with: name: ${{ env.SKETCHES_REPORTS_PATH }} + if-no-files-found: error path: ${{ env.SKETCHES_REPORTS_PATH }} From 143d8209dbe207a2b7ad4d8e8a7c3f70b92a8c9b Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 14 Apr 2021 04:51:52 -0700 Subject: [PATCH 8/8] 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.adoc | 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.adoc b/README.adoc index 85a7634..547433f 100755 --- a/README.adoc +++ b/README.adoc @@ -4,6 +4,7 @@ = {repository-name} library for Arduino = +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml/badge.svg["Check Arduino status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml"] image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml/badge.svg["Compile Examples status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml"] image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"]