diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 0e2d03b56..000000000 --- a/.coveragerc +++ /dev/null @@ -1,6 +0,0 @@ -[run] -source = debug_toolbar -branch = 1 - -[report] -omit = *tests*,*migrations* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 050d5b11d..2c8a56811 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,10 +70,11 @@ jobs: DB_HOST: 127.0.0.1 DB_PORT: 3306 - - name: Upload coverage - uses: codecov/codecov-action@v1 + - name: Upload coverage data + uses: actions/upload-artifact@v2 with: - name: Python ${{ matrix.python-version }} + name: coverage-data + path: ".coverage.*" postgres: runs-on: ubuntu-latest @@ -137,10 +138,11 @@ jobs: DB_HOST: localhost DB_PORT: 5432 - - name: Upload coverage - uses: codecov/codecov-action@v1 + - name: Upload coverage data + uses: actions/upload-artifact@v2 with: - name: Python ${{ matrix.python-version }} + name: coverage-data + path: ".coverage.*" sqlite: runs-on: ubuntu-latest @@ -183,10 +185,42 @@ jobs: DB_BACKEND: sqlite3 DB_NAME: ":memory:" - - name: Upload coverage - uses: codecov/codecov-action@v1 + - name: Upload coverage data + uses: actions/upload-artifact@v2 with: - name: Python ${{ matrix.python-version }} + name: coverage-data + path: ".coverage.*" + + coverage: + name: Check coverage. + runs-on: "ubuntu-latest" + needs: [sqlite, mysql, postgres] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + # Use latest, so it understands all syntax. + python-version: "3.10" + + - run: python -m pip install --upgrade coverage + + - name: Download coverage data. + uses: actions/download-artifact@v2 + with: + name: coverage-data + + - name: Combine coverage & check percentage + run: | + python -m coverage combine + python -m coverage html + python -m coverage report + + - name: Upload HTML report if check failed. + uses: actions/upload-artifact@v2 + with: + name: html-report + path: htmlcov + if: ${{ failure() }} lint: runs-on: ubuntu-latest diff --git a/setup.cfg b/setup.cfg index 5cc680607..7ee46f7be 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,6 +45,25 @@ exclude = tests tests.* + +[coverage.html] +skip_covered = True +skip_empty = True + +[coverage:run] +branch = True +parallel = True +source = debug_toolbar + +[coverage:paths] +source = + src + .tox/*/site-packages + +[coverage:report] +fail_under = 89 +show_missing = True + [flake8] extend-ignore = E203, E501 diff --git a/tox.ini b/tox.ini index 3abd404bc..452de8cc5 100644 --- a/tox.ini +++ b/tox.ini @@ -24,6 +24,7 @@ deps = sqlparse passenv= CI + COVERAGE_ARGS DB_BACKEND DB_NAME DB_USER @@ -39,9 +40,10 @@ setenv = DB_USER = {env:DB_USER:debug_toolbar} DB_HOST = {env:DB_HOST:localhost} DB_PASSWORD = {env:DB_PASSWORD:debug_toolbar} + DJANGO_SETTINGS_MODULE = tests.settings whitelist_externals = make pip_pre = True -commands = make coverage TEST_ARGS='{posargs:tests}' +commands = python -b -W always -m coverage run -m django test -v2 {posargs:tests} [testenv:py{36,37,38,39,310}-dj{22,31,32}-postgresql] setenv =