Skip to content

Commit 3ac817d

Browse files
authored
Merge pull request #50 from scs/feature/upgrade
* update dependencies * add Python 3.10 code checks * update and fix Github workflows & scripts * update documentation
2 parents d65062b + e89ffb6 commit 3ac817d

File tree

11 files changed

+709
-588
lines changed

11 files changed

+709
-588
lines changed

.github/workflows/build-deb.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,48 @@ name: Build a Debian package
33
on:
44
push:
55
branches:
6-
- '**'
6+
- "**"
77
tags:
8-
- 'v*'
8+
- "v*"
99
workflow_dispatch:
1010

1111
permissions:
1212
contents: write
1313

1414
jobs:
1515
build-deb:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717
strategy:
1818
matrix:
19-
os: [ 'debian', 'raspios' ]
19+
os: ["debian", "raspios"]
2020
include:
2121
- os: debian
22-
dist: buster
22+
dist: bullseye
2323
arch: amd64
2424
keyring_cmd: sudo apt-get install -y debian-archive-keyring
2525
- os: raspios
26-
dist: buster
26+
dist: bullseye
2727
arch: armhf
2828
keyring_cmd: wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb && sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb
2929

3030
name: Build a Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}
3131
steps:
32-
- uses: actions/checkout@v2
33-
32+
- uses: actions/checkout@v3
3433
- name: Update apt cache
3534
run: |
3635
sudo apt-get update
37-
3836
- name: Set up Python
39-
uses: actions/setup-python@v1
37+
uses: actions/setup-python@v4
4038
with:
41-
python-version: 3.8
42-
39+
python-version: 3.9
40+
cache: "pipenv"
4341
- name: Install pipenv
4442
run: |
4543
python -m pip install --upgrade pip pipenv
4644
python --version; python -m pip --version; pipenv --version
47-
- name: Cache pipenv environment
48-
id: cache-pipenv
49-
uses: actions/cache@v1
50-
with:
51-
path: ~/.local/share/virtualenvs
52-
key: ${{ runner.os }}-3.8-pipenv-${{ hashFiles('**/Pipfile.lock') }}
5345
- name: Setup project with pipenv
54-
if: steps.cache-pipenv.outputs.cache-hit != 'true'
5546
run: |
56-
pipenv install --dev
57-
47+
pipenv --python 3.9 install --dev
5848
- name: Prepare to build a Debian source package
5949
run: |
6050
sudo apt-get -y install python3-all debhelper dh-python rename
@@ -65,10 +55,11 @@ jobs:
6555
6656
- name: Cache pbuilder chroot
6757
id: cache-pbuilder-chroot
68-
uses: actions/cache@v1
58+
uses: actions/cache@v3
6959
with:
7060
path: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-base.tgz
7161
key: ${{ runner.os }}-pbuilder-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-${{ hashFiles('**/Pipfile.lock') }}
62+
7263
- name: Prepare the pbuilder chroot for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}
7364
if: steps.cache-pbuilder-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-chroot.outputs.cache-hit != 'true'
7465
run: |
@@ -86,13 +77,13 @@ jobs:
8677
sudo rename "s/_all\./_${{ matrix.arch }}\./" /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb
8778
8879
- name: Archive the built Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}
89-
uses: actions/upload-artifact@v2
80+
uses: actions/upload-artifact@v3
9081
with:
9182
name: ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-deb
9283
path: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb
9384

9485
- name: Archive the additional Debian package files for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}
95-
uses: actions/upload-artifact@v2
86+
uses: actions/upload-artifact@v3
9687
with:
9788
name: ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-packagefiles
9889
path: |
@@ -102,11 +93,11 @@ jobs:
10293
- name: Get the tag name
10394
id: tag-name
10495
if: startsWith(github.ref, 'refs/tags')
105-
uses: olegtarasov/get-tag@v2.1.1
96+
uses: olegtarasov/get-tag@v2.1.2
10697

10798
- name: Create a new release
10899
if: startsWith(github.ref, 'refs/tags')
109-
uses: ncipollo/release-action@v1.8.8
100+
uses: ncipollo/release-action@v1.12.0
110101
with:
111102
allowUpdates: true
112103
artifacts: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb

.github/workflows/publish-to-pypi.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,66 @@ name: Publish Python package to PyPI / Test PyPI
33
on:
44
push:
55
branches:
6-
- '**'
6+
- "**"
77
tags:
8-
- 'v*'
8+
- "v*"
99
workflow_dispatch:
1010

1111
permissions:
1212
contents: write
1313

1414
jobs:
1515
build-and-publish:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717

