From 6738fe34783c1f992269c047e349917f412f07eb Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 16:41:32 +0800 Subject: [PATCH 1/9] Test for codecov. --- src/serious_scaffold/cli.py | 2 +- src/{{ module_name }}/cli.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/serious_scaffold/cli.py b/src/serious_scaffold/cli.py index 5a4957d9..6ea0495b 100644 --- a/src/serious_scaffold/cli.py +++ b/src/serious_scaffold/cli.py @@ -13,4 +13,4 @@ def run() -> None: if __name__ == "__main__": - app() # pragma: no cover + app() diff --git a/src/{{ module_name }}/cli.py b/src/{{ module_name }}/cli.py index 5a4957d9..6ea0495b 100644 --- a/src/{{ module_name }}/cli.py +++ b/src/{{ module_name }}/cli.py @@ -13,4 +13,4 @@ def run() -> None: if __name__ == "__main__": - app() # pragma: no cover + app() From 9be41ed5d7bf5bd4667b77f72c5ff00c07536f48 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 16:54:35 +0800 Subject: [PATCH 2/9] Debug. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f914ce5..9cc33a23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: cache: pip python-version: ${{ matrix.python-version }} - run: make dev-tests + - run: env | sort - run: make tests - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 From 52fd8722aea429cd6294d177fdc1809520949c94 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 17:04:51 +0800 Subject: [PATCH 3/9] Set ci env. --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc33a23..bb94220a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,5 @@ +env: + SS_TEST_COVERAGE_MIN: ${{ vars.SS_TEST_COVERAGE_MIN }} jobs: consistency: runs-on: ubuntu-latest From 4f37c67e51126a7356b3c8d01bdfdc9c3ae752c8 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 17:23:27 +0800 Subject: [PATCH 4/9] Use template variable instead. --- .github/workflows/ci.yml | 2 -- .vscode/settings.json | 3 ++- Makefile | 2 +- Makefile.jinja | 2 +- copier.yaml | 4 ++++ pyproject.toml | 2 +- pyproject.toml.jinja | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb94220a..9cc33a23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,3 @@ -env: - SS_TEST_COVERAGE_MIN: ${{ vars.SS_TEST_COVERAGE_MIN }} jobs: consistency: runs-on: ubuntu-latest diff --git a/.vscode/settings.json b/.vscode/settings.json index b0d31c2e..8d7eb29a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -71,7 +71,8 @@ "author_email", "repo_name", "package_name", - "module_name" + "module_name", + "test_coverage_threshold" ], "vscode-yaml-sort.noCompatMode": true, "vscode-yaml-sort.sortOnSave": 2, diff --git a/Makefile b/Makefile index 0e07f1c4..7095a97e 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ toml-sort: ${PIPRUN} toml-sort pyproject.toml tests: - ${PIPRUN} python -m pytest --cov-fail-under=$(or $(SS_TEST_COVERAGE_MIN),100) . + ${PIPRUN} python -m pytest . freeze: @${PIPRUN} pip freeze --exclude-editable diff --git a/Makefile.jinja b/Makefile.jinja index 9a9436e5..fb548267 100644 --- a/Makefile.jinja +++ b/Makefile.jinja @@ -62,7 +62,7 @@ toml-sort: ${PIPRUN} toml-sort pyproject.toml tests: - ${PIPRUN} python -m pytest --cov-fail-under=$(or $(SS_TEST_COVERAGE_MIN),100) . + ${PIPRUN} python -m pytest . freeze: @${PIPRUN} pip freeze --exclude-editable diff --git a/copier.yaml b/copier.yaml index 4e397b5e..10706a20 100644 --- a/copier.yaml +++ b/copier.yaml @@ -41,3 +41,7 @@ module_name: default: '{{ package_name|lower|replace("-", "_") }}' help: 'Module name:' type: str +test_coverage_threshold: + default: 100 + help: 'Threshold for test coverage:' + type: int diff --git a/pyproject.toml b/pyproject.toml index 62960a30..813473fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ warn_return_any = true warn_unused_ignores = true [tool.pytest.ini_options] -addopts = "-l -s --durations=0 --cov=src --cov-report term --cov-report xml" +addopts = "-l -s --durations=0 --cov=src --cov-report term --cov-report xml --cov-fail-under=100" log_cli = true log_cli_level = "info" log_date_format = "%Y-%m-%d %H:%M:%S" diff --git a/pyproject.toml.jinja b/pyproject.toml.jinja index 998561fc..2340d595 100644 --- a/pyproject.toml.jinja +++ b/pyproject.toml.jinja @@ -73,7 +73,7 @@ warn_return_any = true warn_unused_ignores = true [tool.pytest.ini_options] -addopts = "-l -s --durations=0 --cov=src --cov-report term --cov-report xml" +addopts = "-l -s --durations=0 --cov=src --cov-report term --cov-report xml --cov-fail-under={{ test_coverage_threshold }}" log_cli = true log_cli_level = "info" log_date_format = "%Y-%m-%d %H:%M:%S" From 897c31c1a13a3cd3b9b9581fef0135748765d410 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 17:28:20 +0800 Subject: [PATCH 5/9] Fix consistency. --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc33a23..6f914ce5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,6 @@ jobs: cache: pip python-version: ${{ matrix.python-version }} - run: make dev-tests - - run: env | sort - run: make tests - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 From 4c5a3c9f06352dd5ca8142428708e2d1dc5fcd94 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 17:30:03 +0800 Subject: [PATCH 6/9] Test. --- .github/workflows/ci.yml | 2 ++ .github/workflows/ci.yml.jinja | 2 ++ copier.yaml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f914ce5..cf722b06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,8 @@ jobs: with: cache: pip python-version: ${{ matrix.python-version }} + - run: pip install copier + - run: copier -r HEAD -f . . - run: make dev-tests - run: make tests - name: Upload coverage to Codecov diff --git a/.github/workflows/ci.yml.jinja b/.github/workflows/ci.yml.jinja index 5f471fe8..24533e49 100644 --- a/.github/workflows/ci.yml.jinja +++ b/.github/workflows/ci.yml.jinja @@ -52,6 +52,8 @@ jobs: with: cache: pip python-version: {{ '${{ matrix.python-version }}' }} + - run: pip install copier + - run: copier -r HEAD -f . . - run: make dev-tests - run: make tests - name: Upload coverage to Codecov diff --git a/copier.yaml b/copier.yaml index 10706a20..da5fdaea 100644 --- a/copier.yaml +++ b/copier.yaml @@ -42,6 +42,6 @@ module_name: help: 'Module name:' type: str test_coverage_threshold: - default: 100 + default: 90 help: 'Threshold for test coverage:' type: int From 0f41a90f23587b2a622412dbc597db1087c2e332 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 17:46:17 +0800 Subject: [PATCH 7/9] Add codecov.yml. --- codecov.yml | 5 +++++ codecov.yml.jinja | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 codecov.yml create mode 100644 codecov.yml.jinja diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..9da71da6 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + target: 100 diff --git a/codecov.yml.jinja b/codecov.yml.jinja new file mode 100644 index 00000000..fb9a3847 --- /dev/null +++ b/codecov.yml.jinja @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + target: {{ test_coverage_threshold }} From 70d60ea8d850c866da5faba83617af1958e8439e Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Thu, 25 May 2023 17:41:36 +0800 Subject: [PATCH 8/9] Change default for test coverage threshold. --- copier.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yaml b/copier.yaml index da5fdaea..10706a20 100644 --- a/copier.yaml +++ b/copier.yaml @@ -42,6 +42,6 @@ module_name: help: 'Module name:' type: str test_coverage_threshold: - default: 90 + default: 100 help: 'Threshold for test coverage:' type: int From 4bdcfde6ad12e09d9f1d0835f79025345006a9f3 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Thu, 25 May 2023 17:52:31 +0800 Subject: [PATCH 9/9] Revert. --- .github/workflows/ci.yml | 2 -- .github/workflows/ci.yml.jinja | 2 -- codecov.yml | 5 ----- codecov.yml.jinja | 5 ----- src/serious_scaffold/cli.py | 2 +- src/{{ module_name }}/cli.py | 2 +- 6 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 codecov.yml delete mode 100644 codecov.yml.jinja diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf722b06..6f914ce5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,8 +50,6 @@ jobs: with: cache: pip python-version: ${{ matrix.python-version }} - - run: pip install copier - - run: copier -r HEAD -f . . - run: make dev-tests - run: make tests - name: Upload coverage to Codecov diff --git a/.github/workflows/ci.yml.jinja b/.github/workflows/ci.yml.jinja index 24533e49..5f471fe8 100644 --- a/.github/workflows/ci.yml.jinja +++ b/.github/workflows/ci.yml.jinja @@ -52,8 +52,6 @@ jobs: with: cache: pip python-version: {{ '${{ matrix.python-version }}' }} - - run: pip install copier - - run: copier -r HEAD -f . . - run: make dev-tests - run: make tests - name: Upload coverage to Codecov diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 9da71da6..00000000 --- a/codecov.yml +++ /dev/null @@ -1,5 +0,0 @@ -coverage: - status: - project: - default: - target: 100 diff --git a/codecov.yml.jinja b/codecov.yml.jinja deleted file mode 100644 index fb9a3847..00000000 --- a/codecov.yml.jinja +++ /dev/null @@ -1,5 +0,0 @@ -coverage: - status: - project: - default: - target: {{ test_coverage_threshold }} diff --git a/src/serious_scaffold/cli.py b/src/serious_scaffold/cli.py index 6ea0495b..5a4957d9 100644 --- a/src/serious_scaffold/cli.py +++ b/src/serious_scaffold/cli.py @@ -13,4 +13,4 @@ def run() -> None: if __name__ == "__main__": - app() + app() # pragma: no cover diff --git a/src/{{ module_name }}/cli.py b/src/{{ module_name }}/cli.py index 6ea0495b..5a4957d9 100644 --- a/src/{{ module_name }}/cli.py +++ b/src/{{ module_name }}/cli.py @@ -13,4 +13,4 @@ def run() -> None: if __name__ == "__main__": - app() + app() # pragma: no cover