mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-10-31 11:48:56 +08:00 
			
		
		
		
	add support for python-version-file (#336)
* add support for python-version-file * Update action.yml * update to v4, remove python-version default * python-version overrides python-version-file, like setup-node * checks '.python-version' by default if nothing else specified * update tests, update to checkout@v3 * update build * appease the linter * remove old test for default python version * revert readme changes * update build
This commit is contained in:
		
							
								
								
									
										68
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										68
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							| @@ -10,33 +10,9 @@ on: | ||||
|       - '**.md' | ||||
|   schedule: | ||||
|     - cron: 30 3 * * * | ||||
|   workflow_dispatch: | ||||
|  | ||||
| jobs: | ||||
|   default-version: | ||||
|     name: Setup default version | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04] | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|  | ||||
|     - name: setup default python | ||||
|       id: setup-python | ||||
|       uses: ./ | ||||
|  | ||||
|     - name: Check python-path | ||||
|       run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}' | ||||
|       shell: bash | ||||
|  | ||||
|     - name: Validate version | ||||
|       run: python --version | ||||
|  | ||||
|     - name: Run simple python code | ||||
|       run: python -c 'import math; print(math.factorial(5))' | ||||
|  | ||||
|   setup-versions-from-manifest: | ||||
|     name: Setup ${{ matrix.python }} ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
| @@ -47,7 +23,7 @@ jobs: | ||||
|         python: [3.5.4, 3.6.7, 3.7.5, 3.8.1] | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|       uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: setup-python ${{ matrix.python }} | ||||
|       id: setup-python | ||||
| @@ -72,6 +48,44 @@ jobs: | ||||
|     - name: Run simple code | ||||
|       run: python -c 'import math; print(math.factorial(5))' | ||||
|  | ||||
|   setup-versions-from-file: | ||||
|     name: Setup ${{ matrix.python }} ${{ matrix.os }} version file | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04] | ||||
|         python: [3.5.4, 3.6.7, 3.7.5, 3.8.1] | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: build-version-file ${{ matrix.python }} | ||||
|       run: echo ${{ matrix.python }} > .python-version | ||||
|  | ||||
|     - name: setup-python ${{ matrix.python }} | ||||
|       id: setup-python | ||||
|       uses: ./ | ||||
|       with: | ||||
|         python-version-file: '.python-version' | ||||
|  | ||||
|     - 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))' | ||||
|  | ||||
|   setup-pre-release-version-from-manifest: | ||||
|     name: Setup 3.9.0-beta.4 ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
| @@ -81,7 +95,7 @@ jobs: | ||||
|         os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04] | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|       uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: setup-python 3.9.0-beta.4 | ||||
|       id: setup-python | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Andrew DiLosa
					Andrew DiLosa