-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
70 lines (54 loc) · 1.68 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
name: 'install_python_packages'
description: 'Install generic and required python packages with pip'
inputs:
packages:
description: 'Custom packages to install using pip'
required: false
default: ''
upgrade:
description: 'Upgrade already installed packages'
required: false
default: false
requirements_file_name:
description: 'If set, the file name of a requirements.txt file'
required: false
default: ''
path:
description: 'Path to virtual environment'
required: false
default: '.venv'
activate_global:
description: 'Activate the virtual environment globally'
required: false
default: true
runs:
using: composite
steps:
- name: setup_python_venv
uses: eProsima/eProsima-CI/ubuntu/setup_python_venv@main
with:
path: ${{ inputs.path }}
activate_global: ${{ inputs.activate_global }}
- name: install_python_packages
run: |
echo "::group::Install Python packages"
# Set upgrade flag
if [ "${{ inputs.upgrade }}" = "true" ]; then
export UPGRADE_FLAG="--upgrade"
else
export UPGRADE_FLAG=""
fi
# Install python packages if any
if [[ ! -z "${{ inputs.packages }}" ]] ; then
pip3 install ${UPGRADE_FLAG} \
${{ inputs.packages }}
fi
# Install requirements file if any
if [[ ! -z "${{ inputs.requirements_file_name }}" ]] ; then
pip3 install ${UPGRADE_FLAG} \
-r ${{ inputs.requirements_file_name }}
fi
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade setuptools==74.1.3
echo "::endgroup::"
shell: bash