Skip to content

Commit 83c22c2

Browse files
committed
Merge branch 'maintenance/tox-install-pkg' into devel
2 parents 6f42d20 + 6cb4eec commit 83c22c2

File tree

4 files changed

+58
-56
lines changed

4 files changed

+58
-56
lines changed

.github/workflows/reusable-tests.yml

+49-7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ env:
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
@@ -80,7 +81,7 @@ jobs:
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
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The CI is now configured to use
2+
:external+tox:std:ref:`tox-run---installpkg` when testing
3+
pre-built dists. This replaces the previously existing
4+
tox-level hacks in ``test-binary-dists`` and
5+
``test-source-dists`` environments that have now been
6+
removed.
7+
8+
-- by :user:`webknjaz`

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
'pip': ('https://pip.pypa.io/en/latest', None),
157157
'python': ('https://docs.python.org/3', None),
158158
'python2': ('https://docs.python.org/2', None),
159+
'tox': ('https://tox.wiki/en/latest', None),
159160
}
160161

161162
# -- Options for todo extension ----------------------------------------------

tox.ini

-49
Original file line numberDiff line numberDiff line change
@@ -57,55 +57,6 @@ commands =
5757
{tty:--color=yes} \
5858
{posargs:}
5959

60-
[testenv:test-binary-dists]
61-
skip_install = true
62-
commands_pre =
63-
# WARNING: Be sure to keep the `--no-index` arg.
64-
# WARNING: Otherwise, pip may prefer PyPI over
65-
# WARNING: the local dists dir.
66-
{envpython} -m pip install \
67-
--force-reinstall \
68-
--only-binary ansible-pylibssh \
69-
-f {env:PEP517_OUT_DIR} \
70-
--no-index \
71-
ansible-pylibssh
72-
install_command =
73-
{[dists]install_command}
74-
setenv =
75-
{[dists]setenv}
76-
77-
[testenv:test-source-dists]
78-
skip_install = true
79-
commands_pre =
80-
# Pre-fetch sdist build deps:
81-
{envpython} -m pip download \
82-
--prefer-binary \
83-
--only-binary Cython \
84-
--only-binary setuptools \
85-
--only-binary setuptools-scm \
86-
--only-binary setuptools-scm-git-archive \
87-
--only-binary toml \
88-
--only-binary wheel \
89-
--dest {toxinidir}/.github/workflows/.tmp/deps \
90-
Cython expandvars 'funcsigs; python_version < "3.3"' \
91-
setuptools setuptools-scm setuptools-scm-git-archive \
92-
toml wheel
93-
94-
# WARNING: Be sure to keep the `--no-index` arg.
95-
# WARNING: Otherwise, pip may prefer PyPI over
96-
# WARNING: the local dists dir.
97-
{envpython} -m pip install \
98-
--force-reinstall \
99-
--no-binary ansible-pylibssh \
100-
-f {env:PEP517_OUT_DIR} \
101-
-f {toxinidir}/.github/workflows/.tmp/deps \
102-
--no-index \
103-
ansible-pylibssh
104-
install_command =
105-
{[dists]install_command}
106-
setenv =
107-
{[dists]setenv}
108-
10960
[dists]
11061
install_command =
11162
env PIP_CONSTRAINT= \

0 commit comments

Comments
 (0)