From 5e8a67523c4c13321eb634e53ba676ecfd6020d5 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:24:05 -0700 Subject: [PATCH 01/11] 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 00000000..03600dd7 --- /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 0fbf80d037f15eec6c6f3241e6cb825e14451f57 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:24:44 -0700 Subject: [PATCH 02/11] 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 00000000..0d969f6c --- /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 ba80cf02..3ed97ab7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Arduino Library for network connections management ![](https://github.com/arduino-libraries/Arduino_ConnectionHandler/workflows/Compile%20Examples/badge.svg) ![](https://github.com/arduino-libraries/Arduino_ConnectionHandler/workflows/Spell%20Check/badge.svg) +[![Check Arduino status](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/check-arduino.yml) Library for handling and managing network connections by providing keep-alive functionality and automatic reconnection in case of connection-loss. It supports the following boards: * **WiFi**: [`MKR 1000`](https://store.arduino.cc/arduino-mkr1000-wifi), [`MKR WiFi 1010`](https://store.arduino.cc/arduino-mkr-wifi-1010), [`Nano 33 IoT`](https://store.arduino.cc/arduino-nano-33-iot), `ESP8266` From 990b099fe8d7b7f465322720da282023a73ecdfa Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:25:37 -0700 Subject: [PATCH 03/11] Update 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 | 28 +++++++++++++++++--------- extras/codespell-ignore-words-list.txt | 1 - 3 files changed, 25 insertions(+), 11 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 00000000..15692792 --- /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 = wan +check-filenames = +check-hidden = +skip = ./.git diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index b7be756a..01bee879 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -1,14 +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 + spellcheck: + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - uses: arduino/actions/libraries/spell-check@master - with: - ignore-words-list: extras/codespell-ignore-words-list.txt + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Spell check + uses: codespell-project/actions-codespell@master diff --git a/extras/codespell-ignore-words-list.txt b/extras/codespell-ignore-words-list.txt deleted file mode 100644 index a991d7cd..00000000 --- a/extras/codespell-ignore-words-list.txt +++ /dev/null @@ -1 +0,0 @@ -wan \ No newline at end of file From 8baf23e53083b01e75ceefd73016265dc3925c42 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:26:06 -0700 Subject: [PATCH 04/11] 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.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3ed97ab7..ffe7c2c6 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ Arduino Library for network connections management ================================================== -![](https://github.com/arduino-libraries/Arduino_ConnectionHandler/workflows/Compile%20Examples/badge.svg) -![](https://github.com/arduino-libraries/Arduino_ConnectionHandler/workflows/Spell%20Check/badge.svg) [![Check Arduino status](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/check-arduino.yml) +[![Compile Examples status](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/compile-examples.yml) +[![Spell Check status](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ConnectionHandler/actions/workflows/spell-check.yml) Library for handling and managing network connections by providing keep-alive functionality and automatic reconnection in case of connection-loss. It supports the following boards: * **WiFi**: [`MKR 1000`](https://store.arduino.cc/arduino-mkr1000-wifi), [`MKR WiFi 1010`](https://store.arduino.cc/arduino-mkr-wifi-1010), [`Nano 33 IoT`](https://store.arduino.cc/arduino-nano-33-iot), `ESP8266` From 70c5fc56997811157df8fb418f4be90f802f132e Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:27:42 -0700 Subject: [PATCH 05/11] 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 | 5 +++++ .github/workflows/report-size-deltas.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 88f07208..ffcb6b9c 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -11,6 +11,11 @@ on: - ".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: diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index 8af849fe..6805ac0e 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -1,8 +1,13 @@ name: Report PR Size Deltas on: + push: + paths: + - ".github/workflows/report-size-deltas.yml" schedule: - cron: '*/5 * * * *' + workflow_dispatch: + repository_dispatch: jobs: report: From 024a5db543c5dbc01107cabb878e44dfad5c2fb8 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:28:15 -0700 Subject: [PATCH 06/11] 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 ffcb6b9c..af8172f0 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -19,6 +19,7 @@ on: jobs: build: + name: ${{ matrix.board.fqbn }} runs-on: ubuntu-latest env: From 9fb37dedc8d066ca74b68bcad753deba2f517e3c Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:28:54 -0700 Subject: [PATCH 07/11] Update GitHub Actions action versions used in workflows 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index af8172f0..d2783054 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -83,9 +83,7 @@ jobs: source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 + - uses: actions/checkout@v2 # It's necessary to checkout the platform before installing it so that the ArduinoCore-API dependency can be added - name: Checkout ArduinoCore-mbed @@ -116,7 +114,7 @@ jobs: run: pip3 install pyserial - name: Compile examples - uses: arduino/compile-sketches@main + uses: arduino/compile-sketches@v1 with: platforms: ${{ matrix.platforms }} fqbn: ${{ matrix.board.fqbn }} @@ -127,7 +125,7 @@ jobs: - name: Save memory usage change report as artifact if: github.event_name == 'pull_request' - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: ${{ env.SKETCHES_REPORTS_PATH }} path: ${{ env.SKETCHES_REPORTS_PATH }} From 1d47c70802cb0d8fc2e51b390f24ee79f1376111 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:29:43 -0700 Subject: [PATCH 08/11] Use report size deltas action from dedicated repository The arduino/actions repository is used for hosting GitHub Actions that are in an experimental state. The report size deltas action has since been deemed valuable and mature enough to be moved to a dedicated repository. The action at the previous location is preserved for now for the sake of backwards compatibility, but is deprecated and unmaintained. All workflows should be updated to using the arduino/report-size-deltas action. --- .github/workflows/report-size-deltas.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index 6805ac0e..274e2c1a 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -15,4 +15,4 @@ jobs: steps: - name: Comment size deltas reports to PRs - uses: arduino/actions/libraries/report-size-deltas@master + uses: arduino/report-size-deltas@v1 From 4ac8d440e8d61244223a96f4f11cfc33d202ed63 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:32:35 -0700 Subject: [PATCH 09/11] Run examples compilation CI workflow on changes to library.properties The library.properties metadata file can have an impact on compilation, so the CI workflow should run when it's changed in order to assist in validation of those changes. --- .github/workflows/compile-examples.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index d2783054..ba295154 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -4,11 +4,13 @@ on: pull_request: paths: - ".github/workflows/compile-examples.yml" + - "library.properties" - "examples/**" - "src/**" push: paths: - ".github/workflows/compile-examples.yml" + - "library.properties" - "examples/**" - "src/**" schedule: From 78ab9ebb979048ad79f533b6f189b38f743d9040 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:32:58 -0700 Subject: [PATCH 10/11] =?UTF-8?q?Configure=20workflow=20artifact=20upload?= =?UTF-8?q?=20step=20to=20fail=20if=20sketches=20report=20fi=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …le 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 ba295154..8d14e431 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -129,5 +129,6 @@ jobs: if: github.event_name == 'pull_request' uses: actions/upload-artifact@v2 with: + if-no-files-found: error name: ${{ env.SKETCHES_REPORTS_PATH }} path: ${{ env.SKETCHES_REPORTS_PATH }} From 62c13953eba3b4a9a8d9b5d3a97b3b35078eec2f Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 17 Apr 2021 19:33:31 -0700 Subject: [PATCH 11/11] Define name of sketches reports workflow artifact Even though this is already the default value, relying on the default is a bit risky due to the need to specify the artifact name to the actions/upload-artifact action in the sketch compilation workflow. --- .github/workflows/report-size-deltas.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index 274e2c1a..91730129 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -16,3 +16,6 @@ jobs: 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