Compare commits
No commits in common. "main" and "v4.1" have entirely different histories.
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||||
name: Test the action
|
name: Test the action
|
||||||
steps:
|
steps:
|
||||||
|
@ -32,7 +32,7 @@ This action supports the following inputs:
|
|||||||
| -------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
| -------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `python-version` | Not specified | Version range or exact version of a Python version to use, using SemVer's version range syntax. |
|
| `python-version` | Not specified | Version range or exact version of a Python version to use, using SemVer's version range syntax. |
|
||||||
| `python-version-file` | `pyproject.toml` | File containing the Python version to use. Example: .`python-version` |
|
| `python-version-file` | `pyproject.toml` | File containing the Python version to use. Example: .`python-version` |
|
||||||
| `architecture` | `x64` | The target architecture (x86, x64, arm64) of the Python interpreter. |
|
| `architecture` | `x64` | The target architecture (x86, x64) of the Python interpreter. |
|
||||||
| `allow-python-prereleases` | `false` | Allow prerelease versions of Python to be installed. |
|
| `allow-python-prereleases` | `false` | Allow prerelease versions of Python to be installed. |
|
||||||
| `token` | `${{ github.token }}` | Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user. |
|
| `token` | `${{ github.token }}` | Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user. |
|
||||||
| `version` | Not specified | The version of PDM to install, or 'head' to install from the main branch. |
|
| `version` | Not specified | The version of PDM to install, or 'head' to install from the main branch. |
|
||||||
|
@ -8,7 +8,7 @@ inputs:
|
|||||||
python-version-file:
|
python-version-file:
|
||||||
description: 'File containing the Python version to use. Example: .python-version'
|
description: 'File containing the Python version to use. Example: .python-version'
|
||||||
architecture:
|
architecture:
|
||||||
description: 'The target architecture (x86, x64, arm64) of the Python interpreter.'
|
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
||||||
required: false
|
required: false
|
||||||
allow-python-prereleases:
|
allow-python-prereleases:
|
||||||
description: Allow prerelease versions of Python to be installed.
|
description: Allow prerelease versions of Python to be installed.
|
||||||
@ -37,12 +37,6 @@ inputs:
|
|||||||
description: The dependency file(s) to cache.
|
description: The dependency file(s) to cache.
|
||||||
default: pdm.lock
|
default: pdm.lock
|
||||||
required: false
|
required: false
|
||||||
cache-restore-exact-match:
|
|
||||||
description: >
|
|
||||||
Restore cache ONLY on exact match with the primary key.
|
|
||||||
Note: Post-installation cache will still be saved if cache is 'true'.
|
|
||||||
default: 'false'
|
|
||||||
required: false
|
|
||||||
update-python:
|
update-python:
|
||||||
description: Whether to update the environment with the requested Python
|
description: Whether to update the environment with the requested Python
|
||||||
default: 'true'
|
default: 'true'
|
||||||
|
58830
dist/cache-save.js
vendored
58830
dist/cache-save.js
vendored
File diff suppressed because one or more lines are too long
63940
dist/setup-pdm.js
vendored
63940
dist/setup-pdm.js
vendored
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@
|
|||||||
"lint:fix": "eslint . --fix"
|
"lint:fix": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^4.0.3",
|
"@actions/cache": "^3.2.3",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/glob": "^0.4.0",
|
"@actions/glob": "^0.4.0",
|
||||||
|
11
pdm.lock
generated
11
pdm.lock
generated
@ -3,12 +3,9 @@
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
groups = ["default", "dev"]
|
groups = ["default", "dev"]
|
||||||
strategy = ["inherit_metadata"]
|
strategy = ["cross_platform", "inherit_metadata"]
|
||||||
lock_version = "4.5.0"
|
lock_version = "4.4.1"
|
||||||
content_hash = "sha256:c7bc8c77abe4c890545158d7bfdd811dce4a2658fa8ab856aa152f869973efab"
|
content_hash = "sha256:eb061d39de14e94263f38ecb20461dfb8a9fc7d73a3f9ede85ded6085701598a"
|
||||||
|
|
||||||
[[metadata.targets]]
|
|
||||||
requires_python = ">=3.9"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "certifi"
|
name = "certifi"
|
||||||
@ -63,7 +60,7 @@ version = "2.1.0"
|
|||||||
requires_python = ">=3.8"
|
requires_python = ">=3.8"
|
||||||
summary = "HTTP library with thread-safe connection pooling, file post, and more."
|
summary = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
marker = "python_version == \"3.13\""
|
marker = "python_version == \"3.8\""
|
||||||
files = [
|
files = [
|
||||||
{file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3"},
|
{file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3"},
|
||||||
{file = "urllib3-2.1.0.tar.gz", hash = "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"},
|
{file = "urllib3-2.1.0.tar.gz", hash = "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"},
|
||||||
|
2849
pnpm-lock.yaml
generated
2849
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
name = "setup-pdm"
|
name = "setup-pdm"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
authors = [ { name = "Frost Ming", email = "mianghong@gmail.com" }, ]
|
authors = [ { name = "Frost Ming", email = "mianghong@gmail.com" }, ]
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.8"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|
||||||
[tool.pdm]
|
[tool.pdm]
|
||||||
@ -10,9 +10,9 @@ distribution = false
|
|||||||
|
|
||||||
[tool.pdm.dev-dependencies]
|
[tool.pdm.dev-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
"certifi; python_version=='3.9'",
|
"urllib3; python_version=='3.8'",
|
||||||
"pytz; python_version=='3.10'",
|
"certifi; python_version=='3.9'",
|
||||||
"setuptools; python_version=='3.11'",
|
"pytz; python_version=='3.10'",
|
||||||
"six; python_version=='3.12'",
|
"setuptools; python_version=='3.11'",
|
||||||
"urllib3; python_version=='3.13'",
|
"six; python_version=='3.12'",
|
||||||
]
|
]
|
||||||
|
@ -7,14 +7,8 @@ import { getOutput } from './utils'
|
|||||||
|
|
||||||
async function calculateCacheKeys(pythonVersion: string, cacheDependencyPath: string): Promise<{ primaryKey: string, restoreKeys: string[] }> {
|
async function calculateCacheKeys(pythonVersion: string, cacheDependencyPath: string): Promise<{ primaryKey: string, restoreKeys: string[] }> {
|
||||||
const hash = await hashFiles(cacheDependencyPath)
|
const hash = await hashFiles(cacheDependencyPath)
|
||||||
const primaryKey = `setup-pdm-${process.env.RUNNER_OS}-${process.env.RUNNER_ARCH}-python-${pythonVersion}-${hash}`
|
const primaryKey = `setup-pdm-${process.env.RUNNER_OS}-python-${pythonVersion}-${hash}`
|
||||||
const restoreKey = `setup-pdm-${process.env.RUNNER_OS}-${process.env.RUNNER_ARCH}-python-${pythonVersion}-`
|
const restoreKey = `setup-pdm-${process.env.RUNNER_OS}-python-${pythonVersion}-`
|
||||||
|
|
||||||
const restoreExactMatch = core.getBooleanInput('cache-restore-exact-match')
|
|
||||||
if (restoreExactMatch) {
|
|
||||||
return { primaryKey, restoreKeys: [] }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { primaryKey, restoreKeys: [restoreKey] }
|
return { primaryKey, restoreKeys: [restoreKey] }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,27 +41,22 @@ async function run(): Promise<void> {
|
|||||||
cmdArgs.push('-o', 'install-output.json')
|
cmdArgs.push('-o', 'install-output.json')
|
||||||
// Use the default python version installed with the runner
|
// Use the default python version installed with the runner
|
||||||
try {
|
try {
|
||||||
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)
|
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// See https://github.com/actions/virtual-environments/issues/2803
|
|
||||||
if (process.arch === 'x64') {
|
|
||||||
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
|
|
||||||
}
|
|
||||||
else if (process.arch === 'arm64') {
|
|
||||||
core.exportVariable('LD_PRELOAD', '/lib/aarch64-linux-gnu/libgcc_s.so.1')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await exec(IS_WINDOWS ? 'python' : 'python3', cmdArgs, { input: await utils.fetchUrlAsBuffer(INSTALL_SCRIPT_URL) })
|
await exec(IS_WINDOWS ? 'python' : 'python3', cmdArgs, { input: await utils.fetchUrlAsBuffer(INSTALL_SCRIPT_URL) })
|
||||||
const installOutput: InstallOutput = JSON.parse(await utils.readFile('install-output.json'))
|
const installOutput: InstallOutput = JSON.parse(await utils.readFile('install-output.json'))
|
||||||
core.debug(`Install output: ${installOutput}`)
|
core.debug(`Install output: ${installOutput}`)
|
||||||
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
|
|
||||||
core.setOutput('pdm-version', installOutput.pdm_version)
|
core.setOutput('pdm-version', installOutput.pdm_version)
|
||||||
core.setOutput('pdm-bin', path.join(installOutput.install_location, installOutput.pdm_bin))
|
core.setOutput('pdm-bin', path.join(installOutput.install_location, installOutput.pdm_bin))
|
||||||
core.addPath(path.dirname(installOutput.pdm_bin))
|
core.addPath(path.dirname(installOutput.pdm_bin))
|
||||||
if (core.getBooleanInput('enable-pep582'))
|
if (core.getBooleanInput('enable-pep582'))
|
||||||
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version))
|
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version))
|
||||||
|
|
||||||
|
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)
|
||||||
|
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
// See https://github.com/actions/virtual-environments/issues/2803
|
||||||
|
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
|
||||||
|
}
|
||||||
|
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
|
||||||
const matchersPath = path.join(__dirname, '..', '.github')
|
const matchersPath = path.join(__dirname, '..', '.github')
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`)
|
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`)
|
||||||
if (utils.isCacheAvailable())
|
if (utils.isCacheAvailable())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user