Skip to content

Commit 481efde

Browse files
Merge pull request #78 from brainelectronics/feature/improve-contribution-guideline
Add contribution guideline
2 parents b9a3901 + 15d90a0 commit 481efde

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 = git@github.com: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"]

0 commit comments

Comments
 (0)