Skip to content

Commit 035d2a7

Browse files
authored
Merge pull request #27 from AdamWyatt34/update-dogfood
Enhance GitHub Actions support by handling unexpanded expressions and…
2 parents 2f452f9 + 9fb9f8c commit 035d2a7

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

scripts/self-test.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,19 @@ $StartTime = Get-Date
9191
$ExitCode = 0
9292

9393
# Run PDK and capture output
94+
# Use --host mode to run on local machine (where .NET is already installed)
95+
# Skip steps that use GitHub Actions (setup-dotnet, cache, upload-artifact, codecov)
96+
# Skip Build step - PDK is already built and running, can't rebuild itself (file locks)
97+
# Run: checkout, restore, unit tests (validates PDK can execute a real workflow)
9498
try {
9599
& dotnet run --project src/PDK.CLI/PDK.CLI.csproj `
96100
--no-build --configuration Release -- `
97101
run --file .github/workflows/ci.yml `
98102
--job build `
103+
--host `
104+
--step-filter "Checkout code" `
105+
--step-filter "Restore dependencies" `
106+
--step-filter "Run unit tests" `
99107
--verbose 2>&1 | Tee-Object -FilePath "$OutputDir/output.log"
100108
$ExitCode = $LASTEXITCODE
101109
} catch {

scripts/self-test.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,26 @@ echo ""
8484

8585
# Run PDK on its own workflow
8686
echo "${CYAN}Running PDK on .github/workflows/ci.yml...${RESET}"
87-
echo "Command: dotnet run --project src/PDK.CLI/PDK.CLI.csproj --no-build --configuration Release -- run --file .github/workflows/ci.yml --job build --verbose"
87+
echo "Using --host mode with step filters (skipping GitHub Actions-only steps)"
8888
echo ""
8989
echo "========== PDK Output Begin =========="
9090

9191
START_TIME=$(date +%s)
9292
EXIT_CODE=0
9393

9494
# Run PDK and capture output
95+
# Use --host mode to run on local machine (where .NET is already installed)
96+
# Skip steps that use GitHub Actions (setup-dotnet, cache, upload-artifact, codecov)
97+
# Skip Build step - PDK is already built and running, can't rebuild itself (file locks)
98+
# Run: checkout, restore, unit tests (validates PDK can execute a real workflow)
9599
dotnet run --project src/PDK.CLI/PDK.CLI.csproj \
96100
--no-build --configuration Release -- \
97101
run --file .github/workflows/ci.yml \
98102
--job build \
103+
--host \
104+
--step-filter "Checkout code" \
105+
--step-filter "Restore dependencies" \
106+
--step-filter "Run unit tests" \
99107
--verbose 2>&1 | tee "$OUTPUT_DIR/output.log" || EXIT_CODE=$?
100108

101109
END_TIME=$(date +%s)

src/PDK.CLI/PipelineExecutor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ public async Task Execute(ExecutionOptions options)
251251
if (!result.Success)
252252
{
253253
allJobsSucceeded = false;
254+
255+
// Display job error message if available
256+
if (!string.IsNullOrEmpty(result.ErrorMessage))
257+
{
258+
_output.WriteError($" {result.ErrorMessage}");
259+
}
254260
}
255261
}
256262

src/PDK.Core/Runners/RunnerCapabilities.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ public static IReadOnlyList<string> ValidateJobRequirements(Job job, RunnerType
115115
/// </summary>
116116
private static bool IsStandardRunner(string runsOn)
117117
{
118+
// Handle unexpanded GitHub Actions expressions (e.g., ${{ matrix.os }})
119+
// Assume they resolve to standard runners since matrix typically uses them
120+
if (runsOn.Contains("${{") || runsOn.Contains("}}"))
121+
{
122+
return true;
123+
}
124+
118125
// Standard runners that can work on host (local machine equivalents)
119126
var standardRunners = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
120127
{

src/PDK.Runners/Docker/ImageMapper.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public string MapRunnerToImage(string runnerName)
7070
return imageName;
7171
}
7272

73+
// Handle unexpanded GitHub Actions expressions (e.g., ${{ matrix.os }})
74+
// Default to ubuntu-latest since matrix builds aren't fully supported yet
75+
if (runnerName.Contains("${{") || runnerName.Contains("}}"))
76+
{
77+
return RunnerMappings["ubuntu-latest"];
78+
}
79+
7380
// Runner not recognized
7481
throw new ArgumentException(
7582
$"Runner '{runnerName}' is not recognized. " +

0 commit comments

Comments
 (0)