mirror of
https://github.com/actions/setup-python.git
synced 2025-04-17 00:09:14 +08:00
include verify gil step and validated python version
This commit is contained in:
parent
3005a75a7a
commit
33f472dc21
136
.github/workflows/test-python-freethread.yml
vendored
136
.github/workflows/test-python-freethread.yml
vendored
|
@ -44,16 +44,8 @@ jobs:
|
||||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Validate version
|
- name: Verify Python version
|
||||||
run: |
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
$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: Run simple code
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
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 }}'
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Validate version
|
- name: Verify Python version
|
||||||
run: |
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
$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: Run simple code
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
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 }}'
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Validate version
|
- name: Verify Python version
|
||||||
run: |
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
$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: Run simple code
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
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 }}'
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||||
shell: bash
|
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
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
@ -231,21 +197,12 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
python-version-file: pyproject.toml
|
python-version-file: pyproject.toml
|
||||||
|
freethreaded: true
|
||||||
|
|
||||||
- name: Check python-path
|
- name: Check python-path
|
||||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||||
shell: bash
|
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
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
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 }}'
|
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Validate version
|
- name: Verify Python version
|
||||||
run: |
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
$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: Run simple code
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
@ -406,8 +356,8 @@ jobs:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
update-environment: false
|
update-environment: false
|
||||||
|
|
||||||
- name: Python version
|
- name: Verify Python version
|
||||||
run: ${{ steps.setup-python.outputs.python-path }} --version
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
|
|
||||||
- name: Run simple code
|
- name: Run simple code
|
||||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||||
|
@ -418,24 +368,17 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||||
python-version: [3.13t]
|
python-version: [3.13t, 3.14t-dev]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Python and check latest
|
- name: Setup Python and check latest
|
||||||
|
id: setup-python
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Validate version
|
- name: Verify Python version
|
||||||
run: |
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
$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
|
|
||||||
|
|
||||||
setup-python-multiple-python-versions:
|
setup-python-multiple-python-versions:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
@ -446,17 +389,44 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Python and check latest
|
- name: Setup Python and check latest
|
||||||
|
id: setup-python
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
python-version: |
|
python-version: |
|
||||||
3.13t
|
3.13.1t
|
||||||
check-latest: true
|
3.13.2t
|
||||||
- name: Validate version
|
3.14t-dev
|
||||||
run: |
|
- name: Verify Python version
|
||||||
$pythonVersion = (python --version)
|
run: ${{ steps.setup-python.outputs.python-path }} -VVV
|
||||||
if ("$pythonVersion" -NotMatch "3.13"){
|
|
||||||
Write-Host "The current version is $pythonVersion; expected version is 3.13"
|
setup-versions-with-freethread-input:
|
||||||
exit 1
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} using freethread input parameter
|
||||||
}
|
runs-on: ${{ matrix.os }}
|
||||||
$pythonVersion
|
strategy:
|
||||||
shell: pwsh
|
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
|
||||||
|
|
3
__tests__/verify-freethread.py
Normal file
3
__tests__/verify-freethread.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import sys
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(f"Using GIL: {sys._is_gil_enabled()}\n")
|
Loading…
Reference in a new issue