From b7c54e2425427a561f1c442ae5d5d96e0d1160c8 Mon Sep 17 00:00:00 2001 From: Malachi Soord Date: Wed, 14 Apr 2021 21:31:30 +0200 Subject: [PATCH 1/2] Add coverage push to Codacy --- .github/workflows/ci.yml | 11 ++++++++++- .gitignore | 4 ++++ requirements-test.txt | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) 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..5093222d 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,6 @@ -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 + From a4be79cee6fabbfc52eb8a11e28b9bd234921c0a Mon Sep 17 00:00:00 2001 From: Malachi Soord Date: Wed, 14 Apr 2021 21:33:37 +0200 Subject: [PATCH 2/2] Remove LF --- requirements-test.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 5093222d..e074c5c7 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,4 +3,3 @@ pytest==6.2.3 pytest-cov==2.11.1 flake8==3.9.0 pre-commit==2.12.0 -