Fallout-build / Fallout-build/Fallout

GitHub Actions run step hardcodes ./build.cmd — breaks non-Windows runners (fix: pwsh build.ps1)

Open
#516 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
154
Forks
19
Avg merge
1d 22h
Merged PRs (30d)
15

Description

## Summary

`GitHubActionsRunStep.Write()` emits `run: ./{BuildCmdPath} ` for every job regardless of the runner image, and `ConfigurationAttributeBase.BuildCmdPath` only globs `build.cmd` (never `build.sh`/`build.ps1`). So any workflow generated for an `Ubuntu*`/`MacOs*` image gets `./build.cmd`, which can't execute — only `windows-*` runners work.

## Repro

```csharp
[GitHubActions("ci", GitHubActionsImage.UbuntuLatest, InvokedTargets = [nameof(Foo)])]
```
generates:
```yaml
runs-on: ubuntu-latest
...
run: ./build.cmd Foo # .cmd on ubuntu → fails
```

## Cause (10.3.49)

- `Fallout.Common.CI.GitHubActions.Configuration.GitHubActionsRunStep.Write` → `" run: ./" + BuildCmdPath + " " + JoinSpace(InvokedTargets)`
- `Fallout.Common.CI.ConfigurationAttributeBase.BuildCmdPath` → globs `build.cmd`, `*/build.cmd` only

No branch on `GitHubActionsImage`. Confirmed across both assemblies: **zero** references to `build.sh` or `build.ps1`; `build.cmd` is the only build-script string (2 glob literals in `Fallout.Build`). The `build.sh`/`build.ps1` bootstrap files ship, but the generator only ever knows `build.cmd`.

## Fix — pwsh route (decided)

`pwsh` is on every GitHub-hosted runner (win/linux/mac) and `build.ps1` already takes targets positionally (`ValueFromRemainingArguments`), so invoke pwsh and drop per-OS script selection entirely:

1. `ConfigurationAttributeBase` — add a pwsh path mirroring `BuildCmdPath`:
```csharp
protected virtual string BuildScriptPath =>
Build.RootDirectory.GlobFiles("build.ps1", "*/build.ps1")
.Select(x => Build.RootDirectory.GetUnixRelativePathTo(x))
.FirstOrDefault().NotNull();
```
2. `GitHubActionsRunStep.Write` — invoke pwsh:
```csharp
writer.WriteLine(" run: pwsh -File ./" + BuildScriptPath + " " + JoinSpace(InvokedTargets));
```
(thread `BuildScriptPath` through the attribute's `GetSteps` where it currently passes `BuildCmdPath`.)

`pwsh -File ./build.ps1 ` runs regardless of the runner's default shell — no `shell:` key, no image branch. Same swap applies to the other CI run-step writers if we want them pwsh too.

## Workaround

Pin `GitHubActionsImage.WindowsLatest` (only image where the generated `./build.cmd` runs).

---
*Filed by AI (Claude Opus 4.8 (1M context)) on Chris's behalf.*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.