Skip to content

Commit 549b5d0

Browse files
Merge 15d90a0 into b9a3901
2 parents b9a3901 + 15d90a0 commit 549b5d0

23 files changed

+561
-35
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,24 @@ jobs:
4040
- name: Lint with yamllint
4141
run: |
4242
yamllint .
43-
- name: Install deploy dependencies
43+
- name: Validate package version file
44+
# the package version file has to be always up to date as mip is using
45+
# the file directly from the repo. On a PyPi package the version file
46+
# is updated and then packed
4447
run: |
45-
python -m pip install --upgrade pip
46-
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
48+
changelog2version \
49+
--changelog_file changelog.md \
50+
--version_file umodbus/version.py \
51+
--version_file_type py \
52+
--validate \
53+
--debug
54+
- name: Validate mip package file
55+
run: |
56+
upy-package \
57+
--setup_file setup.py \
58+
--package_changelog_file changelog.md \
59+
--package_file package.json \
60+
--validate
4761
- name: Execute tests
4862
run: |
4963
docker build --tag micropython-test --file Dockerfile.tests .
@@ -59,13 +73,12 @@ jobs:
5973
- name: Run Client/Host RTU test
6074
run: |
6175
docker compose -f docker-compose-rtu-test.yaml up --build --exit-code-from micropython-host
76+
- name: Install deploy dependencies
77+
run: |
78+
python -m pip install --upgrade pip
79+
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
6280
- name: Build package
6381
run: |
64-
changelog2version \
65-
--changelog_file changelog.md \
66-
--version_file umodbus/version.py \
67-
--version_file_type py \
68-
--debug
6982
python setup.py sdist
7083
rm dist/*.orig
7184
- name: Test built package

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# changed to https due to RTD build issue
44
# see https://github.com/readthedocs/readthedocs.org/issues/4043
55
# url = [email protected]:brainelectronics/python-modules.git
6-
url = https://github.com/brainelectronics/python-modules.git
6+
url = https://github.com/brainelectronics/python-modules.git

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
3+
# To install pre-commit hooks, install `pre-commit` and activate it here:
4+
# pip3 install pre-commit
5+
# pre-commit install
6+
#
7+
default_stages:
8+
- commit
9+
- push
10+
- manual
11+
12+
repos:
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v2.3.0
15+
hooks:
16+
- id: check-yaml
17+
- id: trailing-whitespace
18+
args: [--markdown-linebreak-ext=md]
19+
- repo: https://github.com/PyCQA/flake8
20+
rev: 5.0.4
21+
hooks:
22+
- id: flake8
23+
- repo: https://github.com/brainelectronics/micropython-package-validation
24+
rev: 0.5.0
25+
hooks:
26+
- id: upy-package
27+
args:
28+
- "--setup_file=setup.py"
29+
- "--package_changelog_file=changelog.md"
30+
- "--package_file=package.json"
31+
- "--validate"
32+
- repo: https://github.com/brainelectronics/changelog2version
33+
rev: 0.10.0
34+
hooks:
35+
- id: changelog2version
36+
args:
37+
- "--changelog_file=changelog.md"
38+
- "--version_file=umodbus/version.py"
39+
- "--validate"

Dockerfile.client_rtu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ FROM micropython/unix:v1.18
1010
# COPY ./ /home
1111
# COPY umodbus /root/.micropython/lib/umodbus
1212

13-
RUN micropython-dev -m upip install micropython-ulogging
14-
1513
CMD [ "micropython-dev", "-m", "examples/rtu_client_example.py" ]

Dockerfile.client_tcp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ FROM micropython/unix:v1.18
1010
# COPY ./ /home
1111
# COPY umodbus /root/.micropython/lib/umodbus
1212

13-
RUN micropython-dev -m upip install micropython-ulogging
14-
1513
CMD [ "micropython-dev", "-m", "examples/tcp_client_example.py" ]

Dockerfile.host_rtu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ FROM micropython/unix:v1.18
1010
# COPY ./ /home
1111
# COPY umodbus /root/.micropython/lib/umodbus
1212

13-
RUN micropython-dev -m upip install micropython-ulogging
14-
1513
CMD [ "micropython-dev", "-m", "examples/rtu_host_example.py" ]

Dockerfile.host_tcp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ FROM micropython/unix:v1.18
1010
# COPY ./ /home
1111
# COPY umodbus /root/.micropython/lib/umodbus
1212

13-
RUN micropython-dev -m upip install micropython-ulogging
14-
1513
CMD [ "micropython-dev", "-m", "examples/tcp_host_example.py" ]

Dockerfile.test_examples

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ FROM micropython/unix:v1.18
1111
# COPY ./ /home
1212
# COPY umodbus /root/.micropython/lib/umodbus
1313
# COPY mpy_unittest.py /root/.micropython/lib/mpy_unittest.py
14-
15-
RUN micropython-dev -m upip install micropython-ulogging

Dockerfile.tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ COPY ./ /home
1212
COPY registers/example.json /home/tests/test-registers.json
1313
COPY umodbus /root/.micropython/lib/umodbus
1414
COPY mpy_unittest.py /root/.micropython/lib/mpy_unittest.py
15+
COPY tests/ulogging.py /root/.micropython/lib/ulogging.py
1516

16-
RUN micropython-dev -m upip install micropython-ulogging
1717
RUN micropython-dev -c "import mpy_unittest as unittest; unittest.main('tests')"
1818

1919
ENTRYPOINT ["/bin/bash"]

Dockerfile.tests_manually

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ COPY ./ /home
1212
COPY registers/example.json /home/tests/test-registers.json
1313
COPY umodbus /root/.micropython/lib/umodbus
1414
COPY mpy_unittest.py /root/.micropython/lib/mpy_unittest.py
15-
16-
RUN micropython-dev -m upip install micropython-ulogging
15+
COPY tests/ulogging.py /root/.micropython/lib/ulogging.py
1716

1817
ENTRYPOINT ["/bin/bash"]

changelog.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
<!-- ## [Unreleased] -->
1616

1717
## Released
18+
## [2.3.6] - 2023-07-19
19+
### Added
20+
- Add contribution guideline, see #67
21+
- Content of `package.json` is validated on each test workflow run
22+
- Precommit hooks for `package.json` and package version file validation, yaml style, flake8 and trailing whitespace checks, contributes to #67
23+
24+
### Changed
25+
- `umodbus/version.py` file is validated against the latest changelog entry before running all tests and testing the package creation
26+
- `ulogging` placed into `tests` folder instead of installing it with deprecated `upip` in all Docker containers
27+
28+
### Fixed
29+
- Added missing empty line in several files
30+
1831
## [2.3.5] - 2023-07-01
1932
### Fixed
2033
- Time between RS485 control pin raise and UART transmission reduced by 80% from 1000us to 200us
@@ -290,8 +303,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
290303
- PEP8 style issues on all files of [`lib/uModbus`](lib/uModbus)
291304

292305
<!-- Links -->
293-
[Unreleased]: https://github.com/brainelectronics/micropython-modbus/compare/2.3.5...develop
306+
[Unreleased]: https://github.com/brainelectronics/micropython-modbus/compare/2.3.6...develop
294307

308+
[2.3.6]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.6
295309
[2.3.5]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.5
296310
[2.3.4]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.4
297311
[2.3.3]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.3

docker-compose-rtu-test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ services:
2020
- ./registers:/home/registers
2121
- ./umodbus:/root/.micropython/lib/umodbus
2222
- ./fakes:/usr/lib/micropython
23+
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
2324
expose:
2425
- "65433"
2526
ports:
@@ -41,6 +42,7 @@ services:
4142
- ./umodbus:/root/.micropython/lib/umodbus
4243
- ./fakes:/usr/lib/micropython
4344
- ./mpy_unittest.py:/root/.micropython/lib/mpy_unittest.py
45+
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
4446
depends_on:
4547
- micropython-client
4648
command:

docker-compose-rtu.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- ./:/home
2020
- ./umodbus:/root/.micropython/lib/umodbus
2121
- ./fakes:/usr/lib/micropython
22+
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
2223
expose:
2324
- "65433"
2425
ports:
@@ -39,6 +40,7 @@ services:
3940
- ./:/home
4041
- ./umodbus:/root/.micropython/lib/umodbus
4142
- ./fakes:/usr/lib/micropython
43+
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
4244
depends_on:
4345
- micropython-client
4446
networks:

docker-compose-tcp-test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- ./:/home
2020
- ./registers:/home/registers
2121
- ./umodbus:/root/.micropython/lib/umodbus
22+
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
2223
expose:
2324
- "502"
2425
ports:
@@ -39,6 +40,7 @@ services:
3940
- ./:/home
4041
- ./umodbus:/root/.micropython/lib/umodbus
4142
- ./mpy_unittest.py:/root/.micropython/lib/mpy_unittest.py
43+
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
4244
depends_on:
4345
- micropython-client
4446
command:

0 commit comments

Comments
 (0)