Skip to content

Commit 932c621

Browse files
CI: Add requirements-dev.txt and add pip cache (#533)
Also: - bump GitHub checkout action to v4 - bump GitHub setup-python action to v5 - ignore README and LICENSE files - invoke pip according to best practise Follow-up of #498
1 parent 4301c4b commit 932c621

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

.github/workflows/pythonpackage.yml

+18-10
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@ name: Python package
55

66
on:
77
push:
8-
branches: [ "master" ]
8+
branches:
9+
- 'master'
10+
paths-ignore:
11+
- 'README.rst'
12+
- 'LICENSE.txt'
913
pull_request:
10-
branches: [ "master" ]
14+
branches:
15+
- 'master'
16+
paths-ignore:
17+
- 'README.rst'
18+
- 'LICENSE.txt'
1119

1220
jobs:
1321
build:
@@ -20,19 +28,19 @@ jobs:
2028
features: ['', '[db_export]']
2129

2230
steps:
23-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
2432
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v3
33+
uses: actions/setup-python@v5
2634
with:
2735
python-version: ${{ matrix.python-version }}
36+
cache: 'pip'
37+
cache-dependency-path: |
38+
'pyproject.toml'
39+
'requirements-dev.txt'
2840
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install pytest pytest-cov
32-
pip install -e '.${{ matrix.features }}'
41+
run: python3 -m pip install -e '.${{ matrix.features }}' -r requirements-dev.txt
3342
- name: Test with pytest
34-
run: |
35-
pytest -v --cov=canopen --cov-report=xml --cov-branch
43+
run: pytest -v --cov=canopen --cov-report=xml --cov-branch
3644
- name: Upload coverage reports to Codecov
3745
uses: codecov/codecov-action@v4
3846
with:

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ it in `develop mode`_::
5353

5454
Unit tests can be run using the pytest_ framework::
5555

56-
$ pip install pytest
56+
$ pip install -r requirements-dev.txt
5757
$ pytest -v
5858

5959
You can also use :mod:`unittest` standard library module::

requirements-dev.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pytest~=8.3
2+
pytest-cov~=5.0

0 commit comments

Comments
 (0)