Skip to content

Test more on GitHub Actions #564

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

Merged
merged 10 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cross-platform Tox version mangling
  • Loading branch information
ambv committed Mar 3, 2023
commit 37d21ebb0f164cbb0e5e300d11f788a522863c2f
21 changes: 7 additions & 14 deletions .github/workflows/python-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,13 @@ jobs:
cache: pip
cache-dependency-path: |
requirements-oldest.txt
- name: Determine Python version for Tox
run: |
V=${{ matrix.python }}
if [[ "$V" = pypy-2* ]]; then
V=pypy
elif [[ "$V" = pypy-3* ]]; then
V=pypy3
elif [[ "$V" = ~* ]]; then
V=py$(NORM_V=${V:1:4};echo ${NORM_V//./})
else
V=py${V//./}
fi
echo TOX_PYTHON=$V >>$GITHUB_ENV
- if: ${{ matrix.os == 'windows-latest' }}
name: Determine environment name for Tox (PowerShell)
run: python toxver.py >> $env:GITHUB_ENV
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Determine environment name for Tox (Bash)
run: python toxver.py >> $GITHUB_ENV
- run: pip install tox
- run: tox -e ${{ env.TOX_PYTHON }}-${{ matrix.deps }}
- run: tox
- if: ${{ always() }}
run: python debug-info.py
36 changes: 36 additions & 0 deletions toxver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import sys


def main(argv):
if len(argv) != 3:
print("usage: toxver.py [python-version] [deps]", file=sys.stderr)
return 1

deps = argv[2]

if argv[1].startswith("pypy-2"):
print("TOXENV=pypy-" + deps)
return 0

if argv[1].startswith("pypy-3"):
print("TOXENV=pypy3-" + deps)
return 0

if argv[1].startswith("~"):
ver = argv[1][1:5]
else:
ver = argv[1]

ver = ver.replace(".", "")
print("TOXENV=py" + ver + "-" + deps)
return 0


if __name__ == "__main__":
sys.exit(main(sys.argv))