Skip to content

Commit b9dab80

Browse files
rootroot
authored andcommitted
fix(runner): bootstrap self-hosted windows toolchain
Add a runner bootstrap workflow that works with Windows PowerShell before pwsh is installed. Update the smoke test to avoid a hard pwsh dependency and point health checks at CAS-Workstation-Kim. Extend Machinesetup.ps1 to install pwsh and dotnet alongside the existing base tools.
1 parent 2faa9e8 commit b9dab80

4 files changed

Lines changed: 79 additions & 9 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Runner Bootstrap
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
bootstrap:
11+
runs-on: [self-hosted, Windows]
12+
timeout-minutes: 30
13+
defaults:
14+
run:
15+
shell: powershell
16+
steps:
17+
- name: Checkout clean workspace
18+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
19+
with:
20+
clean: true
21+
fetch-depth: 1
22+
23+
- name: Bootstrap runner toolchain
24+
run: .\Machinesetup.ps1
25+
26+
- name: Validate core tools
27+
run: |
28+
$tools = @(
29+
@{ Name = "git"; Command = "git"; Args = @("--version") },
30+
@{ Name = "pwsh"; Command = "pwsh"; Args = @("--version") },
31+
@{ Name = "python"; Command = "python"; Args = @("--version") },
32+
@{ Name = "node"; Command = "node"; Args = @("--version") },
33+
@{ Name = "npm"; Command = "npm"; Args = @("--version") },
34+
@{ Name = "gh"; Command = "gh"; Args = @("--version") },
35+
@{ Name = "dotnet"; Command = "dotnet"; Args = @("--version") }
36+
)
37+
38+
$missing = @()
39+
foreach ($tool in $tools) {
40+
$command = Get-Command $tool.Command -ErrorAction SilentlyContinue
41+
if (-not $command) {
42+
Write-Host "[missing] $($tool.Name)"
43+
$missing += $tool.Name
44+
continue
45+
}
46+
47+
Write-Host "[ok] $($tool.Name)"
48+
& $command.Source @($tool.Args)
49+
}
50+
51+
if ($missing.Count -gt 0) {
52+
throw "Missing required tools after bootstrap: $($missing -join ', ')"
53+
}

.github/workflows/runner-health.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
timeout-minutes: 15
1717
env:
1818
GH_TOKEN: ${{ secrets.RUNNER_PAT || github.token }}
19-
RUNNER_NAME: MyLocalPC
19+
RUNNER_NAME: CAS-Workstation-Kim
2020
EMAIL_TO: ${{ secrets.EMAIL_TO }}
2121
steps:
2222
- name: Check runner status
@@ -76,9 +76,9 @@ jobs:
7676
server_port: ${{ env.SMTP_PORT }}
7777
username: ${{ env.SMTP_USERNAME }}
7878
password: ${{ env.SMTP_PASSWORD }}
79-
subject: "Runner offline: MyLocalPC"
79+
subject: "Runner offline: CAS-Workstation-Kim"
8080
body: |
81-
Runner: MyLocalPC
81+
Runner: CAS-Workstation-Kim
8282
Repo: ${{ github.repository }}
8383
Status: ${{ steps.status.outputs.runner_status }}
8484
to: ${{ env.EMAIL_TO }}

.github/workflows/runner-smoke-test.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,33 @@ jobs:
1212
timeout-minutes: 10
1313
defaults:
1414
run:
15-
shell: pwsh
15+
shell: powershell
1616
steps:
1717
- name: Runner basics
1818
run: |
1919
Write-Host "Runner name: $env:RUNNER_NAME"
2020
Write-Host "Runner OS: $env:RUNNER_OS"
2121
Write-Host "Runner arch: $env:RUNNER_ARCH"
22+
Write-Host "Machine: $env:COMPUTERNAME"
2223
Write-Host "Repo: $env:GITHUB_REPOSITORY"
2324
2425
- name: Tool versions
2526
run: |
26-
git --version
27-
python --version
28-
node --version
29-
gh --version
27+
$tools = @(
28+
@{ Name = "git"; Command = "git"; Args = @("--version") },
29+
@{ Name = "pwsh"; Command = "pwsh"; Args = @("--version") },
30+
@{ Name = "python"; Command = "python"; Args = @("--version") },
31+
@{ Name = "node"; Command = "node"; Args = @("--version") },
32+
@{ Name = "gh"; Command = "gh"; Args = @("--version") }
33+
)
34+
35+
foreach ($tool in $tools) {
36+
$command = Get-Command $tool.Command -ErrorAction SilentlyContinue
37+
if (-not $command) {
38+
Write-Host "[missing] $($tool.Name)"
39+
continue
40+
}
41+
42+
Write-Host "[ok] $($tool.Name)"
43+
& $command.Source @($tool.Args)
44+
}

Machinesetup.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ Write-Host ("winget: " + ($(if($hasWinget){"OK"}else{"MISSING"})))
1717
# Tools we want
1818
$want = @(
1919
@{name="git"; check="git"; winget="Git.Git"},
20+
@{name="pwsh"; check="pwsh"; winget="Microsoft.PowerShell"},
2021
@{name="python"; check="python"; winget="Python.Python.3.12"},
2122
@{name="node"; check="node"; winget="OpenJS.NodeJS.LTS"},
2223
@{name="npm"; check="npm"; winget="OpenJS.NodeJS.LTS"},
23-
@{name="gh"; check="gh"; winget="GitHub.cli"}
24+
@{name="gh"; check="gh"; winget="GitHub.cli"},
25+
@{name="dotnet"; check="dotnet"; winget="Microsoft.DotNet.SDK.10"}
2426
)
2527

2628
# Install missing tools

0 commit comments

Comments
 (0)