miniupnp/.github/actions/activate-venv/action.yml

46 lines
1.6 KiB
YAML

# Copyright 2024 Chia Network Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Activate virtual environment"
description: 'Activate the a virtual environment for future steps.'
inputs:
directories:
description: "A list of directories to attempt to activate, terminates on the first present directory. Uses JSON format."
required: true
default: '["venv/", ".venv/"]'
#outputs:
# virtual-env:
# description: "The VIRTUAL_ENV environment value."
# value:
# virtual-env-bin:
# description: "The path to the virtual environment directory containing the executables."
# value:
runs:
using: "composite"
steps:
- name: Activate virtual environment
shell: sh
env:
INPUT_DIRECTORIES: ${{ inputs.directories }}
run: |
unset PYTHON
for V in 311 3.11 310 3.10 39 3.9 38 3.8 37 3.7 3 ""; do
if command -v python$V >/dev/null; then
PYTHON=python$V
break
fi
done
[ -n "$PYTHON" ] || (echo "Unable to find python" && exit 1)
$PYTHON "${GITHUB_ACTION_PATH}/activate_venv.py"