Currently I have the following:
[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
pypy-3.7: pypy3
pypy-3.8: pypy3
[tox]
minversion = 1.9
envlist =
lint
py{37,38,39,py3}-django22-{sqlite,postgres}
py{37,38,39,310,py3}-django32-{sqlite,postgres}
py{38,39,310,py3}-django40-{sqlite,postgres}
py310-djangomain-{sqlite,postgres}
docs
examples
linkcheck
toxworkdir = {env:TOX_WORKDIR:.tox}
[testenv]
deps =
Pillow
SQLAlchemy
mongoengine
django22: Django>=2.2,<2.3
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
djangomain: https://github.com/django/django/archive/main.tar.gz
py{37,38,39,310}-django{22,32,40,main}-postgres: psycopg2-binary
py{py3}-django{22,32,40,main}-postgres: psycopg2cffi
I need to install a different psycopg2
depending on cpython
vs pypy
. I've tried all kinds of combinations, and nothing, it all ends in failure . I can't get any of the *-postgres
envs to install.
What I'm doing wrong?
The issue is that you do not run the correct environments in your GitHub Actions.
For example. In your tox.ini
you create an env with the name:
py37-django22-alchemy-mongoengine-postgres
Then you define the requirements as following:
py{37,38,39,310}-postgres: psycopg2-binary
Which means - install psycopg2-binary
when the env name contains the factors py37
+ postgres
. This matches the above env! So far so good.
But in your gha your run:
- python-version: "3.7"
tox-environment: django22-postgres
... which does not contain the py37
factor - so no match - no installation.
The sqlite
tests succeed as it sqlite
comes along with Python.
I would suggest that you have a look at the django projects in the jazzband github organization . They all are heavy use of tox factors (the parts separated by dashes) and they also use gha - mostly via https://github.com/ymyzk/tox-gh-actions which I would recommend, too.
Basically you just run tox
on gha and let the plugin do the heavy lifting of matching Python environments from tox to github.
Disclaimer: I am one of the tox maintainers and you earn a prize for the most complex factor setup I have ever seen :-)
The issue was never tox
or tox
's configuration.
The issue was github actions
, when you use tox-environment
or python-version
+ tox-environment
, tox-gh-actions
won't parse it correctly. Causing it to never match.
This is what I removed . This is what tox.ini looks like and what github actions looks like [and line 47]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.