Skip to content

Commit

Permalink
Merge pull request #15 from vroncevic/dev
Browse files Browse the repository at this point in the history
[gen_coap_service] #3 #4 #5 #9 #12 #13 #14 refactor done, updated docs, GHW
  • Loading branch information
vroncevic committed May 7, 2022
2 parents 66ca1f4 + 78acd17 commit 5f06cdb
Show file tree
Hide file tree
Showing 157 changed files with 20,771 additions and 528 deletions.
27 changes: 27 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2.1
orbs:
python: circleci/python@1.5.0
jobs:
build_and_test:
docker:
- image: cimg/python:3.9
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
name: Install mock
command: pip install mock
- run:
name: Install pytest
command: pip install pytest
- run:
name: Run tests
command: python -m pytest
workflows:
gen_coap_service:
jobs:
- build_and_test:
filters:
branches:
only: master
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[**.py]
[**.*]
indent_style = tab
tab_width = 4
1 change: 1 addition & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git config -f .gitconfig core.hooksPath .githooks
11 changes: 11 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
#
# @brief Add project name
# @version ver.1.0.0
# @date Thu Apr 08 03:47:43 AM CET 2021
# @company None, free software to use 2021
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

PRO_NAME=$(basename `git rev-parse --show-toplevel`)
echo "[$PRO_NAME] ""$(cat $1)" > "$1"
49 changes: 49 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
#
# @brief Add project name
# @version ver.1.0.0
# @date Thu Apr 08 03:47:43 AM CET 2021
# @company None, free software to use 2021
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)

# Redirect output to stderr.
exec 1>&2

# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/gen_coap_service_bug_report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Bug report
name: 🐛 Bug report
about: Create a report to help us improve
title: "[gen_coap_service]"
labels: bug
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/gen_coap_service_feature_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Feature request
name: 💡 Feature request
about: Suggest an idea for this project
title: "[gen_coap_service]"
labels: enhancement
Expand Down
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
🔥 Changes/Fixes # .

Changes proposed in this pull requests

-

-

-

6 changes: 3 additions & 3 deletions .github/workflows/gen_coap_service_docker_checker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gen_coap_service docker checker
name: gen_coap_service_docker_checker
on:
push:
branches: [ master ]
Expand All @@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
- name: gen_coap_service_docker_checker
id: docker_checker
run: |
echo Building Docker image
build_transcript=$(docker build . --file Dockerfile --tag gen_coap_service:latest)
[[ "$build_transcript" == *"Successfully"* ]] && echo ::set-output name=status::success || echo ::set-output name=status::failure
- name: Check on failures
- name: check on failures
if: steps.docker_checker.outputs.status == 'failure'
run: exit 1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python package gen_coap_service
name: gen_coap_service_package_checker
on:
push:
branches: [ master ]
Expand All @@ -21,14 +21,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.6, 3.7, 3.8]
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8
- name: lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Install Python2 Package gen_coap_service
name: gen_coap_service_python2_build
on:
push:
branches: [ master ]
Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
- name: set up python
uses: actions/setup-python@v1
with:
python-version: '2.x'
Expand All @@ -30,6 +30,6 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements.txt
- name: Build and publish
- name: build python package
run: |
python setup.py --github sdist bdist_wheel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Install Python3 Package gen_coap_service
name: gen_coap_service_python3_build
on:
push:
branches: [ master ]
Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
- name: set up python
uses: actions/setup-python@v1
with:
python-version: '3.x'
Expand All @@ -30,6 +30,6 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements.txt
- name: Build and publish
- name: build python package
run: |
python setup.py --github sdist bdist_wheel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gen_coap_service py checker
name: gen_coap_service_python_checker
on:
push:
branches: [ master ]
Expand All @@ -15,22 +15,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check length of line in modules
- name: check length of line in modules
id: long_line_checker
run: |
echo Checking length of line in modules
modules_ok=0
modules=($(find gen_coap_service/ -type f -name '*.py' -exec echo '{}' \;))
for mod in "${modules[@]}"; do line_length=$(wc -L < "${mod}"); [[ $line_length -gt 80 ]] && modules_ok=1; done
[[ $modules_ok -eq 0 ]] && echo ::set-output name=status::success || echo ::set-output name=status::failure
- name: Check number of lines in modules
- name: check number of lines in modules
id: num_line_checker
run: |
echo Checking number of lines in modules
modules_ok=0
modules=($(find gen_coap_service/ -type f -name '*.py' -exec echo '{}' \;))
for mod in "${modules[@]}"; do line_numbers=$(wc -l < "${mod}"); [[ $line_numbers -gt 300 ]] && modules_ok=1; done
[[ $modules_ok -eq 0 ]] && echo ::set-output name=status::success || echo ::set-output name=status::failure
- name: Check on failures
- name: check on failures
if: steps.long_line_checker.outputs.status == 'failure' || steps.num_line_checker.outputs.status == 'failure'
run: exit 1
4 changes: 2 additions & 2 deletions .github/workflows/gen_coap_service_toc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: TOC Generator gen_coap_service
name: gen_coap_service_toc
on:
push:
paths:
- '**.md'
jobs:
generateTOC:
name: TOC Generator
name: gen_coap_service_toc
runs-on: ubuntu-latest
steps:
- uses: technote-space/toc-generator@v2
8 changes: 4 additions & 4 deletions .github/workflows/gen_coap_service_triage.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Triage gen_coap_service
name: gen_coap_service_triage
on:
issues:
types: [opened]
jobs:
commentOnNewIssues:
name: Comment On New Issues
name: gen_coap_service_triage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Comment On New Issues
- name: gen_coap_service_triage
uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: comment "[gen_coap_service] should be supported for Python 2.7, 3.5, 3.6, 3.7, 3.8"
args: comment "[gen_coap_service] should be supported for Python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9"
6 changes: 3 additions & 3 deletions .github/workflows/gen_coap_service_triage_label.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Triage gen_coap_service label
name: gen_coap_service_triage_label
on:
issues:
types: [opened]
jobs:
applyTriageLabel:
name: Apply Triage Label
name: gen_coap_service_triage_label
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Apply Triage Label
- name: gen_coap_service_triage_label
uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__pycache__/
*.py[cod]
*$py.class
.idea/
.vscode/
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
python:
version: 2.7
version: '3.7'
install:
- requirements: requirements.txt
sphinx:
Expand Down

0 comments on commit 5f06cdb

Please sign in to comment.