Skip to content

[skip changelog] Sync general formatting check workflow with template #1380

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 3 commits into from
Aug 10, 2021
Merged

[skip changelog] Sync general formatting check workflow with template #1380

merged 3 commits into from
Aug 10, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Aug 9, 2021

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

Infrastructure update

  • What is the current behavior?

We have assembled a collection of reusable GitHub Actions workflows:
https://github.com/arduino/tooling-project-assets
These workflows will be used in the repositories of all Arduino tooling projects.

Some minor improvements and standardizations have been made in the upstream "template" workflow, but have not yet been pulled into this repository.

The Prettier formatting tool is used in the tasks for formatting and checking the formatting of the repository's Markdown and YAML files, but its capabilities with other languages are not utilized.

  • What is the new behavior?

Workflow is synced with the state of the art from upstream.

Prettier formatting is applied to all supported files.

Several of the tasks have been deprecated in favor of the new general:format-prettier task:

  • docs:check
  • docs:format
  • config:check
  • config:format

These still work as before, but they now display a deprecation warning.

Does this PR introduce a breaking change

No

is titled accordingly

Yes

  • Other information:

The "Check Prettier Formatting" workflow run currently fails due to non-compliant formatting in many test data JSON files. With the exception of data that is intentionally non-compliant (e.g., arduino/libraries/librariesindex/testdata/invalid.json), I think it make sense to apply the formatting style even to test data files that are maintained in this repository. The exception would be files that are externally maintained, with the intent to sync their copies in this repository from upstream. I don't have any idea of what the maintenance status is of these files, so I will need input on whether the .prettierignore file needs to be expanded.

I would probably submit a separate PR if a significant number of formatting updates are needed, since they are likely better put in a separate commit.

@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Aug 9, 2021
@per1234 per1234 requested review from silvanocerza and umbynos August 9, 2021 09:20
@per1234
Copy link
Contributor Author

per1234 commented Aug 9, 2021

Since they are the most affected, I'd be interested to get the opinion of @silvanocerza or @cmaglie on this:

The "Check Prettier Formatting" workflow run currently fails due to non-compliant formatting in many test data JSON files. With the exception of data that is intentionally non-compliant (e.g., arduino/libraries/librariesindex/testdata/invalid.json), I think it make sense to apply the formatting style even to test data files that are maintained in this repository. The exception would be files that are externally maintained, with the intent to sync their copies in this repository from upstream. I don't have any idea of what the maintenance status is of these files, so I will need input on whether the .prettierignore file needs to be expanded.

@silvanocerza
Copy link
Contributor

I think it's ok formatting all files even if they're in a certain sense external, the format must not matter for testing purposes only that they're well formed. So I'd add on .prettierignore only those files that are ill formed on purpose and format all the rest. Feel free to format them in a separate commit in this same PR.

Also I think the deprecation warning for the old task commands are not necessary, we can just delete them.

@per1234
Copy link
Contributor Author

per1234 commented Aug 9, 2021

Feel free to format them in a separate commit in this same PR.

OK, will do. Thanks for your feedback.

I think the deprecation warning for the old task commands are not necessary, we can just delete them.

OK, I will do that then. I wasn't sure whether the removal would be disruptive to anyone's development workflow, but the taskfile is a lot cleaner without a bunch of these deprecated tasks cluttering it up.

@silvanocerza
Copy link
Contributor

What's going on with this check? Rerunning didn't help. 🤔
https://github.com/arduino/arduino-cli/pull/1380/checks?check_run_id=3281153503

@per1234
Copy link
Contributor Author

per1234 commented Aug 9, 2021

Oops, I should have commented about that. I was pretty burned out by the end of the day and had to give it a rest once I hit the unit test failures resulting from the reformatting breaking the index file signature.

The go.sum diff is a side effect of Task running the command to generate the GOLINTBIN dynamic variable:

sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint

It's unintuitive that a workflow that doesn't have anything to do with Go causes this diff, but the go list command runs anytime any task is called.

I'm planning to submit a PR to introduce arduino/tooling-project-assets@a98ac6c into the repository later today along with the general sync to the "template" Go check system. That change should sidestep this whole issue. So I think the best approach is to just accept that the "Check Prettier Formatting" workflow will have a spurious failure for a short period rather than wasting time trying to find a solution for a problem that is just going to disappear anyway.

We have assembled a collection of reusable GitHub Actions workflows:
https://github.com/arduino/tooling-project-assets
These workflows will be used in the repositories of all Arduino tooling projects.

The Prettier formatting tool is used in the tasks for formatting and checking the formatting of the repository's
Markdown and YAML files. Prettier supports a long list of other languages. There is no reason not to take advantage of
those capabilities as well, so the new workflow applies it to all supported files.

Several of the tasks have been deprecated in favor of the new `general:format-prettier` task:

- `docs:check`
- `docs:format`
- `config:check`
- `config:format`

These still work as before, but they now display a deprecation warning.
These are replaced by the `general:format-prettier` task. Even though that doesn't provide a formatting compliance check,
the developer doesn't have any need for such a thing, since they will be better off to simply format, and the CI now
takes the approach of formatting and then failing if it produced a diff.
…iance

Previously, Prettier was only run on the Markdown and YAML files. With the new expanded scope of Prettier coverage, the
JSON files are now required to be compliant.
@silvanocerza
Copy link
Contributor

Ok, good to know. Am ok with letting this fail for the time being. 👍

@per1234 per1234 merged commit 7ef3ebb into arduino:master Aug 10, 2021
@per1234 per1234 deleted the check-prettier-formatting branch August 10, 2021 08:31
@per1234 per1234 self-assigned this Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants