Skip to content

Commit aa230cc

Browse files
Fix SSL setup (#4)
* Test pip installation * Fix yaml zero truncation * Add test layer for amazon linux 2 for pip install case * Test with additional deps * Fix Openssl version * Add caching test case to pip test harness * Refactor test pipeline * Install all required deps * Add references * Install every single python system dependency * Add with open ssl flag * Update open ssl path * Optimize parallization * Fix open ssl include path * Use with ssl flag * Add with-openssl-rpath * Fix openssl rpath value * Specify with-openssl * Remove fail fast * Add openssl cli * Add openssl libs path * Use openssl11-devel * Conditionally install openssl
1 parent f99bd1a commit aa230cc

File tree

4 files changed

+63
-19
lines changed

4 files changed

+63
-19
lines changed

.github/workflows/test.yml

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ name: Test
33
on: [ push ]
44

55
jobs:
6-
test_setup_python:
6+
test_python_installation:
77
strategy:
8+
fail-fast: false
89
matrix:
910
# This tests the amazon linux versions receiving standard support
1011
# Refer - https://endoflife.date/amazon-linux
1112
amazon-linux-version: [ 2, 2023 ]
1213
# This tests the lowest supported python version and the latest stable python version
1314
# Refer - https://devguide.python.org/versions/#status-of-python-versions
14-
python-version:
15-
- 3.8.18
16-
- 3.12.0
17-
cache:
18-
- true
19-
- false
15+
python-version: [ 3.8.18, 3.12.0 ]
16+
cache: [ true, false ]
2017
runs-on: ubuntu-latest
2118
container: amazonlinux:${{ matrix.amazon-linux-version }}
2219
steps:
@@ -48,7 +45,7 @@ jobs:
4845
python --version 2>&1 | grep -F "${{ matrix.python-version }}"
4946
test "$(python3 -m pip --version)" = "$(pip --version)"
5047
51-
test_major_version_specification:
48+
test_major_version_installation:
5249
runs-on: ubuntu-latest
5350
container: amazonlinux:2023
5451
steps:
@@ -61,15 +58,15 @@ jobs:
6158
- name: Install python
6259
uses: ./
6360
with:
64-
python-version: 3
61+
python-version: "3"
6562

6663
- name: Test installation
6764
run: |
6865
set -x
6966
7067
python3 --version 2>&1 | grep -F "3.12.0"
7168
72-
test_minor_version_specification:
69+
test_minor_version_installation:
7370
runs-on: ubuntu-latest
7471
container: amazonlinux:2023
7572
steps:
@@ -82,10 +79,39 @@ jobs:
8279
- name: Install python
8380
uses: ./
8481
with:
85-
python-version: 3.9
82+
python-version: "3.9"
8683

8784
- name: Test installation
8885
run: |
8986
set -x
9087
9188
python3 --version 2>&1 | grep -F "3.9.18"
89+
90+
test_pip_installs:
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
amazon-linux-version: [ 2, 2023 ]
95+
python-version: [ "3.8", "3.9", "3.10", "3.11" , "3.12" ]
96+
cache: [ true, false ]
97+
runs-on: ubuntu-latest
98+
container: amazonlinux:${{ matrix.amazon-linux-version }}
99+
steps:
100+
- name: Setup runner
101+
run: |
102+
yum install -y git tar gzip sudo
103+
104+
- uses: actions/checkout@v3
105+
106+
- name: Install python
107+
uses: ./
108+
with:
109+
python-version: "${{ matrix.python-version }}"
110+
cache: ${{ matrix.cache }}
111+
112+
- name: Test installation
113+
run: |
114+
set -x
115+
116+
pip install requests
117+
pip3 install s4cmd

action.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ runs:
1414
- name: Ensure dependencies of python are installed
1515
shell: bash
1616
run: |
17-
sudo yum groupinstall -y "Development Tools"
18-
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel
19-
sudo yum install -y tar gzip wget
17+
${GITHUB_ACTION_PATH}/install-system-dependencies.sh
2018
2119
- name: Find exact python version
2220
id: find-exact-python-version

install-python.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
set -euo pipefail
44

5-
# Follows the guidelines from https://realpython.com/installing-python/#how-to-build-python-from-source-code
6-
75
function set_aliases() {
86
ln -sf "${python_installation_dir}/bin/python3" "${python_installation_dir}/bin/python"
97
ln -sf "${python_installation_dir}/bin/pip3" "${python_installation_dir}/bin/pip"
108
}
119

10+
# Reference - https://realpython.com/installing-python/#how-to-build-python-from-source-code
1211
function setup_python() {
1312
python_version="$1"
1413
python_installation_dir="$2"
@@ -19,9 +18,14 @@ function setup_python() {
1918
wget "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz"
2019
tar -zxf "Python-${python_version}.tgz"
2120
pushd "Python-${python_version}" >/dev/null
22-
# Have not added --enable-optimizations flag because that shoots up the build time by ~5 minutes
23-
./configure --prefix="${python_installation_dir}" --enable-shared
24-
make -j 8
21+
# - Have not added --enable-optimizations flag because that shoots up the build time by ~5 minutes
22+
# - Ref for openssl
23+
# - https://gist.github.com/wizardbeard/d5b641d1fadbaba755823e16eab4dda1#file-python-3-9-slim-dockerfile-L17
24+
# - https://stackoverflow.com/a/29169795/3316017
25+
# - https://stackoverflow.com/a/75880038/3316017
26+
export OPENSSL_LIBS=/usr/lib64/libssl.so
27+
./configure --prefix="${python_installation_dir}" --enable-shared --with-openssl=/usr --with-openssl-rpath=/usr/lib64
28+
make -j "$(nproc)"
2529
make install
2630
popd >/dev/null
2731
popd

install-system-dependencies.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Reference https://stackoverflow.com/a/73208851/3316017
6+
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
13+
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

0 commit comments

Comments
 (0)