diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aed4351b..f6953d88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ jobs: strategy: matrix: python-version: [3.9, 3.8, 3.7, 3.6] + env: + IS_COVERAGE_ALLOWED: ${{ secrets.CODACY_PROJECT_TOKEN != '' }} + IS_MASTER_BRANCH: ${{ github.ref == 'refs/heads/master' }} steps: - uses: actions/checkout@v2 - name: Set up Python @@ -29,7 +32,13 @@ jobs: python -m pip install --upgrade pip pip install -r requirements-test.txt - name: Test with pytest - run: pytest -v tests/ + run: pytest --cov-report xml --cov=algobot tests/ + - name: Upload coverage + if: ${{ matrix.python-version == 3.9 && env.IS_COVERAGE_ALLOWED == 'true' && env.IS_MASTER_BRANCH == 'true' }} + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml lint: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 660312f9..d519b4e3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ __pycache__/ /.venv/ /venv/ +# Coverage +/.coverage +/coverage.xml + # Project /Backtest Results/ /Configuration/ diff --git a/requirements-test.txt b/requirements-test.txt index 25160fd9..e074c5c7 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,5 @@ -r requirements.txt -pytest==6.2.2 +pytest==6.2.3 +pytest-cov==2.11.1 flake8==3.9.0 -pre-commit==2.11.1 +pre-commit==2.12.0