5050 PIP_DISABLE_PIP_VERSION_CHECK : 1
5151 PIP_NO_PYTHON_VERSION_WARNING : 1
5252 PIP_NO_WARN_SCRIPT_LOCATION : 1
53+ PROJECT_NAME : ansible-pylibssh
5354 PY_COLORS : 1 # Recognized by the `py` package, dependency of `pytest`
5455 TOX_PARALLEL_NO_SPINNER : 1
5556 TOX_TESTENV_PASSENV : >- # Make tox-wrapped tools see color requests
8081
8182 env :
8283 ANSIBLE_PYLIBSSH_CYTHON_TRACING : ${{ inputs.cython-tracing }}
83- TOXENV : test-${{ inputs.dist-type }}-dists
84+ TOXENV : py
8485
8586 steps :
8687 - name : Install build toolchain and openssl headers on Linux
@@ -196,17 +197,62 @@ jobs:
196197 path : dist/
197198 merge-multiple : true
198199
200+ - name : Determine pre-compiled compatible wheel
201+ env :
202+ # NOTE: When `pip` is forced to colorize output piped into `jq`,
203+ # NOTE: the latter can't parse it. So we're overriding the color
204+ # NOTE: preference here via https://no-color.org.
205+ # NOTE: Setting `FORCE_COLOR` to any value (including 0, an empty
206+ # NOTE: string, or a "YAML null" `~`) doesn't have any effect and
207+ # NOTE: `pip` (through its verndored copy of `rich`) treats the
208+ # NOTE: presence of the variable as "force-color" regardless.
209+ #
210+ # NOTE: This doesn't actually work either, so we'll resort to unsetting
211+ # NOTE: in the Bash script.
212+ # NOTE: Ref: https://github.com/Textualize/rich/issues/2622
213+ NO_COLOR : 1
214+ if : inputs.dist-type == 'binary'
215+ id : wheel-file
216+ run : >
217+ echo -n path= | tee -a "${GITHUB_OUTPUT}"
218+
219+
220+ unset FORCE_COLOR
221+
222+
223+ python
224+ -X utf8
225+ -u -I
226+ -m pip install
227+ --find-links=./dist
228+ --no-index
229+ '${{ env.PROJECT_NAME }}'
230+ --force-reinstall
231+ --no-color
232+ --no-deps
233+ --only-binary=:all:
234+ --dry-run
235+ --report=-
236+ --quiet
237+ | jq --raw-output .install[].download_info.url
238+ | sed -e 's#^file://##' -e 's#%2B#+#'
239+ | tee -a "${GITHUB_OUTPUT}"
240+ shell : bash
241+
199242 - name : >-
200243 Pre-populate tox env:
201244 ${{ env.TOXENV }}
202- # FIXME: Integrate the following once it's possible
203- # --installpkg 'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
204245 run: >-
205246 python -m
206247 tox
207248 --parallel auto
208249 --parallel-live
209250 --skip-missing-interpreters false
251+ --installpkg '${{
252+ inputs.dist-type == 'binary'
253+ && steps.wheel-file.outputs.path
254+ || format('dist/{0}', inputs.source-tarball-name)
255+ }}'
210256 --notest
211257
212258 - name : Configure tox to run pytest under catchsegv
@@ -219,8 +265,6 @@ jobs:
219265 shell : python
220266
221267 - name : Run the testing
222- # FIXME: Integrate the following once it's possible
223- # --installpkg 'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
224268 run : >-
225269 python -m
226270 tox
@@ -235,8 +279,6 @@ jobs:
235279 paths : .test-results/pytest/results.xml
236280 - name : Re-run the failing tests with maximum verbosity
237281 if : failure()
238- # FIXME: Integrate the following once it's possible
239- # --installpkg 'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
240282 run : >- # `exit 1` makes sure that the job remains red with flaky runs
241283 python -m
242284 tox
0 commit comments