Skip to content

Commit

Permalink
chore: prepare release for v1.1.0 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang authored May 16, 2024
1 parent 96cc622 commit c6c51e0
Show file tree
Hide file tree
Showing 48 changed files with 2,713 additions and 599 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.devcontainer/
build/
dist/
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
extend-ignore = E266, E501, E203
max-line-length = 88
max-complexity = 16
max-complexity = 16
40 changes: 40 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build wheel for release

on:
release:
types: [published]

permissions:
contents: write # upload artifacts requires this permission

jobs:
build_wheel:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Setup python environment
uses: actions/setup-python@v5
with:
# use the minimum py ver we support to
# generate the wheel.
python-version: "3.8"

- name: Build wheel and calculate checksum
run: |
python3 -m pip install -q -U pip
pip install -q -U hatch
hatch build -t wheel
for WHL in dist/*.whl; \
do \
sha256sum ${WHL} | sed -E "s@(\w+)\s+.*@sha256:\1@" > \
${WHL}.checksum; \
done
- name: Upload built wheel as release asset
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.whl
dist/*.checksum
121 changes: 121 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: test CI

on:
pull_request:
branches:
- main
# only trigger unit test CI when src or tests changed
paths:
- "src/**"
- "tests/**"
- ".github/workflows/test.yaml"
push:
branches:
- main
# only trigger unit test CI when src or tests changed
paths:
- "src/**"
- "tests/**"
- ".github/workflows/test.yaml"
# allow the test CI to be manually triggerred
workflow_dispatch:

jobs:
pytest_with_coverage_on_supported_os:
strategy:
fail-fast: true
matrix:
# currently we only need to ensure it is running on the following OS
# with OS-shipped python interpreter.
os: ["ubuntu-20.04", "ubuntu-22.04"]
include:
- os: ubuntu-22.04
python_version: "3.10"
- os: ubuntu-20.04
python_version: "3.8"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
# sonarcloud needs main branch's ref
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
cache: "pip"

- name: Install package
run: |
python -m pip install -q -U pip
pip install -q .[dev]
- name: Execute pytest with coverage
run: |
coverage run -m pytest --junit-xml=test_result/pytest.xml
coverage xml -o test_result/coverage.xml
# export the coverage report to the comment!
- name: Add coverage report to PR comment
continue-on-error: true
uses: MishaKav/[email protected]
with:
pytest-xml-coverage-path: test_result/coverage.xml
junitxml-path: test_result/pytest.xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

pytest_on_supported_python_vers:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout commit
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install package
run: |
python -m pip install -q -U pip
pip install -q .[dev]
- name: Execute pytest
run: pytest

python_lint_check:
runs-on: ubuntu-22.04
timeout-minutes: 3
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout commit
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install check dependencies
run: |
python -m pip install -q -U pip
pip install -q .[dev]
- name: Check code linting
run: |
black --check src
flake8 src
169 changes: 162 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,164 @@
.devcontainer/
cache
coverage
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
mypy_cache/
otaclient_iot_logging_server/_version.py
__pycache__/
venv/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# local vscode settings
.devcontainer
.vscode
4 changes: 4 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"MD013": false
"MD041": false
"MD024":
"siblings_only": true
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-mock-methods
- id: python-use-type-annotations
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==24.2.6
- flake8-comprehensions
- flake8-simplify
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.8.0"
hooks:
- id: pyproject-fmt
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
additional_dependencies: ["tox>=4.9"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.40.0
hooks:
- id: markdownlint
args: ["-c", ".markdownlint.yaml", "--fix"]
ci:
autoupdate_schedule: monthly
Loading

2 comments on commit c6c51e0

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/otaclient_iot_logging_server
   __init__.py30100% 
   __main__.py18194%49
   _common.py150100% 
   _log_setting.py271062%63, 65–66, 68–69, 73–74, 77–78, 80
   _utils.py54296%73, 137
   _version.py80100% 
   aws_iot_logger.py1015545%65–67, 69–72, 75, 81–87, 90–92, 95–100, 104–107, 111–113, 116–118, 121–126, 139, 145–147, 149–153, 157, 197, 204–207
   boto3_session.py35974%50, 58–59, 61, 78–79, 83, 85, 93
   config_file_monitor.py44686%64–66, 83–85
   configs.py45197%74
   ecu_info.py37197%75
   greengrass_config.py97594%155, 266–269
   log_proxy_server.py37878%46, 73–75, 81–83, 86
TOTAL5219881% 

Tests Skipped Failures Errors Time
38 0 💤 0 ❌ 0 🔥 12.698s ⏱️

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/otaclient_iot_logging_server
   __init__.py30100% 
   __main__.py18194%49
   _common.py150100% 
   _log_setting.py271062%63, 65–66, 68–69, 73–74, 77–78, 80
   _utils.py53296%73, 137
   _version.py80100% 
   aws_iot_logger.py1005545%65–67, 69–72, 75, 81–87, 90–92, 95–100, 104–107, 111–113, 116–118, 121–126, 139, 145–147, 149–153, 157, 197, 204–207
   boto3_session.py35974%50, 58–59, 61, 78–79, 83, 85, 93
   config_file_monitor.py43686%64–66, 83–85
   configs.py44197%74
   ecu_info.py37197%75
   greengrass_config.py96594%155, 266–269
   log_proxy_server.py37878%46, 73–75, 81–83, 86
TOTAL5169881% 

Tests Skipped Failures Errors Time
38 0 💤 0 ❌ 0 🔥 12.612s ⏱️

Please sign in to comment.