mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-10-31 07:47:08 +00:00 
			
		
		
		
	feature: fallback to pre-release when no stable version is found (#414)
This allows to specify version like `3.11` or `pypy3.10` in workflows before those versions are released. This lessen the burden for users of `setup-python` by not having to modify their workflow twice: once when a pre-release is available (e.g. `3.11-dev`) and once when the first stable release is published (e.g. `3.11`)
This commit is contained in:
		
							
								
								
									
										31
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							| @@ -149,6 +149,35 @@ jobs: | ||||
|     - name: Run simple code | ||||
|       run: python -c 'import math; print(math.factorial(5))' | ||||
|  | ||||
|   setup-prerelease-version: | ||||
|     name: Setup 3.12 ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: setup-python 3.12 | ||||
|       id: setup-python | ||||
|       uses: ./ | ||||
|       with: | ||||
|         python-version: '3.12' | ||||
|         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.12.') }} | ||||
|       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 }} | ||||
| @@ -223,4 +252,4 @@ jobs: | ||||
|             exit 1 | ||||
|           } | ||||
|           $pythonVersion | ||||
|         shell: pwsh | ||||
|         shell: pwsh | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matthieu Darbois
					Matthieu Darbois