I want to show my client a PoC how to test its pyt...
# general
I want to show my client a PoC how to test its python libraries with different python versions in the CI (GitHub actions), so I tried: 1. Make the CI a matrix on the desired python versions. But then I need to filter pants targets, to only test the targets for the only interpreter in scope. Clunky 😕 2. Have multiple python interpreters in scope in the CI, so that a single
./pants test ::
command tests all versions. Sounds cool on paper. But getting
work fast in the CI is a job in itself. How do you people do that smartly on GitHub actions? Any pointer?
I test in the second style for Pex. I happen to use tox and not Pants, but that should be irrelevant for your purposes. I use this action to get me a bunch of Pythons fast: https://github.com/pantsbuild/actions/blob/main/expose-pythons/action.yml
❤️ 1
👀 1
See here for example and expand the "Exposing Pythons" node: https://github.com/pantsbuild/pex/actions/runs/3595388275/jobs/6054817062#step:5:1
❤️ 1
That's 2.7, 3.{7,8,9,10,11} in 1s
Awesome, looks like it's exactly what I need!
That said, I think newer versions of the standard GitHub python-setup action can do the same.
Is there a way to declare the versions I need with
Exposing Pythons
? I see I could
some, but I only need a few actually.
Did you try just using 1 https://github.com/actions/setup-python per version?
I think that works.
No I didn't, that would be super simple if it works.
Yeah, pretty sure it does. Only one (maybe last) will be "default", but they'll all be on PATH.
Trying that now 🙂
You can look in that 1st job setup step and expand the image node to get a link and see which versions are "fast": https://github.com/actions/runner-images/blob/macOS-11/20221127.7/images/macos/macos-11-Readme.md
There are tables for ~pre-installed versions of CPython and PyPy there.
Yep multiple
is working at first sight (still need to fix some things later in my pipeline, but first
steps work now) 👍
You have been super helpful John, thank you very much!