forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
36 lines (36 loc) · 1.42 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
name: "setup-python"
description: "Ensures to install a python version that's available on Anaconda"
inputs:
python-version:
description: "The python version to install (e.g. 3.6)"
required: true
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 [[ "$python_version" == "3.6" ]]; then
python_version="3.6.13"
elif [[ "$python_version" == "3.7" ]]; then
python_version="3.7.12"
elif [[ "$python_version" == "3.8" ]]; then
python_version="3.8.12"
else
echo "Invalid python version: '$python_version'. Must be one of ['3.6', '3.7', '3.8']"
exit 1
fi
echo "::set-output name=version::$python_version"
- uses: actions/setup-python@v2
with:
python-version: ${{ steps.get-python-version.outputs.version }}