Skip to content
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

Simplify and generalize configurable working directory code in build workflow #2564

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Nov 17, 2024

Motivation

The Windows builds of the application are cryptographically signed. The signing requires an "eToken" hardware authentication device be connected to the machine performing the signing (#2452). This means that it is necessary to use a self-hosted GitHub Actions runner for the Windows job of the build workflow rather than the runners hosted by GitHub.

There are some unique characteristics of the self-hosted runner which the workflow code must accommodate. The default working directory of the self-hosted runner is not suitable to perform the build under because the the resulting folder structure produced paths that exceeded the ridiculously small maximum path length of Windows. So the workflow must be configured to use a custom working directory with a short path (C:\a).

This custom working directory must be used only for the job running on the self-hosted Windows runner so the working directory of the relevant workflow steps are configured using a ternary expression. Previously, this expression had multiple conditions:

The second condition is entirely sufficient. The use of the first condition only added unnecessary complexity to the workflow code, and imposed a pointless limitation of only allowing the use of the custom working directory system on Windows runners.

Change description

Remove the unnecessary condition from the ternary expressions used to configure the working directory of workflow steps.

This makes the workflow easier to understand and maintain, and makes it possible to configure any job to use a custom working directory if necessary.

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

…workflow

The Windows builds of the application are cryptographically signed. The signing requires an "eToken" hardware
authentication device be connected to the machine performing the signing. This means that it is necessary to use a
self-hosted GitHub Actions runner for the Windows job of the build workflow rather than the runners hosted by GitHub.

There are some unique characteristics of the self-hosted runner which the workflow code must accommodate. The default
working directory of the self-hosted runner is not suitable to perform the build under because the the resulting folder
structure produced paths that exceeded the ridiculously small maximum path length of Windows. So the workflow must be
configured to use a custom working directory with a short path (`C:\a`).

This custom working directory must be used only for the job running on the self-hosted Windows runner so the working
directory of the relevant workflow steps are configured using a ternary expression. Previously, this expression had
multiple conditions:

* the value of the `runner.os` context item
* the definition of a custom working directory value in the job matrix

The second condition is entirely sufficient. The use of the first condition only added unnecessary complexity to the
workflow code, and imposed a pointless limitation of only allowing the use of the custom working directory system on
Windows runners.

Removing the unnecessary condition makes the workflow easier to understand and maintain, and makes it possible to
configure any job to use a custom working directory if necessary.
@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Nov 17, 2024
@per1234 per1234 self-assigned this Nov 17, 2024
@per1234 per1234 merged commit c0b0b84 into arduino:main Nov 17, 2024
22 checks passed
@per1234 per1234 deleted the working-dir branch November 19, 2024 12:05
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.

1 participant