File tree 4 files changed +56
-12
lines changed
4 files changed +56
-12
lines changed Original file line number Diff line number Diff line change @@ -100,3 +100,38 @@ jobs:
100
100
101
101
pip install requests
102
102
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'
2
2
description : ' setup-python action for amazon linux self hosted runners'
3
3
inputs :
4
4
python-version :
5
+ description : ' Version of python to be installed. Reads from .python-version if unset.'
6
+ python-version-file :
5
7
description : ' Version of python to be installed'
6
- required : true
8
+ default : ' .python-version '
7
9
cache :
8
10
description : Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
9
11
required : true
20
22
id : find-exact-python-version
21
23
shell : bash
22
24
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 }}" )
24
26
echo "exact_python_version=${exact_python_version}" >> $GITHUB_OUTPUT
25
27
26
28
- name : Set installation directory
Original file line number Diff line number Diff line change 3
3
set -euo pipefail
4
4
5
5
specified_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
6
12
7
13
# This versions map should be kept in sync with
8
14
# - https://www.python.org/downloads/
9
15
# - https://devguide.python.org/versions/
10
- case " ${specified_version } " in
16
+ case " ${desired_python_version } " in
11
17
" 3" )
12
18
echo " 3.12.0"
13
19
;;
@@ -27,6 +33,6 @@ case "${specified_version}" in
27
33
echo " 3.8.18"
28
34
;;
29
35
* )
30
- echo " ${specified_version } "
36
+ echo " ${desired_python_version } "
31
37
;;
32
38
esac
Original file line number Diff line number Diff line change @@ -5,12 +5,13 @@ set -euo pipefail
5
5
# Reference https://stackoverflow.com/a/73208851/3316017
6
6
7
7
sudo 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"
13
12
fi
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