Skip to content

Commit bd1a552

Browse files
authored
Fix CI issues (#46)
* Fixed issues with codecov reporting, copier answer validation. Updated github action versions. * Keeping the raw/endraw tags so that copier does not try to replace {{ matrix.python-version }}.
1 parent 370f3b7 commit bd1a552

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525

2626
steps:
2727
- name: Checkout code
28-
uses: actions/checkout@v2
28+
uses: actions/checkout@v3
2929
- name: Set up Python
30-
uses: actions/setup-python@v2
30+
uses: actions/setup-python@v4
3131
with:
3232
python-version: '3.10'
3333
- name: Install Python dependencies

copier.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@ project_name:
22
type: str
33
help: What is the name of your project?
44
default: example_project
5+
validator: >-
6+
{% if not (project_name | regex_search('^[a-zA-Z][a-zA-Z0-9\_]+$')) %}
7+
project_name must start with a letter, followed one or more letters, digits or underscores all lowercase.
8+
{% endif %}
59
610
module_name:
711
type: str
812
help: What is your python module name? If left blank, will default to project_name.
913
default: "{{project_name}}"
14+
validator: >-
15+
{% if not (module_name | regex_search('^[a-zA-Z][a-zA-Z0-9\_]+$')) %}
16+
module_name must start with a letter, followed one or more letters, digits or underscores all lowercase.
17+
{% endif %}
1018
1119
author_name:
1220
type: str

python-project-template/.github/workflows/python-package.yml.jinja

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
python-version: ['3.8', '3.9', '3.10']
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222
- name: Set up Python {% raw %}${{ matrix.python-version }}{% endraw %}
23-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
2626
- name: Install dependencies
@@ -32,7 +32,9 @@ jobs:
3232
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3333
- name: Run unit tests with pytest
3434
run: |
35-
python -m pytest --cov=. --cov-report=xml
35+
python -m pytest tests --cov={{module_name}} --cov-report=xml
36+
- name: Upload coverage report to codecov
37+
uses: codecov/codecov-action@v3
3638
- name: Analyze code with pylint
3739
run: |
3840
pylint -rn -sn --recursive=y ./src

python-project-template/.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: pytest-check
1818
name: pytest-check
1919
description: Run unit tests with pytest.
20-
entry: pytest --cov=. --cov-report=html
20+
entry: pytest --cov=./src --cov-report=html
2121
language: system
2222
pass_filenames: false
2323
always_run: true

python-project-template/pyproject.toml.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ build-backend = "setuptools.build_meta"
4040
disable = """
4141
missing-module-docstring,
4242
"""
43+
ignore-patterns = "^_.*" # Ignore files that start with an underscore, i.e. _version.py

0 commit comments

Comments
 (0)