-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration-test-migrate-python-windows-pyenv.yml
More file actions
108 lines (91 loc) · 4.19 KB
/
integration-test-migrate-python-windows-pyenv.yml
File metadata and controls
108 lines (91 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Integration Tests - Migrate Python from pyenv-win (Windows)
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
migrate:
name: Python from pyenv-win (Windows)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
- name: Build dtvem
shell: bash
run: |
go build -v -ldflags="-s -w" -o dist/dtvem.exe ./src
go build -v -ldflags="-s -w" -o dist/dtvem-shim.exe ./src/cmd/shim
- name: Initialize dtvem
shell: bash
run: ./dist/dtvem.exe init --yes
- name: Add dtvem to PATH
shell: pwsh
run: |
"$env:USERPROFILE\.dtvem\shims" | Out-File -FilePath $env:GITHUB_PATH -Append
"$env:USERPROFILE\.dtvem\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: "Install pyenv-win"
shell: pwsh
run: |
pip install pyenv-win --target "$env:USERPROFILE\.pyenv"
[System.Environment]::SetEnvironmentVariable('PYENV', "$env:USERPROFILE\.pyenv\pyenv-win\", "User")
[System.Environment]::SetEnvironmentVariable('PYENV_ROOT', "$env:USERPROFILE\.pyenv\pyenv-win\", "User")
[System.Environment]::SetEnvironmentVariable('PYENV_HOME', "$env:USERPROFILE\.pyenv\pyenv-win\", "User")
"$env:USERPROFILE\.pyenv\pyenv-win\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
"$env:USERPROFILE\.pyenv\pyenv-win\shims" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: "Find and install available Python 3.11.x via pyenv-win"
id: install-python
shell: pwsh
run: |
$env:Path = "$env:USERPROFILE\.pyenv\pyenv-win\bin;$env:USERPROFILE\.pyenv\pyenv-win\shims;$env:Path"
# List available versions and find latest 3.11.x (non-dev, non-rc)
Write-Host "Available Python 3.11.x versions:"
$versions = pyenv install -l | Select-String "^\s*3\.11\.\d+$" | ForEach-Object { $_.Line.Trim() }
$versions | ForEach-Object { Write-Host " $_" }
# Get the latest 3.11.x version (last one in sorted list)
$latestVersion = $versions | Sort-Object { [version]$_ } | Select-Object -Last 1
Write-Host "Installing Python $latestVersion"
pyenv install $latestVersion
pyenv global $latestVersion
pyenv rehash
Write-Host "pyenv-win Python version:"
python --version
# Output the version for later steps
"PYTHON_VERSION=$latestVersion" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: "Migrate pyenv-win Python to dtvem"
shell: bash
run: |
echo "=== Running migrate detection ==="
# Select "all" to migrate all detected versions
echo -e "all\n0\nn\n" | ./dist/dtvem.exe migrate python || true
echo ""
echo "=== Verifying migration ==="
./dist/dtvem.exe list python
- name: "Verify migrated version"
shell: bash
env:
EXPECTED_VERSION: ${{ steps.install-python.outputs.PYTHON_VERSION }}
run: |
echo "Looking for Python $EXPECTED_VERSION"
./dist/dtvem.exe list python | grep -E "$EXPECTED_VERSION" || (echo "ERROR: Expected Python $EXPECTED_VERSION to be migrated" && exit 1)
echo "SUCCESS: Python $EXPECTED_VERSION was migrated from pyenv-win"
- name: Generate summary
if: always()
shell: bash
env:
EXPECTED_VERSION: ${{ steps.install-python.outputs.PYTHON_VERSION }}
run: |
echo "## Python Migration from pyenv-win (Windows)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Source:** pyenv-win" >> $GITHUB_STEP_SUMMARY
echo "**Version:** $EXPECTED_VERSION" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Installed Versions" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
./dist/dtvem.exe list python >> $GITHUB_STEP_SUMMARY 2>&1 || echo "No versions" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY