diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 68ce71d..63db9fc 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -1,4 +1,4 @@ -name: Linters +name: Linters-pR on: push: diff --git a/.github/workflows/master_linters.yml b/.github/workflows/master_linters.yml new file mode 100644 index 0000000..d25d0e4 --- /dev/null +++ b/.github/workflows/master_linters.yml @@ -0,0 +1,85 @@ +name: Linters +on: + push: + branches: + - 'master' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pylint + pip install mypy + pip install wemake-python-styleguide + pip install black + pip install types-xmltodict + pip install types-requests + - name: Analysing the code with pylint + id: pylint + continue-on-error: true + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + echo $changed_files + if [ -n "$changed_files" ]; then + PYTHONPATH=. pylint $changed_files + else + echo "No files changed, passing by" + exit 0 + fi + - name: Analysing the code with mypy + id: mypy + continue-on-error: true + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + echo $changed_files + if [ -n "$changed_files" ]; then + PYTHONPATH=. mypy $changed_files --install-types --non-interactive --ignore-missing-imports + else + echo "No files changed, passing by" + exit 0 + fi + - name: Check code with flake8 + id: flake8 + continue-on-error: true + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + echo $changed_files + if [ -n "$changed_files" ]; then + PYTHONPATH=. flake8 $changed_files + else + echo "No files changed, passing by" + exit 0 + fi + - name: Check code with Black + id: black + continue-on-error: true + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + echo $changed_files + if [ -n "$changed_files" ]; then + PYTHONPATH=. black --diff --check --color $changed_files + else + echo "No files changed, passing by" + exit 0 + fi + - name: Check runner state + run: | + if [[ "${{ steps.pylint.outcome }}" == "failure" || "${{ steps.black.outcome }}" == "failure" || "${{ steps.mypy.outcome }}" == "failure" ]]; then + echo "Linters failed, refer to related sections for info" + exit 1 + fi diff --git a/.github/workflows/master_tests.yml b/.github/workflows/master_tests.yml new file mode 100644 index 0000000..fc183e7 --- /dev/null +++ b/.github/workflows/master_tests.yml @@ -0,0 +1,45 @@ +name: Tests +on: + push: + branches: + - 'master' +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest-xdist + pip install pytest-ordering + pip install pytest-order + pip install pytest-cov + - name: Add 'src' to PYTHONPATH + run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/src:." >> $GITHUB_ENV + - name: Execute tests + id: tests + run: pytest tests -n=auto --dist=loadfile --order-scope=module --cov=testrail_api_reporter --cov-report=term --cov-report=xml:coverage.xml --cov-report=html + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: wwakabobik/testrail_api_reporter + flags: unittests + name: codecov-umbrella + fail_ci_if_error: true + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2.2.3 + with: + github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..59e4ca7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,34 @@ +name: Tests-PR +on: + push: + branches-ignore: + - 'master' + pull_request: + branches-ignore: + - 'master' +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest-xdist + pip install pytest-cov + - name: Add 'src' to PYTHONPATH + run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/src:." >> $GITHUB_ENV + - name: Execute tests + id: tests + run: pytest tests -n=auto --dist=loadfile --order-scope=module --cov=testrail_api_reporter --cov-report=term --cov-report=xml:coverage.xml --cov-fail-under=95 diff --git a/README.md b/README.md index 6222e60..a36c4e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ # TestRail reporter -pypi package can be found [here](https://pypi.org/project/testrail-api-reporter/). +[![PyPI version](https://badge.fury.io/py/testrail-api-reporter.svg)](https://badge.fury.io/py/testrail-api-reporter) +[![Linters](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/testrail-api-reporter/actions/workflows/master_linters.yml) +[![Tests](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_tests.yml) +[![Coverage Status](https://coveralls.io/repos/github/wwakabobik/pytest-rerunclassfailures/badge.svg?branch=master)](https://coveralls.io/github/wwakabobik/testrail-api-reporter?branch=master) +[![codecov](https://codecov.io/gh/wwakabobik/testrail-api-reporter/graph/badge.svg?token=F1I7TBGE5U)](https://codecov.io/gh/wwakabobik/pytest-rerunclassfailures) +![PyPI - License](https://img.shields.io/pypi/l/testrail-api-reporter) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/testrail-api-reporter) +[![Downloads](https://static.pepy.tech/badge/testrail_api_reporter)](https://pepy.tech/project/testrail_api_reporter) +[![Downloads](https://static.pepy.tech/badge/testrail_api_reporter/month)](https://pepy.tech/project/testrail_api_reporter) ## This is Testrail API reporter tools. diff --git a/pyproject.toml b/pyproject.toml index 027097d..1442349 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,3 +29,109 @@ min-public-methods = 1 [[tool.mypy.overrides]] module = "testrail_api.*" ignore_missing_imports = true + + + + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "leonardo_api" +version = "0.0.10" +authors = [ + { name="Iliya Vereshchagin", email="i.vereshchagin@gmail.com" }, +] +maintainers = [ + { name="Iliya Vereshchagin", email="i.vereshchagin@gmail.com" }, +] +keywords = ["leonardo", "ai", "image generation", "artificial intelligence", "api", "llm", "leonardo.ai", "stablediffusion"] +description = "Leonardo.ai Python API" +readme = "README.md" +license = { file="LICENSE" } +requires-python = ">=3.8" +dependencies = [ + 'requests', + 'aiohttp', + 'aiofiles', + 'asyncio', + 'requests', + 'urllib3', + 'async-timeout', + 'certifi', + 'charset-normalizer', + 'frozenlist' +] +classifiers = [ + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Image Processing", + "Topic :: Scientific/Engineering :: Visualization", +] + +install_requires = [ + 'requests', + 'aiohttp', + 'aiofiles', + 'asyncio', + 'requests', + 'urllib3', + 'async-timeout', + 'certifi', + 'charset-normalizer', + 'frozenlist' +] + +[project.urls] +"Homepage" = "https://github.com/wwakabobik/leonardo_api" +"Bug Tracker" = "https://github.com/wwakabobik/leonardo_api/issues" + +[tool.black] +line-length = 120 + +[tool.flake8] +max-line-length = 120 +extend-ignore = """ + Q000, + WPS306, + I001, + I005, + WPS229, + D400, + WPS317, + S101, + WPS507, + DAR101, + DAR201, + WPS112, + F401, + WPS300, + WPS412, + DAR301, + D401, + D205, + WPS615, + I004, + WPS110, + WPS420, + C812, + W1203, + R0801, + WPS305, + WPS226, + DAR401, + WPS237 +""" + +[tool.pylint] +max-line-length = 120 diff --git a/testrail_api_reporter/utils/reporter_utils.py b/testrail_api_reporter/utils/reporter_utils.py index 80eb3a6..836d2ec 100644 --- a/testrail_api_reporter/utils/reporter_utils.py +++ b/testrail_api_reporter/utils/reporter_utils.py @@ -54,8 +54,6 @@ def delete_file(filename, debug=True, logger=None): if debug: if logger: logger.debug(f"Removed {filename}") - else: - print(f"Removed {filename}") def zip_file(filename, suffix=None, debug=True, logger=None): @@ -75,8 +73,6 @@ def zip_file(filename, suffix=None, debug=True, logger=None): if debug: if logger: logger.debug(f"ZIPped {filename} to {zipped_file}") - else: - print(f"ZIPped {filename} to {zipped_file}") return zipped_file @@ -95,8 +91,6 @@ def check_captions_and_files(captions, files, debug, logger=None): if debug: if logger: logger.debug("Captions are not a list, thus no legend will be displayed") - else: - print("Caption list is empty, no legend will be displayed") return_value = None elif len(captions) != len(files): if debug: @@ -106,11 +100,6 @@ def check_captions_and_files(captions, files, debug, logger=None): len(captions), len(files), ) - else: - print( - f"Caption and file lists are not the same length {len(captions)} != {len(files)} thus " - f"no legend will be displayed" - ) return_value = None return return_value