Simplify and generalize configurable working directory code in build workflow #2564
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
runner.os
context itemThe 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