diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 0000000..d89daae --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,25 @@ +name: tox tests + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Test with tox + run: tox diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 89903e9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: ~> 1.0 -os: linux -dist: xenial # required for Python >= 3.7 -language: python -python: - - "3.6" - - "3.7" - - "3.8" - - "nightly" -jobs: - allow_failures: - - python: nightly -install: - - pip install mypy - - pip install coverage - - pip install pylint -script: - - mypy primes.py binary_search.py --strict - - python test.py - - coverage run --include=primes.py,test.py,binary_search.py test.py && coverage report -m --fail-under=100 --rcfile=coveragerc - - python speed_test.py --all - - python speed_test.py --fermat 6 - - pylint primes.py binary_search.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a07b5ce --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" + +[project] +name= "primes" +version = "0.0.0" +dynamic = ["dependencies"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[tool.setuptools] +py-modules = ["binary_search", "primes"] \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d79de11 --- /dev/null +++ b/tox.ini @@ -0,0 +1,35 @@ +[tox] +env_list = py311, lint, typing + +[testenv] +description = run unit tests +commands = + python test.py + +[testenv:speed] +commands = + python speed_test.py --all + python speed_test.py --fermat 6 + +[testenv:typing] +deps = + mypy +commands = + mypy primes.py binary_search.py --strict + +[testenv:lint] +deps = pylint +commands = + pylint primes.py binary_search.py + +[testenv:coverage] +deps = coverage +commands = + coverage run --include=primes.py,test.py,binary_search.py test.py && coverage report -m --fail-under=100 --rcfile=coveragerc + +[gh-actions] +python = + 3.9: py39 + 3.10: py310 + 3.11: py311, lint, typing + 3.12: py312 \ No newline at end of file