Skip to content

Commit

Permalink
Merge pull request #16 from hokus15/develop
Browse files Browse the repository at this point in the history
build(actions): replace travis by github actions
  • Loading branch information
hokus15 authored Mar 24, 2024
2 parents 94955b5 + 6c0939c commit d7c4faa
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 36 deletions.
4 changes: 0 additions & 4 deletions .cz.toml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "06:00"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
time: "06:15"
commit-message:
prefix: "build"
include: "scope"
labels:
- dependencies
open-pull-requests-limit: 10
rebase-strategy: auto
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test & Release
on:
push:
branches:
- master
jobs:
test:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8 .
- name: Test with unittest
run: |
python -m unittest discover -s test -p "test_*.py"
release:
name: Semantic Release
runs-on: ubuntu-latest
concurrency: push
needs: test
permissions:
contents: write
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing in PyPi
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v9.1.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package distributions to GitHub Releases
id: github-release
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
branches:
- '!master'
pull_request:
jobs:
test:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8 .
- name: Test with unittest
run: |
python -m unittest discover -s test -p "test_*.py"
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./test",
"-p",
"test*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
}
2 changes: 1 addition & 1 deletion iotconnect/monitors/gps/gps_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def monitor(self):
})
self._previous_latitude = gpsd.fix.latitude
self._previous_longitude = gpsd.fix.longitude
self._log.info(json.dumps(fix))
self._log.info("type: gps fix, data: %s", json.dumps(fix))
return {'location': fix}
else:
self._handle_no_fix('Low accuracy: it\'s +/- {} m but +/- {} m required'
Expand Down
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "iotconnect"
version = "0.4.1"
authors = [
{name = "Jordi Morell", email = "hokus@hotmail.com"},
]
description = "Extensible Internet Of Things integration service written in Python that can be run in a Raspberry Pi Zero W."
readme = "README.md"
requires-python = ">=3.7"
license = {text = "MIT"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"requests==2.31.0",
]

[tool.semantic_release]
logging_use_named_masks = true
tag_format = "v{version}"
commit_parser = "angular"
commit_author = "semantic-release <semantic-release>"
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
build_command = """
python -m pip install build~=0.10.0
python -m build .
"""
major_on_zero = true
assets = []
version_variables = ["iotconnect/__version__.py:__version__"]
version_toml = ["pyproject.toml:project.version"]

[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
upload_to_vcs_release = true
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

Empty file added test/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions test/test_iotconnect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import unittest


class IOTConnectTestCase(unittest.TestCase):

def test_ioconnect(self):
self.assertTrue(True)


if __name__ == '__main__':
unittest.main()

0 comments on commit d7c4faa

Please sign in to comment.