1
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2025-04-09 01:28:39 +00:00

include verify gil step and validated python version

This commit is contained in:
priya-kinthali 2025-03-19 18:06:05 +05:30
parent 3005a75a7a
commit 33f472dc21
2 changed files with 56 additions and 83 deletions

View file

@ -44,16 +44,8 @@ jobs:
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
shell: bash
- name: Validate version
run: |
$pythonVersion = (python --version)
$expectedVersion = "${{ matrix.python-version }}".TrimEnd('t')
if ("$pythonVersion" -NotMatch $expectedVersion){
Write-Host "The current version is $pythonVersion; expected version is $expectedVersion"
exit 1
}
$pythonVersion
shell: pwsh
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'
@ -91,16 +83,8 @@ jobs:
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
shell: bash
- name: Validate version
run: |
$pythonVersion = (python --version)
$expectedVersion = "${{ matrix.python-version }}".TrimEnd('t')
if ("$pythonVersion" -NotMatch $expectedVersion){
Write-Host "The current version is $pythonVersion; expected version is $expectedVersion"
exit 1
}
$pythonVersion
shell: pwsh
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'
@ -136,16 +120,8 @@ jobs:
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
shell: bash
- name: Validate version
run: |
$pythonVersion = (python --version)
$expectedVersion = "${{ matrix.python-version }}".TrimEnd('t')
if ("$pythonVersion" -NotMatch $expectedVersion){
Write-Host "The current version is $pythonVersion; expected version is $expectedVersion"
exit 1
}
$pythonVersion
shell: pwsh
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'
@ -187,16 +163,6 @@ jobs:
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))'
@ -231,21 +197,12 @@ jobs:
uses: ./
with:
python-version-file: pyproject.toml
freethreaded: true
- 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))'
@ -309,15 +266,8 @@ jobs:
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
shell: bash
- name: Validate version
run: |
$pythonVersion = (python --version)
if ("Python 3.14.0a6" -ne "$pythonVersion"){
Write-Host "The current version is $pythonVersion; expected version is 3.14.0a6"
exit 1
}
$pythonVersion
shell: pwsh
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'
@ -406,8 +356,8 @@ jobs:
python-version: ${{ matrix.python }}
update-environment: false
- name: Python version
run: ${{ steps.setup-python.outputs.python-path }} --version
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
- name: Run simple code
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
@ -418,24 +368,17 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
python-version: [3.13t]
python-version: [3.13t, 3.14t-dev]
steps:
- uses: actions/checkout@v4
- name: Setup Python and check latest
id: setup-python
uses: ./
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Validate version
run: |
$pythonVersion = (python --version)
$expectedVersion = "${{ matrix.python-version }}".TrimEnd('t')
if ("$pythonVersion" -NotMatch $expectedVersion){
Write-Host "The current version is $pythonVersion; expected version is $expectedVersion"
exit 1
}
$pythonVersion
shell: pwsh
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
setup-python-multiple-python-versions:
runs-on: ${{ matrix.os }}
@ -446,17 +389,44 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Python and check latest
id: setup-python
uses: ./
with:
python-version: |
3.13t
check-latest: true
- name: Validate version
run: |
$pythonVersion = (python --version)
if ("$pythonVersion" -NotMatch "3.13"){
Write-Host "The current version is $pythonVersion; expected version is 3.13"
exit 1
}
$pythonVersion
shell: pwsh
3.13.1t
3.13.2t
3.14t-dev
- name: Verify Python version
run: ${{ steps.setup-python.outputs.python-path }} -VVV
setup-versions-with-freethread-input:
name: Setup ${{ matrix.python }} ${{ matrix.os }} using freethread input parameter
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
macos-latest,
windows-latest,
ubuntu-20.04,
ubuntu-22.04,
macos-13,
ubuntu-latest
]
python: [3.13.1, 3.13.2, 3.14-dev, 3.14.0-alpha.6]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup-python ${{ matrix.python }}
id: setup-python
uses: ./
with:
python-version: ${{ matrix.python }}
freethreaded: true
- name: Check python-path
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
shell: bash
- name: Validate GIL
run: python ./__tests__/verify-freethread.py

View file

@ -0,0 +1,3 @@
import sys
if __name__ == '__main__':
print(f"Using GIL: {sys._is_gil_enabled()}\n")