File tree Expand file tree Collapse file tree 4 files changed +56
-12
lines changed Expand file tree Collapse file tree 4 files changed +56
-12
lines changed Original file line number Diff line number Diff line change @@ -100,3 +100,38 @@ jobs:
100100
101101 pip install requests
102102 pip3 install s4cmd
103+
104+ test_python_version_file :
105+ runs-on : ubuntu-latest
106+ container : amazonlinux:2023
107+ steps :
108+ - name : Setup runner
109+ run : |
110+ yum install -y git tar gzip sudo
111+
112+ - uses : actions/checkout@v3
113+
114+ - name : Create python version file
115+ run : |
116+ echo '3.11.5' > .python-version
117+
118+ - name : Install python
119+ uses : ./
120+ with :
121+ python-version-file : " .python-version"
122+
123+ - name : Test installation
124+ run : |
125+ set -x
126+
127+ which python3
128+ which python
129+
130+ python3 --version
131+ python --version
132+
133+ python3 --version 2>&1 | grep -F "3.11.5"
134+ test "$(python3 -m pip --version)" = "$(pip3 --version)"
135+
136+ python --version 2>&1 | grep -F "3.11.5"
137+ test "$(python3 -m pip --version)" = "$(pip --version)"
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ name: 'Setup python amazon linux'
22description : ' setup-python action for amazon linux self hosted runners'
33inputs :
44 python-version :
5+ description : ' Version of python to be installed. Reads from .python-version if unset.'
6+ python-version-file :
57 description : ' Version of python to be installed'
6- required : true
8+ default : ' .python-version '
79 cache :
810 description : Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
911 required : true
2022 id : find-exact-python-version
2123 shell : bash
2224 run : |
23- exact_python_version=$(${GITHUB_ACTION_PATH}/find-exact-python-version.sh "${{ inputs.python-version }}")
25+ exact_python_version=$(${GITHUB_ACTION_PATH}/find-exact-python-version.sh "${{ inputs.python-version }}" "${{ inputs.python-version-file }}" )
2426 echo "exact_python_version=${exact_python_version}" >> $GITHUB_OUTPUT
2527
2628 - name : Set installation directory
Original file line number Diff line number Diff line change 33set -euo pipefail
44
55specified_version=" $1 "
6+ specified_version_file=" $2 "
7+
8+ desired_python_version=" ${specified_version} "
9+ if [ -f " ${specified_version_file} " ]; then
10+ desired_python_version=$( cat " ${specified_version_file} " )
11+ fi
612
713# This versions map should be kept in sync with
814# - https://www.python.org/downloads/
915# - https://devguide.python.org/versions/
10- case " ${specified_version } " in
16+ case " ${desired_python_version } " in
1117 " 3" )
1218 echo " 3.12.0"
1319 ;;
@@ -27,6 +33,6 @@ case "${specified_version}" in
2733 echo " 3.8.18"
2834 ;;
2935 * )
30- echo " ${specified_version } "
36+ echo " ${desired_python_version } "
3137 ;;
3238esac
Original file line number Diff line number Diff line change @@ -5,12 +5,13 @@ set -euo pipefail
55# Reference https://stackoverflow.com/a/73208851/3316017
66
77sudo yum update -y
8- sudo yum groupinstall -y " Development Tools"
9- if yum info " openssl11-devel" & > /dev/null; then
10- sudo yum install -y openssl11-devel
11- else
12- sudo yum install -y openssl-devel
8+
9+ desired_openssl_package=" openssl-devel"
10+ if yum info " openssl11-devel" & > /dev/null; then
11+ desired_openssl_package=" openssl11-devel"
1312fi
14- sudo yum install -y zlib-devel bzip2 bzip2-devel readline-devel libffi-devel \
15- ncurses-devel sqlite sqlite-devel gdbm-devel tk-devel xz-devel \
16- tar gzip wget
13+
14+ sudo yum groupinstall -y " Development Tools"
15+ sudo yum install -y " ${desired_openssl_package} " zlib-devel bzip2 bzip2-devel readline-devel libffi-devel \
16+ ncurses-devel sqlite sqlite-devel gdbm-devel tk-devel xz-devel \
17+ tar gzip wget
You can’t perform that action at this time.
0 commit comments