From 67c520a11c268c8a28f73cad966dc21cc671a50d Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 15 Dec 2023 15:18:44 +0200 Subject: [PATCH] Convert defunct Travis CI workflow to GitHub Actions --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++++ .travis.yml | 18 ------------------ Makefile | 6 ++---- README.rst | 6 +++--- poetry.lock | 19 ++++++++++++++++++- pyproject.toml | 1 + radon/tests/run.py | 14 -------------- test_requirements.txt | 6 ------ 8 files changed, 57 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100644 radon/tests/run.py delete mode 100644 test_requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..65a75a4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build: + runs-on: '${{ matrix.os }}' + strategy: + matrix: + os: + - ubuntu-latest + python-version: + - '3.12' + steps: + - uses: actions/checkout@v4 + - name: 'Set up Python ${{ matrix.python-version }}' + uses: actions/setup-python@v5 + with: + python-version: '${{ matrix.python-version }}' + cache: pip + cache-dependency-path: | + poetry.lock + pyproject.toml + - run: pip install poetry + - run: poetry config virtualenvs.create false + - run: poetry install --with dev + - run: make tests + # TODO: re-enabling `coveralls` requires a token in the repo secrets + # - run: coveralls diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a55d193..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: python -os: linux -dist: xenial -python: - - "2.7" - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "pypy3.5" -install: - - pip install . - - pip install -r test_requirements.txt -script: - - make tests - - make cov -after_success: - - coveralls diff --git a/Makefile b/Makefile index 4438eeb..beb6717 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,10 @@ lint: f: format lint -tests: - python radon/tests/run.py +tests: cov cov: - coverage erase && coverage run --branch --include "radon/*" --omit "radon/__init__.py,radon/cli.py,radon/tests/*" radon/tests/run.py - coverage report -m + py.test --cov radon --cov-report term-missing --cov-report xml . htmlcov: cov coverage html diff --git a/README.rst b/README.rst index 9b408b9..59212ad 100644 --- a/README.rst +++ b/README.rst @@ -5,9 +5,9 @@ Radon :alt: Codacy badge :target: https://www.codacy.com/app/rubik/radon/dashboard -.. image:: https://img.shields.io/travis/rubik/radon/master.svg?style=for-the-badge - :alt: Travis-CI badge - :target: https://travis-ci.org/rubik/radon +.. image:: https://img.shields.io/github/actions/workflow/status/rubik/radon/ci.yml + :alt: GitHub Actions badge + :target: https://github.com/rubik/radon/actions .. image:: https://img.shields.io/coveralls/rubik/radon/master.svg?style=for-the-badge :alt: Coveralls badge diff --git a/poetry.lock b/poetry.lock index 4f55625..a179c52 100644 --- a/poetry.lock +++ b/poetry.lock @@ -538,11 +538,28 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +[[package]] +name = "pytest-cov" +version = "4.1.0" +description = "Pytest plugin for measuring coverage." +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"}, + {file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"}, +] + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] + [[package]] name = "pytest-mock" version = "3.10.0" description = "Thin-wrapper around the mock package for easier use with pytest" -category = "dev" optional = false python-versions = ">=3.7" files = [ diff --git a/pyproject.toml b/pyproject.toml index c25f1bd..da64ce2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ pytest-mock = "*" argparse = "*" nbformat = "*" tox = "^4.4.7" +pytest-cov = "^4.1.0" [tool.poetry.scripts] radon = "radon:main" diff --git a/radon/tests/run.py b/radon/tests/run.py deleted file mode 100644 index 27251b6..0000000 --- a/radon/tests/run.py +++ /dev/null @@ -1,14 +0,0 @@ -if __name__ == '__main__': - import pytest - - # see: https://docs.pytest.org/en/6.2.x/deprecations.html#the-strict-command-line-option - # This check can be removed once Python 2.x support is dropped as the new - # pytest option (--strict-markers) is available in pytest for all Python 3.x - from packaging import version - if version.parse(pytest.__version__) < version.parse('6.2'): - pytest_args = ['--strict'] - else: - pytest_args = ['--strict-markers'] - - ret = pytest.main(pytest_args) - exit(ret) diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index 1994134..0000000 --- a/test_requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -coverage -coveralls -pytest>=5.0; python_version >= '3.0' -pytest>=2.7; python_version < '3.0' -pytest-mock -nbformat