-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
84 lines (79 loc) · 2.79 KB
/
Copy pathaction.yml
File metadata and controls
84 lines (79 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 'Setup xonsh shell'
description: 'Install xonsh shell on the runner. Use with `shell: xonsh {0}` in later steps.'
author: 'xonsh'
branding:
icon: 'at-sign'
color: 'green'
inputs:
xonsh-version:
description: 'xonsh version (PyPI specifier, e.g. "0.23.1" or ">=0.23.1"). Empty installs the latest.'
required: false
default: ''
python-version:
description: 'If set, runs actions/setup-python@v6 with this version before installing xonsh. Leave empty to use the Python already on PATH.'
required: false
default: ''
extras:
description: 'xonsh pip extras, e.g. "full". Installs as xonsh[<extras>].'
required: false
default: ''
xontribs:
description: 'Space-separated pip packages installed after xonsh. E.g. "xontrib-abbrevs xontrib-pipeliner".'
required: false
default: ''
outputs:
xonsh-version:
description: 'The installed xonsh version.'
value: ${{ steps.install.outputs.xonsh-version }}
xonsh-path:
description: 'Absolute path to the xonsh executable.'
value: ${{ steps.install.outputs.xonsh-path }}
runs:
using: 'composite'
steps:
- name: Set up Python
if: inputs.python-version != ''
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install xonsh
id: install
shell: bash
env:
SETUP_XONSH_VERSION: ${{ inputs.xonsh-version }}
SETUP_XONSH_EXTRAS: ${{ inputs.extras }}
SETUP_XONSH_XONTRIBS: ${{ inputs.xontribs }}
run: |
set -eu
PY=python
if ! command -v "$PY" >/dev/null 2>&1; then
PY=python3
fi
pkg="xonsh"
if [ -n "${SETUP_XONSH_EXTRAS}" ]; then
pkg="xonsh[${SETUP_XONSH_EXTRAS}]"
fi
if [ -n "${SETUP_XONSH_VERSION}" ]; then
if printf '%s' "${SETUP_XONSH_VERSION}" | grep -Eq '^(==|>=|<=|~=|!=|>|<)'; then
spec="${pkg}${SETUP_XONSH_VERSION}"
else
spec="${pkg}==${SETUP_XONSH_VERSION}"
fi
else
spec="${pkg}"
fi
"$PY" -m pip install --upgrade pip
"$PY" -m pip install "${spec}"
if [ -n "${SETUP_XONSH_XONTRIBS}" ]; then
"$PY" -m pip install ${SETUP_XONSH_XONTRIBS}
fi
installed=$("$PY" -c "import xonsh; print(xonsh.__version__)")
xonsh_path=$("$PY" -c "import shutil, sys; sys.stdout.write(shutil.which('xonsh') or '')")
echo "xonsh-version=${installed}" >> "${GITHUB_OUTPUT}"
echo "xonsh-path=${xonsh_path}" >> "${GITHUB_OUTPUT}"
echo "::notice title=setup-xonsh::Installed xonsh ${installed} at ${xonsh_path}"
- name: Verify xonsh
shell: 'xonsh {0}'
run: |
import sys, xonsh
print(f"setup-xonsh: xonsh {xonsh.__version__} on Python {sys.version.split()[0]}")