mirror of
https://github.com/actions/setup-python.git
synced 2025-07-22 13:48:20 +02:00
Multiple Python versions from version-file in one environment
This makes the change from #567 also available for users of .python-version.
This commit is contained in:
parent
7a4f344e33
commit
d59aa9efa4
3 changed files with 49 additions and 12 deletions
26
.github/workflows/test-python.yml
vendored
26
.github/workflows/test-python.yml
vendored
|
@ -271,3 +271,29 @@ jobs:
|
|||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
|
||||
setup-python-multiple-python-versions-from-file:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build multi-version file
|
||||
run: printf '%s\n' 3.7 3.8 3.9 3.10 > .python-version
|
||||
shell: bash
|
||||
- name: Setup Python and check latest
|
||||
uses: ./
|
||||
with:
|
||||
python-version-file: '.python-version'
|
||||
check-latest: true
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("$pythonVersion" -NotMatch "3.10"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is 3.10"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue