|
25 | 25 | REPO_OWNER: ${{ github.event.inputs.codeflare-repository-organization }}
|
26 | 26 | REPO_NAME: notebooks
|
27 | 27 | GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
|
| 28 | + MINIMUM_SUPPORTED_PYTHON_VERSION: 3.9 |
28 | 29 |
|
29 | 30 | jobs:
|
30 | 31 | build:
|
|
44 | 45 | uses: actions/setup-python@v4
|
45 | 46 | with:
|
46 | 47 | python-version: |
|
47 |
| - 3.8 |
48 | 48 | 3.9
|
49 | 49 |
|
50 | 50 | - name: Install pipenv and pip-versions
|
|
92 | 92 | for dir in "${directories[@]}"; do
|
93 | 93 | counter=$((counter+1))
|
94 | 94 | echo "--Processing directory $counter '$dir' of total $total"
|
95 |
| - cd "$dir" && pipenv install ${package_name}~="${CODEFLARE_RELEASE_VERSION}" && pipenv --rm && cd - |
| 95 | + cd "$dir" |
| 96 | + minimum_supported_python_version_major=$(echo "${MINIMUM_SUPPORTED_PYTHON_VERSION}" | awk -F '.' '{print $1}') #integer of MINIMUM_SUPPORTED_PYTHON_VERSION env variable |
| 97 | + minimum_supported_python_version_minor=$(echo "${MINIMUM_SUPPORTED_PYTHON_VERSION}" | awk -F '.' '{print $2}') #decimal of MINIMUM_SUPPORTED_PYTHON_VERSION env variable |
| 98 | + pipfile_python_version=$(grep -E '^python_version' ./Pipfile | cut -d '"' -f 2) # extracted from pipfile |
| 99 | + pipfile_python_version_major=$(echo "$pipfile_python_version" | awk -F '.' '{print $1}') |
| 100 | + pipfile_python_version_minor=$(echo "$pipfile_python_version" | awk -F '.' '{print $2}') |
| 101 | + if [[ "pipfile_python_version_major" -ge "$minimum_supported_python_version_major" && "pipfile_python_version_minor" -ge "$minimum_supported_python_version_minor" ]]; then |
| 102 | + #install specified package |
| 103 | + if ! pipenv install ${package_name}~="${CODEFLARE_RELEASE_VERSION}"; then |
| 104 | + echo "Failed to install ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir" |
| 105 | + exit 1 |
| 106 | + fi |
| 107 | + # Lock dependencies, ensuring pre-release are included and clear previous state |
| 108 | + if ! pipenv lock --pre --clear ; then |
| 109 | + echo "Failed to lock dependencies" |
| 110 | + exit 1 |
| 111 | + fi |
| 112 | + # remove virtual env and clear cache |
| 113 | + if ! pipenv --rm --clear ; then |
| 114 | + echo "Failed to remove virtual environment" |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | + else |
| 118 | + echo "Skipped installation of ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir" |
| 119 | + fi |
| 120 | + cd - |
96 | 121 | echo "$((total-counter)) directories remaining.."
|
97 | 122 | done
|
98 | 123 | else
|
|
0 commit comments