From bf368f6b13bfc78d8b4b5107a7479d9ec497706b Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 11:25:30 +0530 Subject: [PATCH 1/7] test: add python 3.11.0 to the test suite --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8226a0..ea4ae35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: 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 ] + python-version: [ 3.8.18, 3.11.0, 3.12.0 ] cache: [ true, false ] runs-on: ubuntu-latest container: amazonlinux:${{ matrix.amazon-linux-version }} From 1c30e7910ab07b727f7a29da372baac5c6a416df Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 11:37:35 +0530 Subject: [PATCH 2/7] feat: upgrade uv to 0.9.3 and remove the HOME variable hack --- .github/workflows/github_actions_linter.yml | 3 ++- action.yml | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/github_actions_linter.yml b/.github/workflows/github_actions_linter.yml index 0d93cc4..d241b2f 100644 --- a/.github/workflows/github_actions_linter.yml +++ b/.github/workflows/github_actions_linter.yml @@ -1,6 +1,7 @@ name: Lint GitHub Actions workflows -on: [ push ] +on: + - push jobs: actionlint: diff --git a/action.yml b/action.yml index 3073d93..2fa50b3 100644 --- a/action.yml +++ b/action.yml @@ -26,9 +26,8 @@ runs: run: | installation_directory="${{ github.action_path }}/.setup-python-amazon-linux/uv" echo "Installing uv.. installation_directory=${installation_directory}" - uv_version="0.8.18" - # HOME is set to foobar till this is resolved https://github.com/astral-sh/uv/issues/6965#issuecomment-2915796022 - curl -LsSf "https://github.com/astral-sh/uv/releases/download/${uv_version}/uv-installer.sh" | HOME="foobar" UV_UNMANAGED_INSTALL="${installation_directory}" bash --login + uv_version="0.9.13" + curl -LsSf "https://github.com/astral-sh/uv/releases/download/${uv_version}/uv-installer.sh" | UV_UNMANAGED_INSTALL="${installation_directory}" bash --login echo "${installation_directory}" >> "${GITHUB_PATH}" - name: Find desired python version From 4cde2b7bdef41b61f9ed82be2b056285c8983dec Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 12:53:56 +0530 Subject: [PATCH 3/7] test: add test for fixing python version resolution order --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea4ae35..87a9822 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -119,3 +119,36 @@ jobs: python --version 2>&1 | grep -F "3.11.5" test "$(python3 -m pip --version)" = "$(pip --version)" + + test_python_resolution_order: + runs-on: ubuntu-latest + container: amazonlinux:2023 + steps: + - name: Setup runner + run: | + yum install -y git sudo tar gzip which + + - name: Checkout + run: | + git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" . + + - name: Create python version file + run: | + echo '3.12' > .python-version + + - name: Install python + uses: ./ + with: + python-version: "3.13" + + - name: Test python version + run: | + set -x + + which python3 + which python + + python3 --version + python --version + + python3 --version 2>&1 | grep -F "3.13" \ No newline at end of file From 68002773d345717fd24c783f57805417f38d3328 Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 13:06:18 +0530 Subject: [PATCH 4/7] fix: read version from python-version-file only if python-version is unset --- action.yml | 2 +- find-desired-python-version.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2fa50b3..c00475d 100644 --- a/action.yml +++ b/action.yml @@ -2,7 +2,7 @@ name: 'Setup python amazon linux' description: 'setup-python action for amazon linux self hosted runners' inputs: python-version: - description: 'Version of python to be installed. Reads from .python-version if unset.' + description: 'Version of python to be installed. Reads from python-version-file if unset.' python-version-file: description: 'Version of python to be installed' default: '.python-version' diff --git a/find-desired-python-version.sh b/find-desired-python-version.sh index a479b68..150a44f 100755 --- a/find-desired-python-version.sh +++ b/find-desired-python-version.sh @@ -6,7 +6,8 @@ specified_version="$1" specified_version_file="$2" desired_python_version="${specified_version}" -if [ -f "${specified_version_file}" ]; then + +if [[ -z "${desired_python_version}" && -f "${specified_version_file}" ]]; then desired_python_version=$(cat "${specified_version_file}") fi From 2135c4bc52cc04d7a008c3fc960f493c3ea294ab Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 13:19:09 +0530 Subject: [PATCH 5/7] test: add test case to validate action input edge cases --- .github/workflows/test.yml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 87a9822..7225311 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -151,4 +151,33 @@ jobs: python3 --version python --version - python3 --version 2>&1 | grep -F "3.13" \ No newline at end of file + python3 --version 2>&1 | grep -F "3.13" + + test_invalid_action_input: + runs-on: ubuntu-latest + container: amazonlinux:2023 + steps: + - name: Setup runner + run: | + yum install -y git sudo tar gzip which + + - name: Checkout + run: | + git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" . + + - name: Install python + id: test-installation + continue-on-error: true + uses: ./ + + - name: Test python version + shell: bash + run: | + set -x + + if [[ "${{ steps.test-installation.outcome }}" == "success" ]]; then + echo "error: The action should have failed because both python-version and python-version-file were not given" + exit 1 + else + echo "success: The action successfully failed because both python-version and python-version-file were not given" + fi \ No newline at end of file From 790180e017eb8b574a623a4cc029e318e9c0e758 Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 13:24:05 +0530 Subject: [PATCH 6/7] fix: validate action input edge case --- .github/workflows/test.yml | 2 +- find-desired-python-version.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7225311..5b2ed91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -176,7 +176,7 @@ jobs: set -x if [[ "${{ steps.test-installation.outcome }}" == "success" ]]; then - echo "error: The action should have failed because both python-version and python-version-file were not given" + echo "error: The action should have failed because both python-version and python-version-file were not given but it has suceeded." exit 1 else echo "success: The action successfully failed because both python-version and python-version-file were not given" diff --git a/find-desired-python-version.sh b/find-desired-python-version.sh index 150a44f..0c0dfd9 100755 --- a/find-desired-python-version.sh +++ b/find-desired-python-version.sh @@ -11,4 +11,9 @@ if [[ -z "${desired_python_version}" && -f "${specified_version_file}" ]]; then desired_python_version=$(cat "${specified_version_file}") fi +if [[ -z "${desired_python_version}" ]]; then + echo "❌ error: Both inputs .python-version and .python-version-file are not given. Kindly provide one of them." >&2 + exit 1 +fi + echo "${desired_python_version}" \ No newline at end of file From b019b3ad9a7ec3e03919d39fea187bf2b9d06d8a Mon Sep 17 00:00:00 2001 From: Kishan B Date: Thu, 27 Nov 2025 14:42:21 +0530 Subject: [PATCH 7/7] test: remove 3.11.0 from test suite --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b2ed91..5dade9e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: 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.11.0, 3.12.0 ] + python-version: [ 3.8.18, 3.12.0 ] cache: [ true, false ] runs-on: ubuntu-latest container: amazonlinux:${{ matrix.amazon-linux-version }}