mirror of
https://github.com/actions/setup-python.git
synced 2024-11-25 09:58:36 +00:00
391 lines
12 KiB
YAML
391 lines
12 KiB
YAML
name: Validate Python e2e
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**.md'
|
|
schedule:
|
|
- cron: 30 3 * * *
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
check-non-eol-available: # non EOL versions of python shall be available on all workers
|
|
name: non-eol ${{ matrix.python-version }} ${{ matrix.check-latest && 'latest' || '' }} ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
|
check-latest: [false, true]
|
|
os: [macos-11, macos-12, macos-13, macos-14, windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, setup-actions-ubuntu-arm64-2-core, setup-actions-windows-arm64-4-core]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Python ${{ matrix.check-latest && 'and check latest' || '' }}
|
|
uses: ./
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
check-latest: ${{ matrix.check-latest }}
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("$pythonVersion" -NotMatch "${{ matrix.python-version }}"){
|
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python-version }}"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
setup-versions-from-manifest:
|
|
name: Setup ${{ matrix.python }} ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
python: [3.8.10, 3.9.13, 3.10.11, 3.11.9, 3.12.3]
|
|
exclude:
|
|
- os: ubuntu-22.04
|
|
python: 3.8.10
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: setup-python ${{ matrix.python }}
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-versions-from-file:
|
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} version file
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
python: [3.8.10, 3.9.13, 3.10.11, 3.11.9, 3.12.3]
|
|
exclude:
|
|
- os: ubuntu-22.04
|
|
python: 3.8.10
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: build-version-file ${{ matrix.python }}
|
|
run: echo ${{ matrix.python }} > .python-version
|
|
|
|
- name: setup-python ${{ matrix.python }}
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version-file: .python-version
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-versions-from-file-without-parameter:
|
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} version file without parameter
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
python: [3.8.10, 3.9.13, 3.10.11, 3.11.9, 3.12.3]
|
|
exclude:
|
|
- os: ubuntu-22.04
|
|
python: 3.8.10
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: build-version-file ${{ matrix.python }}
|
|
run: echo ${{ matrix.python }} > .python-version
|
|
|
|
- name: setup-python ${{ matrix.python }}
|
|
id: setup-python
|
|
uses: ./
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-versions-from-standard-pyproject-file:
|
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} standard pyproject file
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
python: [3.8.10, 3.9.13, 3.10.11, 3.11.9, '==3.12.3']
|
|
exclude:
|
|
- os: ubuntu-22.04
|
|
python: 3.8.10
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: build-version-file ${{ matrix.python }}
|
|
run: |
|
|
echo '[project]
|
|
requires-python = "${{ matrix.python }}"
|
|
' > pyproject.toml
|
|
|
|
- name: setup-python ${{ matrix.python }}
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version-file: pyproject.toml
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("Python ${{ matrix.python }}".replace("==", "") -ne "$pythonVersion"){
|
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-versions-from-poetry-pyproject-file:
|
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} poetry pyproject file
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
python: [3.8.10, 3.9.13, 3.10.11, 3.11.9, 3.12.3]
|
|
exclude:
|
|
- os: ubuntu-22.04
|
|
python: 3.8.10
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: build-version-file ${{ matrix.python }}
|
|
run: |
|
|
echo '[tool.poetry.dependencies]
|
|
python = "${{ matrix.python }}"
|
|
' > pyproject.toml
|
|
|
|
- name: setup-python ${{ matrix.python }}
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version-file: pyproject.toml
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-pre-release-version-from-manifest:
|
|
name: Setup 3.13.0-alpha.6 ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: setup-python 3.13.0-alpha.6
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version: '3.13.0-alpha.6'
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("Python 3.13.0a6" -ne "$pythonVersion"){
|
|
Write-Host "The current version is $pythonVersion; expected version is 3.13.0a6"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-dev-version:
|
|
name: Setup 3.13-dev ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: setup-python 3.13-dev
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version: '3.13-dev'
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: ${{ startsWith(steps.setup-python.outputs.python-version, '3.13.') }}
|
|
shell: bash
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-prerelease-version:
|
|
name: Setup 3.13 ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: setup-python 3.13
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version: '3.13'
|
|
allow-prereleases: true
|
|
|
|
- name: Check python-path
|
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
|
shell: bash
|
|
|
|
- name: Validate version
|
|
run: ${{ startsWith(steps.setup-python.outputs.python-version, '3.13.') }}
|
|
shell: bash
|
|
|
|
- name: Run simple code
|
|
run: python -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-versions-noenv:
|
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} (noenv)
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
|
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: setup-python ${{ matrix.python }}
|
|
id: setup-python
|
|
uses: ./
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
update-environment: false
|
|
|
|
- name: Python version
|
|
run: ${{ steps.setup-python.outputs.python-path }} --version
|
|
|
|
- name: Run simple code
|
|
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
|
|
|
setup-python-multiple-python-versions:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Python and check latest
|
|
uses: ./
|
|
with:
|
|
python-version: |
|
|
3.8
|
|
3.9
|
|
3.10
|
|
3.11
|
|
3.12
|
|
check-latest: true
|
|
- name: Validate version
|
|
run: |
|
|
$pythonVersion = (python --version)
|
|
if ("$pythonVersion" -NotMatch "3.12"){
|
|
Write-Host "The current version is $pythonVersion; expected version is 3.12"
|
|
exit 1
|
|
}
|
|
$pythonVersion
|
|
shell: pwsh
|