Compare commits

..

5 Commits
v4.1 ... main

Author SHA1 Message Date
Matteo Castellini
94a823180e
Update @actions/cache to v4.0.3 (#71) 2025-04-23 15:44:04 +08:00
Firas Cheaib
deb8d8a4e2
fix: use correct libgcc for arm64 (#68)
Signed-off-by: Firas Cheaib <firascheaib@gmail.com>
2025-03-06 08:40:24 +08:00
Frost Ming
b2472ca425
fix: set python version first (#65)
* fix: set python version first

Signed-off-by: Frost Ming <me@frostming.com>

* fix: drop 3.8 and add 3.13

Signed-off-by: Frost Ming <me@frostming.com>

* fix: update pdm.lock

Signed-off-by: Frost Ming <me@frostming.com>
2024-11-28 09:15:12 +08:00
Szymon Maszke
2f3a9be7ac
feat: add ability to restore cache by exact match (#60)
Signed-off-by: szymonmaszke <github@maszke.co>
2024-08-09 15:07:36 +08:00
❤是纱雾酱哟~
176c044a20
feat(cache): Distinguish architectures of caches (#58)
Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
2024-07-03 08:48:56 +08:00
12 changed files with 52075 additions and 73676 deletions

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [windows-latest, ubuntu-latest, macos-latest]
name: Test the action
steps:

View File

@ -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-file` | `pyproject.toml` | File containing the Python version to use. Example: .`python-version` |
| `architecture` | `x64` | The target architecture (x86, x64) of the Python interpreter. |
| `architecture` | `x64` | The target architecture (x86, x64, arm64) of the Python interpreter. |
| `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. |
| `version` | Not specified | The version of PDM to install, or 'head' to install from the main branch. |

View File

@ -8,7 +8,7 @@ inputs:
python-version-file:
description: 'File containing the Python version to use. Example: .python-version'
architecture:
description: 'The target architecture (x86, x64) of the Python interpreter.'
description: 'The target architecture (x86, x64, arm64) of the Python interpreter.'
required: false
allow-python-prereleases:
description: Allow prerelease versions of Python to be installed.
@ -37,6 +37,12 @@ inputs:
description: The dependency file(s) to cache.
default: pdm.lock
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:
description: Whether to update the environment with the requested Python
default: 'true'

58188
dist/cache-save.js vendored

File diff suppressed because one or more lines are too long

63286
dist/setup-pdm.js vendored

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@actions/cache": "^3.2.3",
"@actions/cache": "^4.0.3",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.4.0",

11
pdm.lock generated
View File

@ -3,9 +3,12 @@
[metadata]
groups = ["default", "dev"]
strategy = ["cross_platform", "inherit_metadata"]
lock_version = "4.4.1"
content_hash = "sha256:eb061d39de14e94263f38ecb20461dfb8a9fc7d73a3f9ede85ded6085701598a"
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:c7bc8c77abe4c890545158d7bfdd811dce4a2658fa8ab856aa152f869973efab"
[[metadata.targets]]
requires_python = ">=3.9"
[[package]]
name = "certifi"
@ -60,7 +63,7 @@ version = "2.1.0"
requires_python = ">=3.8"
summary = "HTTP library with thread-safe connection pooling, file post, and more."
groups = ["dev"]
marker = "python_version == \"3.8\""
marker = "python_version == \"3.13\""
files = [
{file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3"},
{file = "urllib3-2.1.0.tar.gz", hash = "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"},

2763
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
name = "setup-pdm"
version = "0.0.0"
authors = [ { name = "Frost Ming", email = "mianghong@gmail.com" }, ]
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { text = "MIT" }
[tool.pdm]
@ -10,9 +10,9 @@ distribution = false
[tool.pdm.dev-dependencies]
dev = [
"urllib3; python_version=='3.8'",
"certifi; python_version=='3.9'",
"pytz; python_version=='3.10'",
"setuptools; python_version=='3.11'",
"six; python_version=='3.12'",
"urllib3; python_version=='3.13'",
]

View File

@ -7,8 +7,14 @@ import { getOutput } from './utils'
async function calculateCacheKeys(pythonVersion: string, cacheDependencyPath: string): Promise<{ primaryKey: string, restoreKeys: string[] }> {
const hash = await hashFiles(cacheDependencyPath)
const primaryKey = `setup-pdm-${process.env.RUNNER_OS}-python-${pythonVersion}-${hash}`
const restoreKey = `setup-pdm-${process.env.RUNNER_OS}-python-${pythonVersion}-`
const primaryKey = `setup-pdm-${process.env.RUNNER_OS}-${process.env.RUNNER_ARCH}-python-${pythonVersion}-${hash}`
const restoreKey = `setup-pdm-${process.env.RUNNER_OS}-${process.env.RUNNER_ARCH}-python-${pythonVersion}-`
const restoreExactMatch = core.getBooleanInput('cache-restore-exact-match')
if (restoreExactMatch) {
return { primaryKey, restoreKeys: [] }
}
return { primaryKey, restoreKeys: [restoreKey] }
}

View File

@ -41,22 +41,27 @@ async function run(): Promise<void> {
cmdArgs.push('-o', 'install-output.json')
// Use the default python version installed with the runner
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) })
const installOutput: InstallOutput = JSON.parse(await utils.readFile('install-output.json'))
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-bin', path.join(installOutput.install_location, installOutput.pdm_bin))
core.addPath(path.dirname(installOutput.pdm_bin))
if (core.getBooleanInput('enable-pep582'))
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')
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`)
if (utils.isCacheAvailable())

View File

@ -4,11 +4,11 @@ import sys
import unittest
PACKAGE_MAP = {
"3.8": "urllib3",
"3.9": "certifi",
"3.10": "pytz",
"3.11": "setuptools",
"3.12": "six",
"3.13": "urllib3",
}