Skip to content

Sync test assets workflow with templates #227

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 19 commits into from
Aug 5, 2021
Merged

Sync test assets workflow with templates #227

merged 19 commits into from
Aug 5, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Aug 5, 2021

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, and those are introduced to this repository via this pull request.

per1234 added 19 commits August 4, 2021 20:03
Due to the tests being located in a dedicated folder and written in Python, there are unique paths filter requirements
for the GitHub Actions workflow that runs the project's integration tests. For this reason, and also to enable the unit
test workflow to be applied to projects that use other integration testing approaches (i.e., none at all), it is better
to use separate workflows to run unit tests vs. integration tests.
I have found that the approach of focusing each GitHub Actions workflows on a specific type of task can have some
significant benefits

- Improved efficiency due to being able to use a refined paths filter to prevent pointless runs of the workflow
- Easier for contributors to interpret the results in the event of a failure
- Easier to maintain
- More likely to be applicable as a "template" to arbitrary projects

This check really had no business being in the test runner workflow. It could be argued that it is suitable for inclusion
in the "Check Go" workflow, but it does have unique paths filter requirements and is also not in that workflow's
"template". So, at least for now, I am putting it in a dedicated workflow.
This process had no business being in the unit test runner workflow, not being related to the running of unit tests.
This is the template workflow filename, which is intended to serve as a unique identifier, and thus must be a bit more
verbose.
The backticks command substitution syntax is discouraged in favor of the modern `$()` syntax for the reasons described
here:
http://mywiki.wooledge.org/BashFAQ/082

The modern syntax is already in use for other dynamic variables in the taskfile, so this change also provides consistency.
This is the naming convention established in the standardized template project assets.
A dedicated task has been added for installing the project's Python dependencies, and this should be used throughout the
taskfile in place of redundant direct commands.
This allows the dependency tasks to run in parallel.
This is the naming convention established in the standardized template project assets.
These don't provide any value and make these assets more difficult to use as "templates" to be applied to any project.
This avoids the use of Windows "short paths" (e.g., C:\\Users\\RUNNER~1\\AppData\\Local) which may cause spurious test
results.
Long commands, especially in this case where taskfile templating is involved, can be difficult to read and interpret.
Adding strategic line breaks makes the structure of the command easy to follow.
Task has the capability for a default template value to be specified, which may be overridden by an environment variable
set by the task user. The previous variable name chosen for this purpose was somewhat ambiguous.
Task's `default` template command uses the first value if the second is not defined. In this case, the second value was a
variable defined by the workflow, so it was always defined! This made the default command and the first value useless. My
interpretation is that the intent was, as is done successfully elsewhere, to allow the task user to make customizations
by defining an environment variable from the command line which will override the default value. In order to accomplish that in a clean manner, I made the following changes:

- Remove the frivolous taskfile variable, instead adding the flags directly to the template
- Hard code the `-v` flag into the command
- Add an override variable with a more relevant name
This will make it easier for the maintainers to sync fixes and improvements in either direction between the upstream
"template" assets and their installation in this repository.
@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Aug 5, 2021
@per1234 per1234 requested review from silvanocerza and umbynos August 5, 2021 03:20
@codecov-commenter
Copy link

Codecov Report

Merging #227 (3bc729c) into main (365e9a4) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #227   +/-   ##
=======================================
  Coverage   88.67%   88.67%           
=======================================
  Files          43       43           
  Lines        4143     4143           
=======================================
  Hits         3674     3674           
  Misses        358      358           
  Partials      111      111           
Flag Coverage Δ
unit 88.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 365e9a4...3bc729c. Read the comment docs.

@per1234 per1234 merged commit ac5c2db into arduino:main Aug 5, 2021
@per1234 per1234 deleted the test branch August 5, 2021 08:32
@per1234 per1234 self-assigned this Nov 20, 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