You've already forked setup-python
							
							
				mirror of
				https://github.com/actions/setup-python.git
				synced 2025-10-31 23:26:24 +07:00 
			
		
		
		
	Compare commits
	
		
			10 Commits
		
	
	
		
			v4.0.0
			...
			releases/v
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0cf603f701 | |||
| 0f07f7f756 | |||
| 9f3aa2c73d | |||
| 152ba7c4dd | |||
| da8703fb23 | |||
| accf675719 | |||
| 614aa4aa1e | |||
| 53d19faf05 | |||
| 948e5343c7 | |||
| bdd6409dc1 | 
							
								
								
									
										28
									
								
								.github/workflows/release-new-action-version.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/release-new-action-version.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| name: Release new action version | ||||
|  | ||||
| on: | ||||
|   release: | ||||
|     types: [released] | ||||
|   workflow_dispatch: | ||||
|     inputs: | ||||
|       TAG_NAME: | ||||
|         description: 'Tag name that the major tag will point to' | ||||
|         required: true | ||||
|  | ||||
| env: | ||||
|   TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} | ||||
| permissions: | ||||
|   contents: write | ||||
|  | ||||
| jobs: | ||||
|   update_tag: | ||||
|     name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes | ||||
|     environment: | ||||
|       name: releaseNewActionVersion | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Update the ${{ env.TAG_NAME }} tag | ||||
|         uses: actions/publish-action@v0.2.2 | ||||
|         with: | ||||
|           source-tag: ${{ env.TAG_NAME }} | ||||
|           slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | ||||
							
								
								
									
										77
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,77 @@ | ||||
| name: Validate 'setup-python' | ||||
| on:  | ||||
|   pull_request: | ||||
|     paths-ignore: | ||||
|       - '**.md' | ||||
|  | ||||
| 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  | ||||
|       uses: ./ | ||||
|  | ||||
|     - name: Validate version | ||||
|       run: python --version | ||||
|  | ||||
|     - name: Run simple python code | ||||
|       run: python -c 'import math; print(math.factorial(5))' | ||||
|  | ||||
|   setup-python: | ||||
|     name: Setup ${{ matrix.python }} ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04] | ||||
|         python: [3.5, 3.6, 3.7, 3.8, 3.9] | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|  | ||||
|     - name: setup-python ${{ matrix.python }} | ||||
|       uses: ./ | ||||
|       with: | ||||
|         python-version: ${{ matrix.python }} | ||||
|  | ||||
|     - name: Validate version | ||||
|       run: | | ||||
|         $pythonVersion = (python --version) | ||||
|         if ("$pythonVersion" -notlike "Python ${{ matrix.python }}.*"){ | ||||
|           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-pypy: | ||||
|     name: Setup PyPy ${{ matrix.os }} | ||||
|     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-python pypy3 | ||||
|       uses: ./ | ||||
|       with: | ||||
|         python-version: 'pypy3' | ||||
|  | ||||
|     - name: setup-python pypy2 | ||||
|       uses: ./ | ||||
|       with: | ||||
|         python-version: 'pypy2' | ||||
							
								
								
									
										2220
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2220
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -5,9 +5,28 @@ | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
|     "@actions/core": { | ||||
|       "version": "1.2.3", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz", | ||||
|       "integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==" | ||||
|       "version": "1.10.0", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", | ||||
|       "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", | ||||
|       "requires": { | ||||
|         "@actions/http-client": "^2.0.1", | ||||
|         "uuid": "^8.3.2" | ||||
|       }, | ||||
|       "dependencies": { | ||||
|         "@actions/http-client": { | ||||
|           "version": "2.1.0", | ||||
|           "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz", | ||||
|           "integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==", | ||||
|           "requires": { | ||||
|             "tunnel": "^0.0.6" | ||||
|           } | ||||
|         }, | ||||
|         "uuid": { | ||||
|           "version": "8.3.2", | ||||
|           "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", | ||||
|           "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "@actions/exec": { | ||||
|       "version": "1.0.3", | ||||
| @ -4543,8 +4562,7 @@ | ||||
|     "tunnel": { | ||||
|       "version": "0.0.6", | ||||
|       "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", | ||||
|       "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", | ||||
|       "dev": true | ||||
|       "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" | ||||
|     }, | ||||
|     "tunnel-agent": { | ||||
|       "version": "0.6.0", | ||||
|  | ||||
| @ -23,7 +23,7 @@ | ||||
|   "author": "GitHub", | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/core": "^1.2.3", | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "semver": "^7.1.3" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|  | ||||
| @ -51,8 +51,11 @@ function binDir(installDir: string): string { | ||||
| // A particular version of PyPy may contain one or more versions of the Python interpreter. | ||||
| // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha. | ||||
| // We only care about the Python version, so we don't use the PyPy version for the tool cache. | ||||
| function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion { | ||||
|   const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString()); | ||||
| function usePyPy( | ||||
|   majorVersion: '2' | '3.6', | ||||
|   architecture: string | ||||
| ): InstalledVersion { | ||||
|   const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion); | ||||
|   let installDir: string | null = findPyPy(architecture); | ||||
|  | ||||
|   if (!installDir && IS_WINDOWS) { | ||||
| @ -77,6 +80,10 @@ function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion { | ||||
|  | ||||
|   core.addPath(installDir); | ||||
|   core.addPath(_binDir); | ||||
|   // Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows. | ||||
|   if (IS_WINDOWS) { | ||||
|     core.addPath(path.join(installDir, 'Scripts')); | ||||
|   } | ||||
|  | ||||
|   const impl = 'pypy' + majorVersion.toString(); | ||||
|   core.setOutput('python-version', impl); | ||||
| @ -186,9 +193,10 @@ export async function findPythonVersion( | ||||
| ): Promise<InstalledVersion> { | ||||
|   switch (version.toUpperCase()) { | ||||
|     case 'PYPY2': | ||||
|       return usePyPy(2, architecture); | ||||
|       return usePyPy('2', architecture); | ||||
|     case 'PYPY3': | ||||
|       return usePyPy(3, architecture); | ||||
|       // keep pypy3 pointing to 3.6 for backward compatibility | ||||
|       return usePyPy('3.6', architecture); | ||||
|     default: | ||||
|       return await useCpythonVersion(version, architecture); | ||||
|   } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	