Skip to content

Convert to composite run steps action #14

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
Oct 26, 2020
Merged

Convert to composite run steps action #14

merged 3 commits into from
Oct 26, 2020

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Oct 26, 2020

When the action was created, the only option for non-JavaScript actions was to use a Docker container. However, GitHub
recently added a new action type: the "composite run steps action".

The Docker container approach has the significant advantage of providing a controlled environment for the action to run in, which will not pollute the general environment of the runner for later workflow steps. However it also has a couple disadvantages:

The problem with the first is it prevents testing for other operating systems. Arduino boards platforms have different toolchains and even build properties according to operating system of the machine they are running on. Only testing on a Linux system may result in missing issues that affect the majority of users.

Although more still needs to be done to make the action cross-platform (example1, example2), converting to a composite run steps action is the first step toward that goal.

The problem with the second is that, in order to be valid, an Arduino sketch folder must match the filename of the primary sketch file. For a sketch in the root of the repository, a sketch author might achieve this to some limited extent by naming the repository to match the primary sketch file name. However, the container volume is not named according to the repository name, so sketches in the root of the repository are not currently supported by the action (except in the unlikely event the sketch happens to be named "workspace"). Even though structuring sketch repositories in this manner is not best practices due to GitHub's popular "Download ZIP" appending the Git ref to the end of the folder name, the purpose of this action is to compile sketches, not legislate repository policy, so it is reasonable to support this use case.

The workspace folder in the GitHub Actions runner is named according to the repository name, meaning that converting to a composite run steps action permits use with sketches in the root of the repository.


I ran a few workflows with the version of the action from this PR:

When the action was created, the only option for non-JavaScript actions was to use a Docker container. However, GitHub
recently added a new action type: the "composite run steps action":
https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/creating-a-composite-run-steps-action

The Docker container approach has the significant advantage of providing a controlled environment for the action to run
in, which will not pollute the general environment of the runner for later workflow steps. However it also has a couple
disadvantages:

- Docker container actions can only execute on runners with a Linux operating system.
- The workspace is mounted to a folder in the container named `/github/workspace`.

The problem with the first is it prevents testing for other operating systems. Arduino boards platforms have different
toolchains and even build properties according to operating system of the machine they are running on. Only testing on
a Linux system may result in missing issues that affect the majority of users.

Although more still needs to be done to make the action cross-platform, converting to a composite run steps action is
the first step toward that goal.

The problem with the second is that, in order to be valid, an Arduino sketch folder must match the filename of the
primary sketch file. For a sketch in the root of the repository, a sketch author might achieve this to some limited
extent by naming the repository to match the primary sketch file name. However, the container volume is not named
according to the repository name, so sketches in the root of the repository are not currently supported by the action
(except in the unlikely event the sketch happens to be named "workspace"). Even though structuring sketch repositories
in this manner is not best practices due to GitHub's popular "Download ZIP" appending the Git ref to the end of the
folder name, the purpose of this action is to compile sketches, not legislate repository policy, so it is reasonable to
support this use case.

The workspace folder in the GitHub Actions runner is named according to the repository name, meaning that converting to
a composite run steps action permits use with sketches in the root of the repository.
Although currently very simple, the action setup script is essential to the proper funtioning of the action, so worthy
of some CI.
The test workflow will be most effective if it emulates the environment the action will run in.
@codecov-io
Copy link

Codecov Report

Merging #14 into main will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #14   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines         1561      1561           
=========================================
  Hits          1561      1561           

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 106113e...99a1a92. Read the comment docs.

@per1234 per1234 requested a review from giulcioffi October 26, 2020 11:54
Copy link
Contributor

@giulcioffi giulcioffi left a comment

Choose a reason for hiding this comment

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

LGTM, great work!

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

Successfully merging this pull request may close these issues.

3 participants