forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
41 lines (41 loc) · 1.62 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
name: "setup-python"
description: "Ensures to install a python version that's available on Anaconda"
inputs:
python-version:
description: "The python version to install. If unspecified, install the minimum python version mlflow supports."
required: false
outputs:
installed-python-version:
description: "The installed python version"
value: ${{ steps.fetch-python-version.outputs.version }}
runs:
using: "composite"
steps:
- name: get-python-version
id: get-python-version
shell: bash
# We used to use `conda search python=3.x` to dynamically fetch the latest available version
# in 3.x on Anaconda, but it turned out `conda search` is very slow (takes 40 ~ 50 seconds).
# This overhead sums up to a significant amount of delay in the cross version tests
# where we trigger more than 100 GitHub Actions runs.
run: |
python_version="${{ inputs.python-version }}"
if [ -z "$python_version" ]; then
python_version=$(python setup.py -q min_python_version)
fi
if [[ "$python_version" == "3.7" ]]; then
if [ ${{ runner.os }} == "Windows" ]; then
python_version="3.7.9"
else
python_version="3.7.12"
fi
elif [[ "$python_version" == "3.8" ]]; then
python_version="3.8.12"
else
echo "Invalid python version: '$python_version'. Must be one of ['3.7', '3.8']"
exit 1
fi
echo "version=$python_version" >> $GITHUB_OUTPUT
- uses: actions/setup-python@v4
with:
python-version: ${{ steps.get-python-version.outputs.version }}