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:
- 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

View file

@ -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

View file

@ -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)

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 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"])

View file

@ -15,7 +15,7 @@ import pytest
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

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
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