mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-10-31 19:58:55 +08:00 
			
		
		
		
	Install multiple python versions (#567)
This commit is contained in:
		
							
								
								
									
										42
									
								
								.github/workflows/test-pypy.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										42
									
								
								.github/workflows/test-pypy.yml
									
									
									
									
										vendored
									
									
								
							| @@ -124,4 +124,46 @@ jobs: | ||||
|           EXECUTABLE=${EXECUTABLE/-/}  # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name | ||||
|           EXECUTABLE=${EXECUTABLE%%-*}  # remove any -* suffixe | ||||
|           ${EXECUTABLE} --version | ||||
|         shell: bash | ||||
|  | ||||
|   setup-pypy-multiple-versions: | ||||
|     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 | ||||
|               pypy3.8 | ||||
|           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 | ||||
|       - name: Assert expected binaries (or symlinks) are present | ||||
|         run: | | ||||
|           EXECUTABLE='pypy3.8' | ||||
|           EXECUTABLE=${EXECUTABLE/pypy-/pypy}  # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name | ||||
|           EXECUTABLE=${EXECUTABLE%%-*}  # remove any -* suffixe | ||||
|           ${EXECUTABLE} --version | ||||
|         shell: bash | ||||
							
								
								
									
										31
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							| @@ -191,8 +191,35 @@ jobs: | ||||
|       - name: Validate version | ||||
|         run: | | ||||
|           $pythonVersion = (python --version) | ||||
|           if ("$pythonVersion" -NotMatch "${{ matrix.python }}"){ | ||||
|             Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}" | ||||
|           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-python-multiple-python-versions: | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Setup Python and check latest | ||||
|         uses: ./ | ||||
|         with: | ||||
|           python-version: | | ||||
|               3.7 | ||||
|               3.8 | ||||
|               3.9 | ||||
|               3.10 | ||||
|           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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dmitry Shibanov
					Dmitry Shibanov