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

Add support to .tool-version file format #588

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

elpic
Copy link

@elpic elpic commented Jan 17, 2023

Create a function to parse tool-version (asdf-vm) format, add the associated tests, and updated the documentation

Ticket-ID: #571

Description:

Create a function to parse tool-version (asdf-vm) format, add the associated tests, and updated the documentation

Related issue:

#571

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@elpic elpic requested a review from a team as a code owner January 17, 2023 21:36
@e-korolevskii
Copy link
Contributor

Hello @elpic!
Thanks for your contribution! Some workflows failed, let's try to complete them.
Could you please run the format and build commands?

@elpic
Copy link
Author

elpic commented Jan 20, 2023

Would it be possible for you @dmitry-shibanov to run the failing tests?

let pythonVersion: string | undefined;

// Try to find the version in tool-version file
const found = contents.match(/^(?:python\s+)?v?(?<version>[^\s]+)$/m);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the regular expression we used in line 34 won't work with PyPy versions correctly. In the .tool-version, PyPy format doesn't have v: python pypy3.9-3.7.11, but the action's python-version input should include v before the PyPy version: python pypy3.9-v3.7.11. I think we can adapt the matched version of PyPy (basically just add v before the PyPy version) and add some e2e tests both for Python and PyPy installation from .tool-version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I saw from pypy version of python in asdf-vm you have the following version

python pypy3.9-3.7.11

Is that not correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's correct version syntax for .tool-version file, but incorrect python-version syntax for setup-python. Check the supported syntax here and, please, pay attention to the letter v.

.tool-version content your regex result setup-python requirement
python pypy3.9-3.7.11 pypy3.9-3.7.11 pypy3.9-v3.7.11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elpic may be could add a if/else condition here https://github.com/actions/setup-python/pull/588/files#diff-0ac8bdebd0ca13af3640499ecf1203abc825161011f13f9ca45c734bfe80128eR51 so that we parse format only for .tool-verions file

@dmitry-shibanov
Copy link
Contributor

Hello @elpic, just a gentle ping.

1 similar comment
@e-korolevskii
Copy link
Contributor

Hello @elpic, just a gentle ping.

@elpic
Copy link
Author

elpic commented Mar 14, 2023

Sorry I will take a look in a moment

@plukevdh
Copy link

plukevdh commented Apr 8, 2023

Any chance this gets reviewed soon?

@camflan
Copy link

camflan commented May 19, 2023

Any chance this gets reviewed soon?

Looks like there are a few checks failing that need addressed. @elpic any chance you have time to turn this PR green? 😅

elpic added 3 commits May 31, 2023 09:02
Create a function to parse tool-version (asdf-vm) format, add the
associated tests, and updated the documentation

Ticket-ID: actions#571
Rollback a not abot advanced usage on how to use the file and not use
the GITHUB_WORKSPACE since it was removed in a previous PR
Build the project using `npm run build` and run prettier using `npm run
format`
@elpic
Copy link
Author

elpic commented May 31, 2023

Sorry for the delay. The code is formatted now

@dusan-trickovic dusan-trickovic linked an issue Jul 13, 2023 that may be closed by this pull request
1 task
@tanguyantoine
Copy link

@elpic this is a great improvement for this action 👏

@tanguyantoine
Copy link

Can we get this merged?

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

Successfully merging this pull request may close these issues.

Unable to use asdf-vm based version-file
8 participants