mirror of
https://github.com/actions/setup-python
synced 2025-04-05 14:59:42 +00:00
Add check-latest functionality (#406)
This commit is contained in:
33
.github/workflows/test-pypy.yml
vendored
33
.github/workflows/test-pypy.yml
vendored
@ -91,3 +91,36 @@ jobs:
|
||||
|
||||
- name: Run simple code
|
||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||
|
||||
check-latest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PyPy and check latest
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 'pypy-3.7-v7.3.x'
|
||||
check-latest: true
|
||||
- name: PyPy and Python version
|
||||
run: python --version
|
||||
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
|
||||
- name: Assert PyPy is running
|
||||
run: |
|
||||
import platform
|
||||
assert platform.python_implementation().lower() == "pypy"
|
||||
shell: python
|
||||
|
||||
- name: Assert expected binaries (or symlinks) are present
|
||||
run: |
|
||||
EXECUTABLE="pypy-3.7-v7.3.x"
|
||||
EXECUTABLE=${EXECUTABLE/-/} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
|
||||
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
|
||||
${EXECUTABLE} --version
|
||||
shell: bash
|
24
.github/workflows/test-python.yml
vendored
24
.github/workflows/test-python.yml
vendored
@ -172,3 +172,27 @@ jobs:
|
||||
|
||||
- name: Run simple code
|
||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||
|
||||
check-latest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
python-version: ["3.8", "3.9", "3.10"]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Python and check latest
|
||||
uses: ./
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
check-latest: true
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("$pythonVersion" -NotMatch "${{ matrix.python }}"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
Reference in New Issue
Block a user