-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from scs/feature/upgrade
* update dependencies * add Python 3.10 code checks * update and fix Github workflows & scripts * update documentation
- Loading branch information
Showing
11 changed files
with
709 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,58 +3,48 @@ name: Build a Debian package | |
on: | ||
push: | ||
branches: | ||
- '**' | ||
- "**" | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build-deb: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
os: [ 'debian', 'raspios' ] | ||
os: ["debian", "raspios"] | ||
include: | ||
- os: debian | ||
dist: buster | ||
dist: bullseye | ||
arch: amd64 | ||
keyring_cmd: sudo apt-get install -y debian-archive-keyring | ||
- os: raspios | ||
dist: buster | ||
dist: bullseye | ||
arch: armhf | ||
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 | ||
|
||
name: Build a Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/checkout@v3 | ||
- name: Update apt cache | ||
run: | | ||
sudo apt-get update | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
python-version: 3.9 | ||
cache: "pipenv" | ||
- name: Install pipenv | ||
run: | | ||
python -m pip install --upgrade pip pipenv | ||
python --version; python -m pip --version; pipenv --version | ||
- name: Cache pipenv environment | ||
id: cache-pipenv | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.local/share/virtualenvs | ||
key: ${{ runner.os }}-3.8-pipenv-${{ hashFiles('**/Pipfile.lock') }} | ||
- name: Setup project with pipenv | ||
if: steps.cache-pipenv.outputs.cache-hit != 'true' | ||
run: | | ||
pipenv install --dev | ||
pipenv --python 3.9 install --dev | ||
- name: Prepare to build a Debian source package | ||
run: | | ||
sudo apt-get -y install python3-all debhelper dh-python rename | ||
|
@@ -65,10 +55,11 @@ jobs: | |
- name: Cache pbuilder chroot | ||
id: cache-pbuilder-chroot | ||
uses: actions/cache@v1 | ||
uses: actions/cache@v3 | ||
with: | ||
path: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-base.tgz | ||
key: ${{ runner.os }}-pbuilder-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-${{ hashFiles('**/Pipfile.lock') }} | ||
|
||
- name: Prepare the pbuilder chroot for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | ||
if: steps.cache-pbuilder-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-chroot.outputs.cache-hit != 'true' | ||
run: | | ||
|
@@ -86,13 +77,13 @@ jobs: | |
sudo rename "s/_all\./_${{ matrix.arch }}\./" /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb | ||
- name: Archive the built Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-deb | ||
path: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb | ||
|
||
- name: Archive the additional Debian package files for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-packagefiles | ||
path: | | ||
|
@@ -102,11 +93,11 @@ jobs: | |
- name: Get the tag name | ||
id: tag-name | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: olegtarasov/[email protected].1 | ||
uses: olegtarasov/[email protected].2 | ||
|
||
- name: Create a new release | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: ncipollo/release-action@v1.8.8 | ||
uses: ncipollo/release-action@v1.12.0 | ||
with: | ||
allowUpdates: true | ||
artifacts: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,72 +3,66 @@ name: Publish Python package to PyPI / Test PyPI | |
on: | ||
push: | ||
branches: | ||
- '**' | ||
- "**" | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
|
||
name: Build a Python package and upload it to PyPI / Test PyPI | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
python-version: 3.9 | ||
cache: "pipenv" | ||
- name: Install pipenv | ||
run: | | ||
python -m pip install --upgrade pip pipenv | ||
python --version; python -m pip --version; pipenv --version | ||
- id: cache-pipenv | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.local/share/virtualenvs | ||
key: ${{ runner.os }}-3.8-pipenv-${{ hashFiles('**/Pipfile.lock') }} | ||
- name: Setup project with pipenv | ||
if: steps.cache-pipenv.outputs.cache-hit != 'true' | ||
run: | | ||
pipenv install --dev | ||
pipenv --python 3.9 install --dev | ||
- name: Build a Python package | ||
run: | | ||
pipenv run build | ||
- name: Archive the built Python package | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: smartmeter-datacollector-py | ||
path: dist/* | ||
|
||
- name: Publish the Python package to Test PyPI | ||
if: github.ref == 'refs/heads/master' | ||
uses: pypa/gh-action-pypi-publish@v1.4.2 | ||
uses: pypa/gh-action-pypi-publish@v1.8.6 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
- name: Publish the Python package to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@v1.4.2 | ||
uses: pypa/gh-action-pypi-publish@v1.8.6 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
- name: Get the tag name | ||
id: tag-name | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: olegtarasov/[email protected].1 | ||
uses: olegtarasov/[email protected].2 | ||
|
||
- name: Create a new release | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: ncipollo/release-action@v1.8.8 | ||
uses: ncipollo/release-action@v1.12.0 | ||
with: | ||
allowUpdates: true | ||
artifacts: dist/*.tar.gz,dist/*.whl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.