1818
name: Build a Python package and upload it to PyPI / Test PyPI
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Set up Python
22-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v4
2323
with:
24-
python-version: 3.8
25-
24+
python-version: 3.9
25+
cache: "pipenv"
2626
- name: Install pipenv
2727
run: |
2828
python -m pip install --upgrade pip pipenv
2929
python --version; python -m pip --version; pipenv --version
30-
- id: cache-pipenv
31-
uses: actions/cache@v1
32-
with:
33-
path: ~/.local/share/virtualenvs
34-
key: ${{ runner.os }}-3.8-pipenv-${{ hashFiles('**/Pipfile.lock') }}
3530
- name: Setup project with pipenv
36-
if: steps.cache-pipenv.outputs.cache-hit != 'true'
3731
run: |
38-
pipenv install --dev
32+
pipenv --python 3.9 install --dev
3933
4034
- name: Build a Python package
4135
run: |
4236
pipenv run build
4337
4438
- name: Archive the built Python package
45-
uses: actions/upload-artifact@v2
39+
uses: actions/upload-artifact@v3
4640
with:
4741
name: smartmeter-datacollector-py
4842
path: dist/*
4943

5044
- name: Publish the Python package to Test PyPI
5145
if: github.ref == 'refs/heads/master'
52-
uses: pypa/gh-action-pypi-publish@v1.4.2
46+
uses: pypa/gh-action-pypi-publish@v1.8.6
5347
with:
5448
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
5549
repository_url: https://test.pypi.org/legacy/
5650
skip_existing: true
5751

5852
- name: Publish the Python package to PyPI
5953
if: startsWith(github.ref, 'refs/tags')
60-
uses: pypa/gh-action-pypi-publish@v1.4.2
54+
uses: pypa/gh-action-pypi-publish@v1.8.6
6155
with:
6256
password: ${{ secrets.PYPI_API_TOKEN }}
6357

6458
- name: Get the tag name
6559
id: tag-name
6660
if: startsWith(github.ref, 'refs/tags')
67-
uses: olegtarasov/get-tag@v2.1.1
61+
uses: olegtarasov/get-tag@v2.1.2
6862

6963
- name: Create a new release
7064
if: startsWith(github.ref, 'refs/tags')
71-
uses: ncipollo/release-action@v1.8.8
65+
uses: ncipollo/release-action@v1.12.0
7266
with:
7367
allowUpdates: true
7468
artifacts: dist/*.tar.gz,dist/*.whl

.github/workflows/python-code-checks.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,42 @@ name: Python code checks
33
on:
44
push:
55
branches:
6-
- '**'
6+
- "**"
77
pull_request:
88
branches:
99
- master
1010
workflow_dispatch:
1111

1212
jobs:
1313
check_python_code:
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-22.04
1515
strategy:
1616
matrix:
17-
python-version: [ '3.7', '3.8', '3.9' ]
17+
python-version: ["3.8", "3.9", "3.10"]
1818

1919
name: Running Python code checks with Python ${{ matrix.python-version }}
2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v1
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: ${{ matrix.python-version }}
26-
26+
cache: "pipenv"
2727
- name: Install pipenv
2828
run: |
2929
python -m pip install --upgrade pip pipenv
3030
python --version; python -m pip --version; pipenv --version
31-
- name: Adjust Python version in Pipfile
32-
run: |
33-
sed -i 's/^python_version = .*/python_version = "${{ matrix.python-version }}"/' Pipfile
34-
cat Pipfile
35-
- id: cache-pipenv
36-
uses: actions/cache@v1
37-
with:
38-
path: ~/.local/share/virtualenvs
39-
key: ${{ runner.os }}-${{ matrix.python-version }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
4031
- name: Setup project with pipenv
41-
if: steps.cache-pipenv.outputs.cache-hit != 'true'
4232
run: |
43-
pipenv install --dev
33+
pipenv --python ${{ matrix.python-version }} install --dev
4434
4535
- name: Check code style
4636
run: |
4737
pipenv run format_check
4838
- name: Check import order
4939
run: |
5040
pipenv run isort_check
51-
- name: Lint with pylint
41+
- name: Lint with pylint
5242
run: |
5343
pipenv run lint_check
5444
- name: Run unit tests

Pipfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
aioserial = "~=1.3.0"
8-
asyncio-mqtt = "~=0.10.0"
9-
gurux-dlms = "==1.0.107"
7+
aioserial = "~=1.3.1"
8+
asyncio-mqtt = "~=0.16.1"
9+
gurux-dlms = "==1.0.143"
1010

1111
[dev-packages]
1212
autopep8 = "*"
@@ -15,31 +15,29 @@ isort = "*"
1515
licenseheaders = "*"
1616
pipenv-setup = "*"
1717
pylint = "*"
18+
pytest = "*"
19+
pytest-asyncio = "*"
20+
pytest-mock = "*"
1821
setuptools = "*"
1922
stdeb = {version="*", markers="sys_platform == 'linux'"}
2023
twine = "*"
24+
vistir = "~=0.6.1"
2125
wheel = "*"
22-
pytest = "*"
23-
pytest-mock = "*"
24-
pytest-asyncio = "*"
25-
26-
[requires]
27-
python_version = "3.8"
2826

2927
[scripts]
3028
build = "bash ./scripts/build.sh"
3129
build_check = "twine check dist/*"
32-
build_srcdeb = "bash ./scripts/build_srcdeb.sh"
3330
build_deb = "bash ./scripts/build_deb.sh"
31+
build_srcdeb = "bash ./scripts/build_srcdeb.sh"
3432
clean = "rm -rf .eggs build dist deb_dist smartmeter_datacollector.egg-info"
3533
debianize = "bash ./scripts/debianize.sh"
36-
format_check = "autopep8 --diff -r --aggressive smartmeter_datacollector/"
3734
format = "autopep8 --in-place -r --aggressive smartmeter_datacollector/"
35+
format_check = "autopep8 --diff -r --aggressive smartmeter_datacollector/"
3836
isort = "isort ."
3937
isort_check = "isort --check ."
38+
license = "licenseheaders -t .copyright.tmpl --ext py --current-year --owner 'Supercomputing Systems AG' --projname 'smartmeter-datacollector'"
4039
lint = "pylint smartmeter_datacollector/"
4140
lint_check = "pylint smartmeter_datacollector/ --exit-zero"
42-
license = "licenseheaders -t .copyright.tmpl --ext py --current-year --owner 'Supercomputing Systems AG' --projname 'smartmeter-datacollector'"
4341
setup = "pipenv-setup sync"
4442
setup_check = "pipenv-setup check"
4543
test = "pytest"

0 commit comments

Comments
 (0)