Bumps the actions group with 5 updates: | Package | From | To | | --- | --- | --- | | [actions/setup-python](https://github.com/actions/setup-python) | `6.3.0` | `7.0.0` | | [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `8.3.2` | `9.0.0` | | [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) | `1.14.0` | `1.14.1` | | [j178/prek-action](https://github.com/j178/prek-action) | `2.0.5` | `2.0.6` | | [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.6.0` | `0.6.1` | Updates `actions/setup-python` from 6.3.0 to 7.0.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/ece7cb06caefa5fff74198d8649806c4678c61a1...5fda3b95a4ea91299a34e894583c3862153e4b97) Updates `astral-sh/setup-uv` from 8.3.2 to 9.0.0 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](https://github.com/astral-sh/setup-uv/compare/11f9893b081a58869d3b5fccaea48c9e9e46f990...c771a70e6277c0a99b617c7a806ffedaca235ff9) Updates `pypa/gh-action-pypi-publish` from 1.14.0 to 1.14.1 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/cef221092ed1bacb1cc03d23a2d87d1d172e277b...ba38be9e461d3875417946c167d0b5f3d385a247) Updates `j178/prek-action` from 2.0.5 to 2.0.6 - [Release notes](https://github.com/j178/prek-action/releases) - [Commits](https://github.com/j178/prek-action/compare/e98a699c41eb69ab013a45817a0406469a748f8d...5337cb91e0fa35a7ff31b9ca345126d8bbbcdf16) Updates `zizmorcore/zizmor-action` from 0.6.0 to 0.6.1 - [Release notes](https://github.com/zizmorcore/zizmor-action/releases) - [Commits](https://github.com/zizmorcore/zizmor-action/compare/6599ee8b7a49aef6a770f63d261d214911a7ce02...6fc4b006235f201fdab3722e17240ab420d580e5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: astral-sh/setup-uv dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-version: 1.14.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: j178/prek-action dependency-version: 2.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: zizmorcore/zizmor-action dependency-version: 0.6.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
148 lines
4.8 KiB
YAML
148 lines
4.8 KiB
YAML
name: cibuildwheel
|
|
description: 'Installs and runs cibuildwheel on the current runner'
|
|
inputs:
|
|
package-dir:
|
|
description: 'Input directory, defaults to "."'
|
|
required: false
|
|
default: .
|
|
output-dir:
|
|
description: 'Folder to place the outputs in, defaults to "wheelhouse"'
|
|
required: false
|
|
default: wheelhouse
|
|
config-file:
|
|
description: 'File containing the config, defaults to {package}/pyproject.toml'
|
|
required: false
|
|
default: ''
|
|
only:
|
|
description: 'Build a specific wheel only. No need for arch/platform if this is set'
|
|
required: false
|
|
default: ''
|
|
extras:
|
|
description: 'Comma-separated list of extras to install'
|
|
required: false
|
|
default: ''
|
|
branding:
|
|
icon: package
|
|
color: yellow
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
id: python
|
|
with:
|
|
python-version: "3.11 - 3.14"
|
|
update-environment: false
|
|
|
|
- id: cibw
|
|
run: |
|
|
# Install cibuildwheel and build the command line
|
|
"$PYTHON" -u << "EOF"
|
|
import os
|
|
import shlex
|
|
import shutil
|
|
import sys
|
|
import venv
|
|
|
|
from pathlib import Path
|
|
from subprocess import run
|
|
|
|
EXTRAS = set(e.strip() for e in os.environ.get("INPUT_EXTRAS", "").split(",") if e.strip())
|
|
|
|
|
|
class EnvBuilder(venv.EnvBuilder):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def setup_scripts(self, context):
|
|
pass
|
|
|
|
def post_setup(self, context):
|
|
super().post_setup(context)
|
|
self.bin_path = Path(context.env_exe).parent
|
|
install_spec = os.environ["GITHUB_ACTION_PATH"]
|
|
if EXTRAS:
|
|
install_spec += f"[{','.join(sorted(EXTRAS))}]"
|
|
run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", install_spec], check=True)
|
|
|
|
|
|
print("::group::Install cibuildwheel")
|
|
venv_path = Path(os.environ["RUNNER_TEMP"]) / "cibw"
|
|
if venv_path.exists():
|
|
shutil.rmtree(venv_path)
|
|
|
|
builder = EnvBuilder()
|
|
builder.create(venv_path)
|
|
exposed_binaries = {"cibuildwheel"}
|
|
|
|
if "uv" in EXTRAS:
|
|
exposed_binaries.add("uv")
|
|
clean_bin_path = builder.bin_path.parent / f"{builder.bin_path.name}.clean"
|
|
clean_bin_path.mkdir()
|
|
|
|
for path in list(builder.bin_path.iterdir()):
|
|
if path.stem in exposed_binaries:
|
|
try:
|
|
os.symlink(path, clean_bin_path / path.name)
|
|
except OSError:
|
|
shutil.copy2(path, clean_bin_path / path.name)
|
|
|
|
cibw_bin = [p for p in builder.bin_path.glob("cibuildwheel*") if p.stem == "cibuildwheel"][0]
|
|
|
|
# Build the command line
|
|
cmd_args = [str(cibw_bin), os.environ["INPUT_PACKAGE_DIR"]]
|
|
|
|
if output_dir := os.environ.get("INPUT_OUTPUT_DIR"):
|
|
cmd_args += ["--output-dir", output_dir]
|
|
|
|
if config_file := os.environ.get("INPUT_CONFIG_FILE"):
|
|
cmd_args += ["--config-file", config_file]
|
|
|
|
if only := os.environ.get("INPUT_ONLY"):
|
|
cmd_args += ["--only", only]
|
|
|
|
cmd_bash = shlex.join(cmd_args)
|
|
|
|
def pwsh_quote(text):
|
|
# Wrap in single quotes and double-up any existing single quotes
|
|
return "'" + str(text).replace("'", "''") + "'"
|
|
|
|
# Prepend '& ' so PowerShell executes the quoted binary path
|
|
cmd_pwsh = "& " + " ".join(pwsh_quote(arg) for arg in cmd_args)
|
|
|
|
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
|
|
f.write(f"prepend-path={clean_bin_path}\n")
|
|
f.write(f"cmd-bash={cmd_bash}\n")
|
|
f.write(f"cmd-pwsh={cmd_pwsh}\n")
|
|
|
|
print("::endgroup::")
|
|
EOF
|
|
shell: bash
|
|
env:
|
|
PYTHON: ${{ steps.python.outputs.python-path }}
|
|
INPUT_PACKAGE_DIR: ${{ inputs.package-dir }}
|
|
INPUT_OUTPUT_DIR: ${{ inputs.output-dir }}
|
|
INPUT_CONFIG_FILE: ${{ inputs.config-file }}
|
|
INPUT_ONLY: ${{ inputs.only }}
|
|
INPUT_EXTRAS: ${{ inputs.extras }}
|
|
|
|
# Redirecting stderr to stdout to fix interleaving issue in Actions.
|
|
- run: |
|
|
export PATH="$CIBW_PREPEND_PATH:$PATH"
|
|
eval "$CIBW_CMD_BASH" 2>&1
|
|
shell: bash
|
|
if: runner.os != 'Windows'
|
|
env:
|
|
CIBW_PREPEND_PATH: ${{ steps.cibw.outputs.prepend-path }}
|
|
CIBW_CMD_BASH: ${{ steps.cibw.outputs.cmd-bash }}
|
|
|
|
# Windows needs powershell to interact nicely with Meson
|
|
- run: |
|
|
$env:PATH = "$env:CIBW_PREPEND_PATH;$env:PATH"
|
|
Invoke-Expression $env:CIBW_CMD_PWSH
|
|
shell: pwsh
|
|
if: runner.os == 'Windows'
|
|
env:
|
|
CIBW_PREPEND_PATH: ${{ steps.cibw.outputs.prepend-path }}
|
|
CIBW_CMD_PWSH: ${{ steps.cibw.outputs.cmd-pwsh }}
|