Skip to content

fix: filter Windows Python versions by available installers #118

fix: filter Windows Python versions by available installers

fix: filter Windows Python versions by available installers #118

Workflow file for this run

name: vfox-test
on:
workflow_call:
workflow_dispatch:
pull_request:
types: ["opened", "reopened", "synchronize"]
push:
tags: ["v*"]
permissions:
contents: read
jobs:
test-on-linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.12.2]
mirror: ["", "https://mirrors.huaweicloud.com/python/"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Compress build files
uses: thedoctor0/zip-release@0.7.6
with:
type: "zip"
directory: "./"
filename: "release.zip"
exclusions: "*.git* manifest.json"
- name: Install vfox
env:
GITHUB_TOKEN: ${{ github.token }}
shell: bash
run: |
for _ in {1..10}; do
if curl -fsSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash; then break; fi
sleep 5
done
vfox --version
- name: Install plugin
run: |
vfox add --source ./release.zip
- name: Install Python ${{ matrix.python-version }}
env:
VFOX_PYTHON_MIRROR: ${{ matrix.mirror }}
run: |
eval "$(vfox activate bash)"
vfox install python@${{ matrix.python-version }}
vfox use -g python@${{ matrix.python-version }}
vfox current
- name: Check python ${{ matrix.python-version }}
run: |
eval "$(vfox activate bash)"
python_version=$(python -c 'import sys;print(sys.version, sys.path)')
echo "$python_version"
if [[ ! $python_version == ${{ matrix.python-version }}* ]]; then
exit 1
fi
- name: Select an available uv-build Python 3.10 version
if: matrix.mirror == ''
run: python .github/select-uv-version.py
- name: Install Python 3.10 with uv-build
if: matrix.mirror == ''
env:
VFOX_PYTHON_USE_UV_BUILD: "1"
run: |
eval "$(vfox activate bash)"
vfox install python@"$VFOX_TEST_UV_VERSION"
vfox use -g python@"$VFOX_TEST_UV_VERSION"
vfox current
- name: Check uv-build python 3.10
if: matrix.mirror == ''
run: |
eval "$(vfox activate bash)"
python_version=$(python -c 'import sys;print(sys.version)')
echo "$python_version"
if [[ ! $python_version == "$VFOX_TEST_UV_VERSION"* ]]; then
exit 1
fi
python -m pip --version
pip --version
test-on-windows:
defaults:
run:
shell: pwsh
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: [3.12.2]
mirror: ["", "https://mirrors.huaweicloud.com/python/"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Compress build files
uses: thedoctor0/zip-release@0.7.6
with:
type: "zip"
directory: "./"
filename: "release.zip"
exclusions: "*.git* manifest.json"
- name: Install vfox
if: runner.os == 'Windows'
shell: powershell
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
scoop install vfox
vfox --version
- name: Install plugin
if: runner.os == 'Windows'
run: |
Invoke-Expression "$(vfox activate pwsh)"
vfox add --source ./release.zip
- name: Install Python ${{ matrix.python-version }}
if: runner.os == 'Windows'
env:
VFOX_PYTHON_MIRROR: ${{ matrix.mirror }}
run: |
Invoke-Expression "$(vfox activate pwsh)"
vfox install python@${{ matrix.python-version }}
vfox use -g python@${{ matrix.python-version }}
vfox current
- name: Check python ${{ matrix.python-version }}
if: runner.os == 'Windows'
run: |
Invoke-Expression "$(vfox activate pwsh)"
$python_version = $(python -c 'import sys;print(sys.version, sys.path)')
Write-Output $python_version
if ($python_version -notlike "${{ matrix.python-version }}*") {
exit 1
}
- name: Select an available uv-build Python 3.10 version
if: matrix.mirror == ''
run: python .github/select-uv-version.py
- name: Install Python 3.10 with uv-build
if: runner.os == 'Windows' && matrix.mirror == ''
env:
VFOX_PYTHON_USE_UV_BUILD: "1"
run: |
Invoke-Expression "$(vfox activate pwsh)"
vfox install "python@$env:VFOX_TEST_UV_VERSION"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
vfox use -g "python@$env:VFOX_TEST_UV_VERSION"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
vfox current
$python_version = $(python -c 'import sys;print(sys.version)')
if ($LASTEXITCODE -ne 0) {
Write-Error "failed to run python after uv-build install"
exit $LASTEXITCODE
}
Write-Output $python_version
if ($python_version -notlike "$env:VFOX_TEST_UV_VERSION*") {
Write-Error "expected uv-build python $env:VFOX_TEST_UV_VERSION, got $python_version"
exit 1
}
- name: Check uv-build python 3.10
if: runner.os == 'Windows' && matrix.mirror == ''
run: |
Invoke-Expression "$(vfox activate pwsh)"
$python_version = $(python -c 'import sys;print(sys.version)')
Write-Output $python_version
if ($python_version -notlike "$env:VFOX_TEST_UV_VERSION*") {
exit 1
}
python -m pip --version
pip --version