From b8fab4e1f4858865e883069af52dd71dd2a2799e 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 | 30 ++++++++++++++++++++------ codecov.yml | 32 ++++++++++++++++++++++++++++ requirements-test.txt | 3 +++ tox.ini | 5 ----- 4 files changed, 58 insertions(+), 12 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..c0305a8 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,31 @@ 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: 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 + - name: Run tests and collect coverage + run: | + cat codecov_ats/tests_to_run.txt | xargs pytest --cov app + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: elhoangvu/dictrule + fail_ci_if_error: false + flags: smart-tests + verbose: true + plugins: pycoverage,compress-pycoverage - 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 + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..f92e2cf --- /dev/null +++ b/codecov.yml @@ -0,0 +1,32 @@ +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 + +flag_management: + individual_flags: + - name: smart-tests + carryforward: true + carryforward_mode: "labels" + statuses: + - type: "project" + - type: "patch" + +cli: + plugins: + pycoverage: + report_type: "json" \ 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