From 51ad7d7bd40c93a7ef8c2605dcae99b6a8c21ebe Mon Sep 17 00:00:00 2001 From: Zooxy Le Date: Tue, 16 Apr 2024 18:04:06 +0700 Subject: [PATCH] chore: integrate codedev --- .github/workflows/python-package.yml | 24 ++++++++++++++++++------ codecov.yml | 18 ++++++++++++++++++ requirements-test.txt | 3 +++ tox.ini | 5 ----- 4 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 codecov.yml create mode 100644 requirements-test.txt delete mode 100644 tox.ini diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index feb6bd6..e5f49f3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -13,8 +13,7 @@ env: PYTHONPATH: src jobs: - build: - + run: runs-on: ubuntu-latest strategy: fail-fast: false @@ -30,14 +29,27 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest pyyaml + python -m pip install flake8 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + - name: Run ATS + uses: codecov/codecov-ats@v0 + env: + CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STATIC_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Run tests + run: pytest --cov=./src app ${{ env.CODECOV_ATS_TESTS }} --cov-report=xml + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: elhoangvu/dictrule + files: ./coverage.xml + flags: unit + fail_ci_if_error: false diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..b97717a --- /dev/null +++ b/codecov.yml @@ -0,0 +1,18 @@ +codecov: + notify: + after_n_builds: 3 + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + +comment: + after_n_builds: 3 + layout: "diff,flags,files" + behavior: default + require_changes: yes + +github_checks: + annotations: true \ No newline at end of file diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..c8c82d8 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,3 @@ +pytest +pytest-cov +PyYAML==6.0.1 \ No newline at end of file diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 28bcde4..0000000 --- a/tox.ini +++ /dev/null @@ -1,5 +0,0 @@ -[testenv] -deps = - pytest -commands = - pytest \ No newline at end of file