Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Test against different Python version

on:
push:
branches: master
pull_request:
branches: [ master ]
pull_request:

jobs:
python_tests:
Expand All @@ -17,7 +16,7 @@ jobs:
matrix:
# Python version(s) to use when running the tests
# # https://github.com/actions/python-versions/blob/main/versions-manifest.json
python:
python-version:
- "3.6"
- "3.7"
- "3.8"
Expand All @@ -43,7 +42,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
python-version: ${{ matrix.python-version }}

# https://github.com/actions/cache/blob/main/examples.md#using-pip-to-get-cache-location
- name: Get pip cache dir
Expand Down Expand Up @@ -75,5 +74,13 @@ jobs:
"./sql/populate.sh"
mysql --protocol=tcp --port=53306 -uindex_digest -pqwerty index_digest -v -e '\s; SHOW TABLES; SHOW DATABASES;'

- name: Tests
run: make test
- name: Tests with code coverage
run: make coverage

# https://coveralls-python.readthedocs.io/en/latest/usage/index.html
# upload coverage report for just one of Python version matrix runs
- name: Upload coverage report to Coveralls
if: matrix.python-version == '3.9'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Integration tests

on:
push:
branches: master
branches: [ master ]
pull_request:

jobs:
Expand Down
15 changes: 3 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
project_name = indexdigest
coverage_options = --include='$(project_name)/*' --omit='$(project_name)/test/*'

install:
pip install -U -e .[dev]

test:
pytest -x $(project_name) -o log_cli=true -o log_cli_level=warning
pytest -vv -o log_cli=true -o log_cli_level=warning

coverage:
rm -f .coverage*
rm -rf htmlcov/*
coverage run -p -m pytest -x $(project_name)
coverage combine
coverage html -d htmlcov $(coverage_options)
coverage xml -i
coverage report $(coverage_options)
pytest -vv --cov=indexdigest --cov-report=term --cov-report=xml --cov-report=html --cov-fail-under=93

lint:
pylint $(project_name)/ --ignore=test
pylint indexdigest/ --ignore=test

demo:
docker run --network=host -t macbre/index-digest:latest mysql://index_digest:qwerty@127.0.0.1/index_digest --analyze-data --skip-checks=non_utf_columns --skip-tables=0028_no_time
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![PyPI](https://img.shields.io/pypi/v/indexdigest.svg)](https://pypi.python.org/pypi/indexdigest)
[![Docker Hub](https://img.shields.io/docker/pulls/macbre/index-digest.svg)](https://hub.docker.com/r/macbre/index-digest/)
[![Coverage Status](https://coveralls.io/repos/github/macbre/index-digest/badge.svg?branch=master)](https://coveralls.io/github/macbre/index-digest?branch=master)

Analyses your database queries and schema and suggests indices improvements. You can use `index-digest` as **your database linter**. The goal is to **provide the user with actionable reports** instead of just a list of statistics and schema details. Inspired by [Percona's `pt-index-usage`](https://www.percona.com/doc/percona-toolkit/LATEST/pt-index-usage.html).

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@
extras_require={
'dev': [
'coverage==5.5',
'coveralls==3.1.0',
'pylint==2.8.3',
'pytest==6.2.4',
'pytest-cov==2.12.1',
'twine==3.4.1',
]
},
Expand Down