diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dfdea4a..270bf43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,5 @@ +name: Test + on: [ push ] jobs: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e56c89..a8ff58e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,5 @@ +# Contributing + ## Context This action is built as a composite action, for more details kindly refer diff --git a/action.yml b/action.yml index 6a85abb..dab7a3f 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'Setup python amazon linux' +name: 'Setup python on amazon linux' description: 'Adds support to install python in amazon linux' inputs: python-version: @@ -11,6 +11,13 @@ inputs: runs: using: "composite" steps: + - 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 + - name: Find exact python version id: find-exact-python-version shell: bash @@ -47,7 +54,14 @@ runs: shell: bash run: | installation_directory=${{ steps.set-installation-directory.outputs.installation_directory }} - echo "${installation_directory}/bin" >> ${GITHUB_PATH} + echo "${installation_directory}/bin" >> "${GITHUB_PATH}" + + echo "The following python binaries are now available in the PATH" + ls "${installation_directory}/bin" + + echo "Linking python libraries.." + ls "${installation_directory}/lib" + ldconfig "${installation_directory}/lib" branding: icon: 'code' diff --git a/install-python.sh b/install-python.sh index 8b24a46..969704d 100755 --- a/install-python.sh +++ b/install-python.sh @@ -4,12 +4,6 @@ set -euo pipefail # Follows the guidelines from https://realpython.com/installing-python/#how-to-build-python-from-source-code -function setup_build_prerequisites() { - sudo yum groupinstall -y "Development Tools" - sudo yum install -y tar gzip wget - sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel -} - 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" @@ -19,15 +13,14 @@ function setup_python() { python_version="$1" python_installation_dir="$2" - setup_build_prerequisites - mkdir -p "${python_installation_dir}" temp_dir=$(mktemp -d) pushd "${temp_dir}" >/dev/null 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 - ./configure --enable-optimizations --prefix="${python_installation_dir}" + # 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 make install popd >/dev/null