-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
132 lines (123 loc) · 4.1 KB
/
action.yml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: 'PyBuilder Action'
description: 'PyBuilder Composite GitHub Action'
branding:
icon: zap
color: blue
inputs:
checkout:
description: 'Do checkout first'
required: false
default: 'true'
install-python:
description: 'Whether to install Python'
required: false
default: 'true'
homebrew-python:
description: 'Whether Python should be installed via Homebrew'
required: false
default: 'false'
python-version:
description: 'Python version to use, if installing'
required: false
default: '3.11'
architecture:
description: 'Install Python for specific architecture, if installing'
required: false
default: x64
with-venv:
description: 'Whether to use Virtualenv during a build'
required: false
default: 'true'
install-pyb:
description: 'Install PyBuilder'
required: false
default: 'true'
pyb-version:
description: 'PyBuilder version to install'
required: false
default: '>=0.12.0'
pyb-command:
description: 'Command to run PyBuilder'
required: false
default: 'pyb'
pyb-args:
description: 'PyBuilder command line arguments'
required: false
default: "-E ci -v -X"
pyb-extra-args:
description: 'PyBuilder extra command line arguments'
required: false
default: ""
pre-build:
description: 'Run a script before PyBuilder build'
required: false
default: ""
runs:
using: "composite"
steps:
- name: Configure Python Executable
shell: bash
run: |
PV='${{inputs.python-version}}'
PV="${PV##pypy-}"
echo "PYTHON=python${PV%%.*}" >> $GITHUB_ENV
- name: Checkout
if: inputs.checkout == 'true'
uses: actions/checkout@v4
- name: Setup Python
if: inputs.install-python == 'true' && (runner.os != 'macOS' || inputs.homebrew-python != 'true')
uses: actions/setup-python@v5
with:
python-version: '${{ inputs.python-version }}'
architecture: '${{ inputs.architecture }}'
- name: Setup Python with Homebrew
shell: bash
if: inputs.install-python == 'true' && runner.os == 'macOS' && inputs.homebrew-python == 'true'
run: |
NONINTERACTIVE=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" || true
NONINTERACTIVE=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew uninstall --force --ignore-dependencies 'python@${{ inputs.python-version }}' || true
brew install --overwrite 'python@${{ inputs.python-version }}'
echo "/usr/local/opt/python@${{ inputs.python-version }}/Frameworks/Python.framework/Versions/${{ inputs.python-version }}/bin" >> $GITHUB_PATH
echo "/usr/local/opt/python@${{ inputs.python-version }}/libexec/bin" >> $GITHUB_PATH
echo "/usr/local/opt/python@${{ inputs.python-version }}/bin" >> $GITHUB_PATH
- name: Python Pre-VENV Check
shell: bash
run: |
pwd
echo $PATH
which $PYTHON
$PYTHON --version
$PYTHON -m pip --version
# $PYTHON -c "import sysconfig; import pprint; pprint.pprint(sysconfig.get_config_vars())"
- name: Create VEnv
shell: bash
if: inputs.with-venv == 'true'
run: |
$PYTHON -m pip install --break-system-packages virtualenv
virtualenv $HOME/.pyb
echo "$HOME/.pyb/bin" >> $GITHUB_PATH
- name: Python Post-VENV Check
shell: bash
run: |
pwd
echo $PATH
which $PYTHON
$PYTHON --version
$PYTHON -m pip --version
# $PYTHON -c "import sysconfig; import pprint; pprint.pprint(sysconfig.get_config_vars())"
- name: Install PyBuilder
shell: bash
if: inputs.install-pyb == 'true'
run: |
$PYTHON -m pip install --break-system-packages 'pybuilder${{ inputs.pyb-version }}'
which pyb
pyb --version
- name: Pre-Build
shell: bash
if: inputs.pre-build != ''
run: |
${{ inputs.pre-build }}
- name: Build
shell: bash
run: ${{ inputs.pyb-command }} ${{ inputs.pyb-args }} ${{ inputs.pyb-extra-args }}