Skip to content

Commit ce643b0

Browse files
authored
fix(ci): use pre-installed Node.js for macOS/Windows migration tests (#146)
1 parent 186a15a commit ce643b0

3 files changed

Lines changed: 27 additions & 31 deletions

File tree

.github/workflows/integration-test-migrate-node-macos-system.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ jobs:
3434
echo "$HOME/.dtvem/shims" >> $GITHUB_PATH
3535
echo "$HOME/.dtvem/bin" >> $GITHUB_PATH
3636
37-
- name: "Install Node.js 18.x via Homebrew"
37+
- name: "Verify pre-installed Node.js"
3838
run: |
39-
brew install node@18
40-
brew link --overwrite node@18
4139
echo "System Node.js installed at: $(which node)"
4240
node --version
41+
# Capture the version for later verification
42+
NODE_VERSION=$(node --version | sed 's/v//')
43+
echo "NODE_VERSION=$NODE_VERSION" >> $GITHUB_ENV
4344
4445
- name: "Migrate system Node.js to dtvem"
4546
run: |
@@ -51,16 +52,17 @@ jobs:
5152
5253
- name: "Verify migrated version"
5354
run: |
54-
./dist/dtvem list node | grep -E "18\." || (echo "ERROR: Expected Node.js 18.x to be migrated" && exit 1)
55-
echo "SUCCESS: Node.js 18.x was migrated from system"
55+
# Check that we have the same version that was pre-installed
56+
./dist/dtvem list node | grep -F "$NODE_VERSION" || (echo "ERROR: Expected Node.js $NODE_VERSION to be migrated" && exit 1)
57+
echo "SUCCESS: Node.js $NODE_VERSION was migrated from system"
5658
5759
- name: Generate summary
5860
if: always()
5961
run: |
6062
echo "## Node.js Migration from System (macOS)" >> $GITHUB_STEP_SUMMARY
6163
echo "" >> $GITHUB_STEP_SUMMARY
62-
echo "**Source:** Homebrew" >> $GITHUB_STEP_SUMMARY
63-
echo "**Version:** 18.x" >> $GITHUB_STEP_SUMMARY
64+
echo "**Source:** Pre-installed system Node.js" >> $GITHUB_STEP_SUMMARY
65+
echo "**Version:** $NODE_VERSION" >> $GITHUB_STEP_SUMMARY
6466
echo "" >> $GITHUB_STEP_SUMMARY
6567
echo "### Installed Versions" >> $GITHUB_STEP_SUMMARY
6668
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/integration-test-migrate-node-windows-system.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,14 @@ jobs:
3737
"$env:USERPROFILE\.dtvem\shims" | Out-File -FilePath $env:GITHUB_PATH -Append
3838
"$env:USERPROFILE\.dtvem\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
3939
40-
- name: "Install Node.js 18.x via Chocolatey"
40+
- name: "Verify pre-installed Node.js"
4141
shell: pwsh
4242
run: |
43-
choco install nodejs-lts --version=18.20.4 -y
44-
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
4543
Write-Host "System Node.js installed at: $(where.exe node)"
46-
node --version
47-
48-
- name: "Add Chocolatey Node.js to PATH"
49-
shell: pwsh
50-
run: |
51-
$nodePath = "C:\Program Files\nodejs"
52-
if (Test-Path $nodePath) {
53-
$nodePath | Out-File -FilePath $env:GITHUB_PATH -Append
54-
}
44+
$version = (node --version) -replace '^v', ''
45+
Write-Host "Node.js version: $version"
46+
# Save version for later verification
47+
"NODE_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Append
5548
5649
- name: "Migrate system Node.js to dtvem"
5750
shell: bash
@@ -65,17 +58,18 @@ jobs:
6558
- name: "Verify migrated version"
6659
shell: bash
6760
run: |
68-
./dist/dtvem.exe list node | grep -E "18\." || (echo "ERROR: Expected Node.js 18.x to be migrated" && exit 1)
69-
echo "SUCCESS: Node.js 18.x was migrated from system"
61+
# Check that we have the same version that was pre-installed
62+
./dist/dtvem.exe list node | grep -F "$NODE_VERSION" || (echo "ERROR: Expected Node.js $NODE_VERSION to be migrated" && exit 1)
63+
echo "SUCCESS: Node.js $NODE_VERSION was migrated from system"
7064
7165
- name: Generate summary
7266
if: always()
7367
shell: bash
7468
run: |
7569
echo "## Node.js Migration from System (Windows)" >> $GITHUB_STEP_SUMMARY
7670
echo "" >> $GITHUB_STEP_SUMMARY
77-
echo "**Source:** Chocolatey" >> $GITHUB_STEP_SUMMARY
78-
echo "**Version:** 18.x" >> $GITHUB_STEP_SUMMARY
71+
echo "**Source:** Pre-installed system Node.js" >> $GITHUB_STEP_SUMMARY
72+
echo "**Version:** $NODE_VERSION" >> $GITHUB_STEP_SUMMARY
7973
echo "" >> $GITHUB_STEP_SUMMARY
8074
echo "### Installed Versions" >> $GITHUB_STEP_SUMMARY
8175
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/integration-test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ jobs:
4646
name: Migrate Node.js from nvm (Ubuntu)
4747
uses: ./.github/workflows/integration-test-migrate-node-ubuntu-nvm.yml
4848

49+
migrate-node-macos-system:
50+
name: Migrate Node.js from System (macOS)
51+
uses: ./.github/workflows/integration-test-migrate-node-macos-system.yml
52+
53+
migrate-node-windows-system:
54+
name: Migrate Node.js from System (Windows)
55+
uses: ./.github/workflows/integration-test-migrate-node-windows-system.yml
56+
4957
# --------------------------------------------------------------------------
5058
# Remaining migration tests - re-enable incrementally
5159
# --------------------------------------------------------------------------
52-
# migrate-node-macos-system:
53-
# name: Migrate Node.js from System (macOS)
54-
# uses: ./.github/workflows/integration-test-migrate-node-macos-system.yml
55-
#
5660
# migrate-node-macos-fnm:
5761
# name: Migrate Node.js from fnm (macOS)
5862
# uses: ./.github/workflows/integration-test-migrate-node-macos-fnm.yml
5963
#
60-
# migrate-node-windows-system:
61-
# name: Migrate Node.js from System (Windows)
62-
# uses: ./.github/workflows/integration-test-migrate-node-windows-system.yml
63-
#
6464
# migrate-node-windows-nvm:
6565
# name: Migrate Node.js from nvm-windows (Windows)
6666
# uses: ./.github/workflows/integration-test-migrate-node-windows-nvm.yml

0 commit comments

Comments
 (0)