diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index feb6bd6..f112dde 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,29 @@ 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 --junitxml=./coverage.xml tests/ + - 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 + files: ./coverage.xml - 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..ef0195b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,27 @@ +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" \ 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