Fix the CI (#2254)

This commit is contained in:
Bernát Gábor 2021-12-28 10:40:09 +00:00 committed by GitHub
parent ba3541c84a
commit 878c6e09de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 56 deletions

View file

@ -15,7 +15,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0 - uses: pre-commit/action@v2.0.3
test: test:
name: test ${{ matrix.py }} - ${{ matrix.os }} name: test ${{ matrix.py }} - ${{ matrix.os }}
@ -23,24 +23,24 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
py: py:
- 3.10.0-rc.1 - "3.10"
- 3.9 - "3.9"
- 3.8 - "3.8"
- 3.7 - "3.7"
- 3.6 - "3.6"
- 3.5 - "3.5"
- pypy-3.6-v7.3.7 - pypy-3.6-v7.3.3
- pypy-3.7-v7.3.7 - pypy-3.7-v7.3.7
- pypy-3.8-v7.3.7 - pypy-3.8-v7.3.7
- 2.7 - "2.7"
- pypy-2.7 - pypy-2.7
os:
- ubuntu-20.04
- macos-10.15
- windows-2022
include: include:
- { os: macos-latest, py: brew@py3 } - { os: macos-10.15, py: brew@py3 }
steps: steps:
- name: Install OS dependencies - name: Install OS dependencies
run: | run: |
@ -61,7 +61,7 @@ jobs:
- name: Setup python for tox - name: Setup python for tox
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.9 python-version: "3.10"
- name: Install tox - name: Install tox
run: python -m pip install tox run: python -m pip install tox
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -69,6 +69,10 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Use local virtualenv for tox - name: Use local virtualenv for tox
run: python -m pip install . run: python -m pip install .
- name: Install Python 2 for cross test
uses: actions/setup-python@v2
with:
python-version: "2.7"
- name: Setup python for test ${{ matrix.py }} - name: Setup python for test ${{ matrix.py }}
if: "!( startsWith(matrix.py,'brew@py') || endsWith(matrix.py, '-dev') )" if: "!( startsWith(matrix.py,'brew@py') || endsWith(matrix.py, '-dev') )"
uses: actions/setup-python@v2 uses: actions/setup-python@v2
@ -78,7 +82,7 @@ jobs:
if: startsWith(matrix.py,'brew@py') if: startsWith(matrix.py,'brew@py')
run: | run: |
import subprocess; import codecs; import os import subprocess; import codecs; import os
subprocess.check_call(["bash", "-c", f"brew upgrade python@3 || brew install python@3"]) subprocess.check_call(["bash", "-c", "brew upgrade python@3 || brew install python@3"])
with codecs.open(os.environ["GITHUB_PATH"], "a", "utf-8") as file_handler: with codecs.open(os.environ["GITHUB_PATH"], "a", "utf-8") as file_handler:
file_handler.write("/usr/local/opt/python@3") file_handler.write("/usr/local/opt/python@3")
shell: python shell: python
@ -101,14 +105,45 @@ jobs:
CI_RUN: "yes" CI_RUN: "yes"
DIFF_AGAINST: HEAD DIFF_AGAINST: HEAD
- name: Rename coverage report file - name: Rename coverage report file
run: | run: import os; import sys; os.rename(".tox/.coverage.{}".format(os.environ['TOXENV']), ".tox/.coverage.{}-{}".format(os.environ['TOXENV'], sys.platform))
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
shell: python shell: python
- uses: codecov/codecov-action@v1 - name: Upload coverage data
uses: actions/upload-artifact@v2
with: with:
file: ./.tox/coverage.xml name: coverage-data
flags: tests path: ".tox/.coverage.*"
name: ${{ matrix.py }} - ${{ matrix.os }}
coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- name: Setup coverage tool
run: tox -e coverage --notest
- name: Install package builder
run: python -m pip install build
- name: Build package
run: pyproject-build --wheel .
- name: Download coverage data
uses: actions/download-artifact@v2
with:
name: coverage-data
path: .tox
- name: Combine and report coverage
run: tox -e coverage
- name: Upload HTML report
uses: actions/upload-artifact@v2
with:
name: html-report
path: .tox/htmlcov
check: check:
name: ${{ matrix.tox_env }} - ${{ matrix.os }} name: ${{ matrix.tox_env }} - ${{ matrix.os }}
@ -117,8 +152,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-latest - ubuntu-20.04
- windows-latest - windows-2022
tox_env: tox_env:
- dev - dev
- docs - docs
@ -126,16 +161,16 @@ jobs:
- upgrade - upgrade
- zipapp - zipapp
exclude: exclude:
- { os: windows-latest, tox_env: readme } - { os: windows-2022, tox_env: readme }
- { os: windows-latest, tox_env: docs } - { os: windows-2022, tox_env: docs }
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Python 3.9 - name: Setup Python "3.10"
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.9 python-version: "3.10"
- name: Install tox - name: Install tox
run: python -m pip install tox run: python -m pip install tox
- name: Run check for ${{ matrix.tox_env }} - name: Run check for ${{ matrix.tox_env }}
@ -145,13 +180,13 @@ jobs:
publish: publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [check, test, lint] needs: [check, coverage, lint]
runs-on: ubuntu-latest runs-on: ubuntu-20.04
steps: steps:
- name: Setup python to build package - name: Setup python to build package
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.9 python-version: "3.10"
- name: Install https://pypi.org/project/build - name: Install https://pypi.org/project/build
run: python -m pip install build run: python -m pip install build
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View file

@ -1,17 +1,17 @@
version: 2 version: 2
build: build:
image: latest os: ubuntu-20.04
tools:
python: "3.9"
formats: formats:
- htmlzip - htmlzip
- epub - epub
- pdf - pdf
python: python:
version: 3.7
install: install:
- method: pip - method: pip
path: . path: .
extra_requirements: extra_requirements: ["docs"]
- docs
sphinx: sphinx:
builder: html builder: html
configuration: docs/conf.py configuration: docs/conf.py

View file

@ -8,7 +8,6 @@
[![PyPI - Downloads](https://img.shields.io/pypi/dm/virtualenv?style=flat-square)](https://pypistats.org/packages/virtualenv) [![PyPI - Downloads](https://img.shields.io/pypi/dm/virtualenv?style=flat-square)](https://pypistats.org/packages/virtualenv)
[![PyPI - License](https://img.shields.io/pypi/l/virtualenv?style=flat-square)](https://opensource.org/licenses/MIT) [![PyPI - License](https://img.shields.io/pypi/l/virtualenv?style=flat-square)](https://opensource.org/licenses/MIT)
[![Build Status](https://github.com/pypa/virtualenv/workflows/check/badge.svg?branch=main&event=push)](https://github.com/pypa/virtualenv/actions?query=workflow%3Acheck) [![Build Status](https://github.com/pypa/virtualenv/workflows/check/badge.svg?branch=main&event=push)](https://github.com/pypa/virtualenv/actions?query=workflow%3Acheck)
[![codecov](https://codecov.io/gh/pypa/virtualenv/branch/main/graph/badge.svg)](https://codecov.io/gh/pypa/virtualenv)
[![Code style: [![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)

View file

@ -1,12 +0,0 @@
coverage:
status:
patch:
default:
informational: true
comment: false # do not comment PR with the result
ignore:
- "src/virtualenv/create/via_global_ref/builtin/python2/site.py"
- "src/virtualenv/create/via_global_ref/_virtualenv.py"
- "src/virtualenv/activation/python/activate_this.py"

View file

@ -2,11 +2,15 @@ from __future__ import absolute_import, unicode_literals
import sys import sys
import pytest
from virtualenv import cli_run from virtualenv import cli_run
from virtualenv.info import IS_PYPY
from virtualenv.util.six import ensure_text from virtualenv.util.six import ensure_text
from virtualenv.util.subprocess import run_cmd from virtualenv.util.subprocess import run_cmd
@pytest.mark.skipif(IS_PYPY, reason="setuptools distutil1s patching does not work")
def test_app_data_pinning(tmp_path): def test_app_data_pinning(tmp_path):
version = "19.1.1" if sys.version_info[0:2] == (3, 4) else "19.3.1" version = "19.1.1" if sys.version_info[0:2] == (3, 4) else "19.3.1"
result = cli_run([ensure_text(str(tmp_path)), "--pip", version, "--activators", "", "--seeder", "app-data"]) result = cli_run([ensure_text(str(tmp_path)), "--pip", version, "--activators", "", "--seeder", "app-data"])

View file

@ -15,7 +15,7 @@ import pytest
from virtualenv.discovery import cached_py_info from virtualenv.discovery import cached_py_info
from virtualenv.discovery.py_info import PythonInfo, VersionInfo from virtualenv.discovery.py_info import PythonInfo, VersionInfo
from virtualenv.discovery.py_spec import PythonSpec from virtualenv.discovery.py_spec import PythonSpec
from virtualenv.info import fs_supports_symlink from virtualenv.info import IS_PYPY, fs_supports_symlink
from virtualenv.util.path import Path from virtualenv.util.path import Path
CURRENT = PythonInfo.current_system() CURRENT = PythonInfo.current_system()
@ -296,6 +296,7 @@ def test_discover_exe_on_path_non_spec_name_not_match(mocker):
assert CURRENT.satisfies(spec, impl_must_match=True) is False assert CURRENT.satisfies(spec, impl_must_match=True) is False
@pytest.mark.skipif(IS_PYPY, reason="setuptools distutil1s patching does not work")
def test_py_info_setuptools(): def test_py_info_setuptools():
from setuptools.dist import Distribution from setuptools.dist import Distribution

14
tox.ini
View file

@ -50,7 +50,7 @@ wheel_build_env = .pkg
description = format the code base to adhere to our styles, and complain about what we cannot do automatically description = format the code base to adhere to our styles, and complain about what we cannot do automatically
passenv = passenv =
* *
basepython = python3.9 basepython = python3.10
skip_install = true skip_install = true
deps = deps =
pre-commit>=2 pre-commit>=2
@ -100,7 +100,7 @@ commands =
[testenv:docs] [testenv:docs]
description = build documentation description = build documentation
basepython = python3.9 basepython = python3.10
extras = extras =
docs docs
commands = commands =
@ -123,11 +123,11 @@ commands =
description = do a release, required posarg of the version number description = do a release, required posarg of the version number
passenv = passenv =
* *
basepython = python3.9 basepython = python3.10
deps = deps =
gitpython>=3 gitpython>=3.1.24
packaging>=17.1 packaging>=21.3
towncrier>=19.9.0rc1 towncrier>=21.3
changedir = {toxinidir}/tasks changedir = {toxinidir}/tasks
commands = commands =
python release.py --version {posargs} python release.py --version {posargs}
@ -149,7 +149,7 @@ commands =
description = generate a zipapp description = generate a zipapp
skip_install = true skip_install = true
deps = deps =
packaging>=20 packaging>=21.3
commands = commands =
python tasks/make_zipapp.py python tasks/make_zipapp.py