Skip to content

Expand CI system #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 23, 2021
Merged

Expand CI system #21

merged 15 commits into from
Sep 23, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Sep 22, 2021

Update "Compile Examples" workflow

The "smoke test" sketch compilation CI workflow is brought into sync with the workflow template:

https://github.com/per1234/.github/blob/main/workflow-templates/compile-platform-examples-private.md

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.

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.


Resolves #18

Some fields of the library.properties metadata file can affect compilation, so the workflow should run when it has
been modified.
Run the workflow weekly to catch compilation failures caused by external changes (e.g., Arduino Mbed OS Boards,
ArduinoCore-API).
The `workflow_dispatch` and `repository_dispatch` events allow manual triggering of the workflow.

These can be useful to immediately check for impacts of changes to external resources. They do no harm when they are not
needed, so there is no reason not to have them in place to be ready for when they might be needed.
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.
This comment referred to a since removed line of the workflow that checked out the `namespace_arduino` branch of
ArduinoCore-API, which has since become unnecessary. The comment was not removed when the configuration was updated and
now might cause confusion.
The `arduino/compile-sketches` action produces a report of the results of the compilations. The primary usage of this
report is to generate the size deltas comment that is made to pull requests. Although that can only be done for pull
requests, it might be that the compilation report is found useful for other purposes, in which case it is just as
relevant when triggered by non-PR events.

Always uploading the compilation report also makes the workflow a little more simple.
The "arduino/compile-sketches` GitHub Actions action generates a report of the results of the compilations as a JSON file.
This file is uploaded as a workflow run artifact, which is later consumed by the `arduino/report-size-deltas` action.

By default, the `actions/upload-artifact` used for the upload step does not require the target file to exist. In this
usage, the report file should always exist. If not, it indicates something is seriously wrong and the workflow run should
fail to bring this to our attention rather than silently ignoring it.
The previous condition is necessary in repositories where the "Run workflows from fork pull requests" setting is enabled
and the "Send write tokens to workflows from fork pull requests" setting is disabled, explained in more detail here:

https://github.com/arduino/report-size-deltas#run-from-the-same-workflow-as-the-arduinocompile-sketches-action

However, this repository does not have the "Run workflows from fork pull requests" setting enabled, so the extra
condition is superflous and only makes the workflow more difficult to understand and maintain.
The GitHub Actions workflow job that does a "smoke test" compilation of the library example sketches is a matrix, running
a parallel job for each of the boards in the array. It may be that one job passes and another fails. In this case, there
is memory usage change data available for the board that passed compilation. Previously the size deltas report only
happened if all compilations passed.

It may be useful for the contributor to get the size deltas feedback in addition to the compilation results even when one
of the boards did not pass compilation so that they may have as much of the available information as possible to work with.
The `arduino/report-size-deltas` GitHub Actions action is used to provide feedback about the impact of a proposed change
on sketch memory usage. Previously, due to the lack of a release, the development version of the action was used. Using
release versions provides a more stable CI system for the 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/report-size-deltas@v2`).
The `name` key of a GitHub Actions workflow step is used to define the name used to identify that step to humans. When
one is not defined, a more cryptic name is generated from the machine readable content of the step. A descriptive name
will make it easier to understand the workflow run logs.
This will provide a quick overview of the project.

The URLs in the "Compile Examples" workflow status badge are configured for the final location of the library, so they are expected to be broken while it is in the temporary development location.
On every push, pull request, and periodically, run Arduino Lint to check for common problems not related to the project
code.

The URLs in the workflow status badge are configured for the final location of the library, so they are expected to be broken while it is in the temporary development location.
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.

The URLs in the workflow status badge are configured for the final location of the library, so they are expected to be
broken while it is in the temporary development location.
@per1234 per1234 added the type: enhancement Proposed improvement label Sep 22, 2021
@per1234 per1234 requested a review from aentinger September 22, 2021 14:49
Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you @per1234 🚀

@aentinger aentinger merged commit fe89daa into arduino-libraries:master Sep 23, 2021
@aentinger aentinger deleted the update-ci branch September 23, 2021 04:40
@facchinm
Copy link
Collaborator

@aentinger
Copy link
Contributor

@per1234 may I ask you to update to that arduino-cli version?

@per1234
Copy link
Contributor Author

per1234 commented Sep 23, 2021

@facchinm
Copy link
Collaborator

Not by me 🙂 Linux version is enough?

@facchinm
Copy link
Collaborator

Just pushed on the same URL

@per1234
Copy link
Contributor Author

per1234 commented Sep 23, 2021

Linux version is enough?

Yes. I would like to eventually make arduino/compile-sketches support testing other operating systems, but at the moment it only supports Linux so for the sake of the CI only Linux is required.

may I ask you to update to that arduino-cli version?

It will now use it without the need for any change to the CI system, but we will now have the opposite problem of the pinned version of the action using the old JSON keys and the Arduino CLI version using the new keys, so I'll submit the PR to use the stable arduino/compile-sketches@v1 that uses the modern JSON keys.

@per1234
Copy link
Contributor Author

per1234 commented Sep 23, 2021

@facchinm do you have any ideas about this error when using the new "arduino_threads" version of Arduino CLI:
https://github.com/per1234/Arduino_Threads/runs/3689772372?check_suite_focus=true#step:6:113

Running command: /home/runner/bin/arduino-cli core update-index --log-level warn --verbose 
   /home/runner/bin/arduino-cli: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/runner/bin/arduino-cli)

@facchinm
Copy link
Collaborator

My bad, I compiled with plain go build and not CGO_ENABLED=0 go build 😓
Reuploading right now

@per1234
Copy link
Contributor Author

per1234 commented Sep 24, 2021

Hi @facchinm I have still been getting the same error running the workflow with https://downloads.arduino.cc/arduino-cli/arduino-cli_arduino_threads_Linux_64bit.tar.gz
https://github.com/per1234/Arduino_Threads/runs/3698814378?check_suite_focus=true#step:6:113
I thought it might be taking some time for the CDN cache, but it seems like it should have been plenty long enough by now.

@facchinm
Copy link
Collaborator

I missed a / when pushing 😞
@rsora did this command couse any harm?

aws s3 --profile martino --region us-east-1 cp arduino-cli_arduino_threads_Linux_64bit.tar.gz s3://arduino-downloads-prod-beagle/arduino-cli

@rsora
Copy link

rsora commented Sep 24, 2021

@facchinm I cleaned it up no worries 🐱
if you are doing it manually use the following command line:

aws s3 --profile martino --region us-east-1 cp arduino-cli_arduino_threads_Linux_64bit.tar.gz s3://arduino-downloads-prod-beagle/arduino-cli/arduino-cli_arduino_threads_Linux_64bit.tar.gz

super safe 😸

@per1234
Copy link
Contributor Author

per1234 commented Sep 24, 2021

OK, all is well now! PR: #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add spell-check/check-arduino/compile-examples-private workflows.
4 participants