From 878c6e09ded9b8e25a18ced1e04ba53075f2b5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 28 Dec 2021 10:40:09 +0000 Subject: [PATCH] Fix the CI (#2254) --- .github/workflows/check.yml | 97 +++++++++++++------- .readthedocs.yml | 8 +- README.md | 1 - codecov.yml | 12 --- tests/integration/test_run_int.py | 4 + tests/unit/discovery/py_info/test_py_info.py | 3 +- tox.ini | 14 +-- 7 files changed, 83 insertions(+), 56 deletions(-) delete mode 100644 codecov.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1f4d41a32..3e201766d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 + - uses: pre-commit/action@v2.0.3 test: name: test ${{ matrix.py }} - ${{ matrix.os }} @@ -23,24 +23,24 @@ jobs: strategy: fail-fast: false matrix: - os: - - ubuntu-latest - - windows-latest - - macos-latest py: - - 3.10.0-rc.1 - - 3.9 - - 3.8 - - 3.7 - - 3.6 - - 3.5 - - pypy-3.6-v7.3.7 + - "3.10" + - "3.9" + - "3.8" + - "3.7" + - "3.6" + - "3.5" + - pypy-3.6-v7.3.3 - pypy-3.7-v7.3.7 - pypy-3.8-v7.3.7 - - 2.7 + - "2.7" - pypy-2.7 + os: + - ubuntu-20.04 + - macos-10.15 + - windows-2022 include: - - { os: macos-latest, py: brew@py3 } + - { os: macos-10.15, py: brew@py3 } steps: - name: Install OS dependencies run: | @@ -61,7 +61,7 @@ jobs: - name: Setup python for tox uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - name: Install tox run: python -m pip install tox - uses: actions/checkout@v2 @@ -69,6 +69,10 @@ jobs: fetch-depth: 0 - name: Use local virtualenv for tox 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 }} if: "!( startsWith(matrix.py,'brew@py') || endsWith(matrix.py, '-dev') )" uses: actions/setup-python@v2 @@ -78,7 +82,7 @@ jobs: if: startsWith(matrix.py,'brew@py') run: | 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: file_handler.write("/usr/local/opt/python@3") shell: python @@ -101,14 +105,45 @@ jobs: CI_RUN: "yes" DIFF_AGAINST: HEAD - name: Rename coverage report file - run: | - import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml') + run: import os; import sys; os.rename(".tox/.coverage.{}".format(os.environ['TOXENV']), ".tox/.coverage.{}-{}".format(os.environ['TOXENV'], sys.platform)) shell: python - - uses: codecov/codecov-action@v1 + - name: Upload coverage data + uses: actions/upload-artifact@v2 with: - file: ./.tox/coverage.xml - flags: tests - name: ${{ matrix.py }} - ${{ matrix.os }} + name: coverage-data + path: ".tox/.coverage.*" + + 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: name: ${{ matrix.tox_env }} - ${{ matrix.os }} @@ -117,8 +152,8 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - windows-latest + - ubuntu-20.04 + - windows-2022 tox_env: - dev - docs @@ -126,16 +161,16 @@ jobs: - upgrade - zipapp exclude: - - { os: windows-latest, tox_env: readme } - - { os: windows-latest, tox_env: docs } + - { os: windows-2022, tox_env: readme } + - { os: windows-2022, tox_env: docs } steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Setup Python 3.9 + - name: Setup Python "3.10" uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - name: Install tox run: python -m pip install tox - name: Run check for ${{ matrix.tox_env }} @@ -145,13 +180,13 @@ jobs: publish: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - needs: [check, test, lint] - runs-on: ubuntu-latest + needs: [check, coverage, lint] + runs-on: ubuntu-20.04 steps: - name: Setup python to build package uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - name: Install https://pypi.org/project/build run: python -m pip install build - uses: actions/checkout@v2 diff --git a/.readthedocs.yml b/.readthedocs.yml index dbdc904bb..f2f655f0a 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,17 +1,17 @@ version: 2 build: - image: latest + os: ubuntu-20.04 + tools: + python: "3.9" formats: - htmlzip - epub - pdf python: - version: 3.7 install: - method: pip path: . - extra_requirements: - - docs + extra_requirements: ["docs"] sphinx: builder: html configuration: docs/conf.py diff --git a/README.md b/README.md index aeae68074..024718331 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ [![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) [![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: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index c0216da3f..000000000 --- a/codecov.yml +++ /dev/null @@ -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" diff --git a/tests/integration/test_run_int.py b/tests/integration/test_run_int.py index 26a6583db..632d6259f 100644 --- a/tests/integration/test_run_int.py +++ b/tests/integration/test_run_int.py @@ -2,11 +2,15 @@ import sys +import pytest + from virtualenv import cli_run +from virtualenv.info import IS_PYPY from virtualenv.util.six import ensure_text 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): 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"]) diff --git a/tests/unit/discovery/py_info/test_py_info.py b/tests/unit/discovery/py_info/test_py_info.py index d4c4bba25..c82e50613 100644 --- a/tests/unit/discovery/py_info/test_py_info.py +++ b/tests/unit/discovery/py_info/test_py_info.py @@ -15,7 +15,7 @@ from virtualenv.discovery import cached_py_info from virtualenv.discovery.py_info import PythonInfo, VersionInfo 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 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 +@pytest.mark.skipif(IS_PYPY, reason="setuptools distutil1s patching does not work") def test_py_info_setuptools(): from setuptools.dist import Distribution diff --git a/tox.ini b/tox.ini index e50a0d232..e2aa8e95c 100644 --- a/tox.ini +++ b/tox.ini @@ -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 passenv = * -basepython = python3.9 +basepython = python3.10 skip_install = true deps = pre-commit>=2 @@ -100,7 +100,7 @@ commands = [testenv:docs] description = build documentation -basepython = python3.9 +basepython = python3.10 extras = docs commands = @@ -123,11 +123,11 @@ commands = description = do a release, required posarg of the version number passenv = * -basepython = python3.9 +basepython = python3.10 deps = - gitpython>=3 - packaging>=17.1 - towncrier>=19.9.0rc1 + gitpython>=3.1.24 + packaging>=21.3 + towncrier>=21.3 changedir = {toxinidir}/tasks commands = python release.py --version {posargs} @@ -149,7 +149,7 @@ commands = description = generate a zipapp skip_install = true deps = - packaging>=20 + packaging>=21.3 commands = python tasks/make_zipapp.py