Skip to content
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

Unable to use asdf-vm based version-file #571

Open
1 task done
hjpotter92 opened this issue Dec 21, 2022 · 3 comments · May be fixed by #588
Open
1 task done

Unable to use asdf-vm based version-file #571

hjpotter92 opened this issue Dec 21, 2022 · 3 comments · May be fixed by #588
Labels
enhancement New feature or request

Comments

@hjpotter92
Copy link

hjpotter92 commented Dec 21, 2022

I was using setup-node action, and didn't face this problem when using .tool-versions file; so i was surprised hitting this error in setup-python action.

Description:
When using the action, I expected it to work seamlessly with .tool-versions file that asdf-vm generates.

Action version:
Using @v4

Platform:

  • Ubuntu

Runner type:

  • Github's runner

Tools version:

Repro steps:

  • Create a asdf based version file:

    asdf local python 3.10.9
    asdf local poetry 1.3.1
  • Use the generated .tool-versions file in github action:

    - uses: actions/setup-python@v4
      with:
        python-version-file: .tool-versions
        cache: poetry
  • Fails to install python.

Expected behavior:

Parser should be smart to also identify other version managers

Actual behavior:

Resolved architecture/.tool-versions as python 3.10.9
poetry 1.3.1

Version python 3.10.[9](https://github.com/XXXXXXXXXXXXXXXX/actions/runs/3738XXXXXX/jobs/63453738XXXXXX#step:4:10)
poetry 1.3.1
 was not found in the local cache
Error: The version 'python 3.[10](https://github.com/XXXXXXXXXXXXXXXX/actions/runs/3738XXXXXX/jobs/63453738XXXXXX#step:4:11).9
poetry 1.3.1
' with architecture 'x64' was not found for Ubuntu 22.04.
@hjpotter92 hjpotter92 added bug Something isn't working needs triage labels Dec 21, 2022
@MaksimZhukov MaksimZhukov added enhancement New feature or request and removed bug Something isn't working needs triage labels Dec 21, 2022
@MaksimZhukov
Copy link
Contributor

Hello @hjpotter92 ! Thank you for reporting this!
We'll consider updating the parsing logic for the python-version-file input.

elpic added a commit to elpic/setup-python that referenced this issue Jan 17, 2023
Create a function to parse tool-version (asdf-vm) format, add the
associated tests, and updated the documentation

Ticket-ID: actions#571
@elpic elpic linked a pull request Jan 17, 2023 that will close this issue
2 tasks
@e-korolevskii e-korolevskii self-assigned this Jan 18, 2023
elpic added a commit to elpic/setup-python that referenced this issue Mar 14, 2023
Create a function to parse tool-version (asdf-vm) format, add the
associated tests, and updated the documentation

Ticket-ID: actions#571
elpic added a commit to elpic/setup-python that referenced this issue May 31, 2023
Create a function to parse tool-version (asdf-vm) format, add the
associated tests, and updated the documentation

Ticket-ID: actions#571
@dusan-trickovic dusan-trickovic linked a pull request Jul 13, 2023 that will close this issue
2 tasks
@goetzc
Copy link

goetzc commented Oct 3, 2023

As a workaround you can add a small intermediate step:

    - name: Determine versions
      shell: bash -leo pipefail {0}
      id: get_versions
      run: |
        python="$(grep -v '#' .tool-versions | grep python | awk '{print $2}')"
        echo "python=${python}" >> $GITHUB_OUTPUT

    - name: Install Python
      uses: actions/setup-python@v4
      with:
        python-version: ${{ steps.get_versions.outputs.python }}

@Kurt-von-Laven
Copy link
Contributor

You can even parse the Python version in a single step:

python_version="$(grep --perl-regexp --only-matching '(?<=python )(\d+\.){2}\d+' .tool-versions)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants