Skip to content

Fix SSL setup #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ name: Test
on: [ push ]

jobs:
test_setup_python:
test_python_installation:
strategy:
fail-fast: false
matrix:
# This tests the amazon linux versions receiving standard support
# Refer - https://endoflife.date/amazon-linux
amazon-linux-version: [ 2, 2023 ]
# This tests the lowest supported python version and the latest stable python version
# Refer - https://devguide.python.org/versions/#status-of-python-versions
python-version:
- 3.8.18
- 3.12.0
cache:
- true
- false
python-version: [ 3.8.18, 3.12.0 ]
cache: [ true, false ]
runs-on: ubuntu-latest
container: amazonlinux:${{ matrix.amazon-linux-version }}
steps:
Expand Down Expand Up @@ -48,7 +45,7 @@ jobs:
python --version 2>&1 | grep -F "${{ matrix.python-version }}"
test "$(python3 -m pip --version)" = "$(pip --version)"

test_major_version_specification:
test_major_version_installation:
runs-on: ubuntu-latest
container: amazonlinux:2023
steps:
Expand All @@ -61,15 +58,15 @@ jobs:
- name: Install python
uses: ./
with:
python-version: 3
python-version: "3"

- name: Test installation
run: |
set -x

python3 --version 2>&1 | grep -F "3.12.0"

test_minor_version_specification:
test_minor_version_installation:
runs-on: ubuntu-latest
container: amazonlinux:2023
steps:
Expand All @@ -82,10 +79,39 @@ jobs:
- name: Install python
uses: ./
with:
python-version: 3.9
python-version: "3.9"

- name: Test installation
run: |
set -x

python3 --version 2>&1 | grep -F "3.9.18"

test_pip_installs:
strategy:
fail-fast: false
matrix:
amazon-linux-version: [ 2, 2023 ]
python-version: [ "3.8", "3.9", "3.10", "3.11" , "3.12" ]
cache: [ true, false ]
runs-on: ubuntu-latest
container: amazonlinux:${{ matrix.amazon-linux-version }}
steps:
- name: Setup runner
run: |
yum install -y git tar gzip sudo

- uses: actions/checkout@v3

- name: Install python
uses: ./
with:
python-version: "${{ matrix.python-version }}"
cache: ${{ matrix.cache }}

- name: Test installation
run: |
set -x

pip install requests
pip3 install s4cmd
4 changes: 1 addition & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ runs:
- name: Ensure dependencies of python are installed
shell: bash
run: |
sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel
sudo yum install -y tar gzip wget
${GITHUB_ACTION_PATH}/install-system-dependencies.sh

- name: Find exact python version
id: find-exact-python-version
Expand Down
14 changes: 9 additions & 5 deletions install-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

set -euo pipefail

# Follows the guidelines from https://realpython.com/installing-python/#how-to-build-python-from-source-code

function set_aliases() {
ln -sf "${python_installation_dir}/bin/python3" "${python_installation_dir}/bin/python"
ln -sf "${python_installation_dir}/bin/pip3" "${python_installation_dir}/bin/pip"
}

# Reference - https://realpython.com/installing-python/#how-to-build-python-from-source-code
function setup_python() {
python_version="$1"
python_installation_dir="$2"
Expand All @@ -19,9 +18,14 @@ function setup_python() {
wget "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz"
tar -zxf "Python-${python_version}.tgz"
pushd "Python-${python_version}" >/dev/null
# Have not added --enable-optimizations flag because that shoots up the build time by ~5 minutes
./configure --prefix="${python_installation_dir}" --enable-shared
make -j 8
# - Have not added --enable-optimizations flag because that shoots up the build time by ~5 minutes
# - Ref for openssl
# - https://gist.github.com/wizardbeard/d5b641d1fadbaba755823e16eab4dda1#file-python-3-9-slim-dockerfile-L17
# - https://stackoverflow.com/a/29169795/3316017
# - https://stackoverflow.com/a/75880038/3316017
export OPENSSL_LIBS=/usr/lib64/libssl.so
./configure --prefix="${python_installation_dir}" --enable-shared --with-openssl=/usr --with-openssl-rpath=/usr/lib64
make -j "$(nproc)"
make install
popd >/dev/null
popd
Expand Down
16 changes: 16 additions & 0 deletions install-system-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -euo pipefail

# Reference https://stackoverflow.com/a/73208851/3316017

sudo yum update -y
sudo yum groupinstall -y "Development Tools"
if yum info "openssl11-devel" &> /dev/null; then
sudo yum install -y openssl11-devel
else
sudo yum install -y openssl-devel
fi
sudo yum install -y zlib-devel bzip2 bzip2-devel readline-devel libffi-devel \
ncurses-devel sqlite sqlite-devel gdbm-devel tk-devel xz-devel \
tar gzip wget