Skip to content

Commit

Permalink
Merge pull request #18 from bitranox/development
Browse files Browse the repository at this point in the history
v1.6.0
--------
2021-12-19: feature release
    - update github actions
    - fix "setup.py test"
    - fix typing
  • Loading branch information
bitranox committed Dec 18, 2021
2 parents e501c35 + 7c8fdac commit 9207477
Show file tree
Hide file tree
Showing 34 changed files with 784 additions and 371 deletions.
10 changes: 5 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# (boolean, default False): whether to measure branch coverage in addition to statement coverage
branch = True

omit =
venv/*
tests/*
setup.py


[report]
# Regexes for lines to exclude from consideration
Expand All @@ -29,8 +34,3 @@ exclude_lines=

ignore_errors = True

omit =
venv/*
tests/*
setup.py
conf_fake_winreg.py
2 changes: 1 addition & 1 deletion .docs/README_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fake_winreg
===========


Version v1.5.7 as of 2021-12-16 see `Changelog`_
Version v1.6.0 as of 2021-12-18 see `Changelog`_


.. include:: ./badges.rst
Expand Down
10 changes: 6 additions & 4 deletions .docs/badges.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
|travis_build| |license| |jupyter| |pypi|
|build_badge| |license| |jupyter| |pypi| |black|

|codecov| |better_code| |cc_maintain| |cc_issues| |cc_coverage| |snyk|


.. |travis_build| image:: https://img.shields.io/travis/bitranox/fake_winreg/master.svg
:target: https://travis-ci.org/bitranox/fake_winreg

.. |build_badge| image:: https://github.com/bitranox/fake_winreg/actions/workflows/python-package.yml/badge.svg
:target: https://github.com/bitranox/fake_winreg/actions/workflows/python-package.yml


.. |license| image:: https://img.shields.io/github/license/webcomics/pywine.svg
:target: http://en.wikipedia.org/wiki/MIT_License

.. |jupyter| image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/bitranox/fake_winreg/master?filepath=fake_winreg.ipynb
:target: https://mybinder.org/v2/gh/bitranox/fake_winreg/master?filepath=fake_winreg.ipynb

.. for the pypi status link note the dashes, not the underscore !
.. |pypi| image:: https://img.shields.io/pypi/status/fake-winreg?label=PyPI%20Package
Expand Down
2 changes: 1 addition & 1 deletion .docs/commandline_help.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. code-block:: bash
.. code-block::
Usage: fake_winreg [OPTIONS] COMMAND [ARGS]...
Expand Down
8 changes: 4 additions & 4 deletions .docs/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FUNCTION

test winreg functions on a fake registry on windows and linux, without messing up Your real registry.

Fully type annotated and documented, so You can enjoy the type hints in Your favorit IDE
Fully type annotated and documented, so You can enjoy the type hints in Your favorite IDE

This is perfect for TDD, creating registry related code and covering most issues before You hit a real registry with Your tests.

Expand All @@ -27,11 +27,11 @@ LIMITATIONS
That means You can read/write/delete Keys and values in the fake registry,
even if You opened the key with access right "KEY_READ".
You can Delete Keys and Values in HKEY_LOCAL_MACHINE and so on, even if You dont have Admin Rights.
That is not an security issue, since You test against a fake registry - and You test mostly Your own software.
This is not an security issue, since You test against a fake registry - and You test mostly Your own software.
If You need it, contributions are welcome ! (somehow it would make sense for TDD to have it)
- you can not dump a real registry at the moment and save it, in order to use it as a fake registry - that means
- at the moment you can not dump a real registry and save it, in order to use it as a fake registry - that means
all the keys You need, You have to set manually at the moment.
I will polish up my old project "fingerprint" and make a compatible file format to dump / read / write registry branches.
if I catch the time, I will polish up my old project "fingerprint" and make a compatible file format to dump / read / write registry branches.
- some (few) winreg functions are not implemented - if You miss out something, give me a note, i will integrate it
- obviously we can not connect to the registry of another windows computer over the network
- KEY_WOW64_32KEY is not supported. We show always the same ...
Expand Down
8 changes: 4 additions & 4 deletions .docs/installation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- Before You start, its highly recommended to update pip and setup tools:


.. code-block:: bash
.. code-block::
python -m pip --upgrade pip
python -m pip --upgrade setuptools
Expand All @@ -12,14 +12,14 @@
- to install the latest version from github via pip:


.. code-block:: bash
.. code-block::
python -m pip install --upgrade git+https://github.com/bitranox/fake_winreg.git
- include it into Your requirements.txt:

.. code-block:: bash
.. code-block::
# Insert following line in Your requirements.txt:
# for the latest Release on pypi:
Expand All @@ -34,7 +34,7 @@
- to install the latest development version from source code:

.. code-block:: bash
.. code-block::
# cd ~
$ git clone https://github.com/bitranox/fake_winreg.git
Expand Down
2 changes: 1 addition & 1 deletion .docs/installation_via_pypi.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- to install the latest release from PyPi via pip (recommended):

.. code-block:: bash
.. code-block::
python -m pip install --upgrade fake_winreg
4 changes: 2 additions & 2 deletions .docs/tested_under.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tested on linux "bionic" with python 3.6, 3.7, 3.8, 3.9-dev, pypy3 - architectures: amd64, ppc64le, s390x, arm64
tested on recent linux with python 3.6, 3.7, 3.8, 3.9, 3.10.0, pypy-3.8 - architectures: amd64

`100% code coverage <https://codecov.io/gh/bitranox/fake_winreg>`_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows <https://travis-ci.org/bitranox/fake_winreg>`_, automatic daily builds and monitoring
`100% code coverage <https://codecov.io/gh/bitranox/fake_winreg>`_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows <https://github.com/bitranox/fake_winreg/actions/workflows/python-package.yml>`_, automatic daily builds and monitoring
255 changes: 255 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master, development ]
pull_request:
branches: [ master, development ]
release:
branches: [ master, development ]
# release types see : https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release
# he prereleased type will not trigger for pre-releases published from draft releases, but the published type will trigger.
# If you want a workflow to run when stable and pre-releases publish, subscribe to published instead of released and prereleased.
types: [published]

schedule:
# * is a special character in YAML, so you have to quote this string
# | minute | hour (UTC) | day of month (1-31) | month (1-2) | day of week (0-6 or SUN-SAT)
# every day at 05:40 am UTC - avoid 05:00 because of high load at the beginning of every hour
- cron: '40 5 * * *'


jobs:

build:
runs-on: ${{ matrix.os }}

env:
# prefix before commands - used for wine, there the prefix is "wine"
cPREFIX: ""
# command to launch python interpreter (it's different on macOS, there we need python3)
cPYTHON: "python"
# command to launch pip (it's different on macOS, there we need pip3)
cPIP: "python -m pip"
# switch off wine fix me messages
WINEDEBUG: fixme-all

# PYTEST
PYTEST_DO_TESTS: "True"

# FLAKE8 tests
DO_FLAKE8_TESTS: "True"

# MYPY tests
MYPY_DO_TESTS: "True"
MYPY_OPTIONS: "--follow-imports=normal --ignore-missing-imports --implicit-reexport --install-types --no-warn-unused-ignores --non-interactive --strict"
MYPYPATH: "./fake_winreg/3rd_party_stubs"

# coverage
DO_COVERAGE: "True"
DO_COVERAGE_UPLOAD_CODECOV: "True"
DO_COVERAGE_UPLOAD_CODE_CLIMATE: "True"

# package name
PACKAGE_NAME: "fake_winreg"
# the registered CLI Command
CLI_COMMAND: "fake_winreg"
# the source file for rst_include (rebuild rst file includes)
RST_INCLUDE_SOURCE: "./.docs/README_template.rst"
# the target file for rst_include (rebuild rst file includes)
RST_INCLUDE_TARGET: "./README.rst"
# make Code Coverage Secret available in Environment
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# make PyPi Password available in Environment
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}


strategy:
matrix:
include:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software

- os: windows-latest
python-version: 3.9
env:
cEXPORT: "SET"
BUILD_DOCS: "False"
DEPLOY_SDIST: "False"
DEPLOY_WHEEL: "False"
DEPLOY_TEST: "False"
MYPY_DO_TESTS: "True"
# Setup tests
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
# Test registered CLI Command
DO_CLI_TEST: "True"


- os: ubuntu-latest
python-version: "3.6"
env:
BUILD_DOCS: "False"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "False"
DO_CLI_TEST: "True"

- os: ubuntu-latest
python-version: "3.7"
env:
BUILD_DOCS: "False"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "False"
DO_CLI_TEST: "True"

- os: ubuntu-latest
python-version: "3.8"
env:
BUILD_DOCS: "False"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "False"
DO_CLI_TEST: "True"

- os: ubuntu-latest
python-version: "3.9"
env:
BUILD_DOCS: "False"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "False"
DO_CLI_TEST: "True"

- os: ubuntu-latest
python-version: "3.10.0"
env:
BUILD_DOCS: "True"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"

- os: ubuntu-latest
python-version: "pypy-3.8"
env:
BUILD_DOCS: "False"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "False"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "False"
DO_CLI_TEST: "True"

- os: macos-latest
python-version: 3.9
env:
cPREFIX: "" # prefix before commands - used for wine, there the prefix is "wine"
cPYTHON: "python3" # command to launch python interpreter (it's different on macOS, there we need python3)
cPIP: "python3 -m pip" # command to launch pip (it's different on macOS, there we need pip3)
BUILD_DOCS: "False"
DEPLOY_SDIST: "True"
DEPLOY_WHEEL: "True"
DEPLOY_TEST: "True"
MYPY_DO_TESTS: "True"
# Setup tests
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
# Test registered CLI Command
DO_CLI_TEST: "True"


name: "${{ matrix.os }} Python ${{ matrix.python-version }}"

steps:
# see : https://github.com/actions/checkout
- uses: actions/checkout@v2

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

- name: Install dependencies
# see: https://github.community/t/github-actions-new-bug-unable-to-create-environment-variables-based-matrix/16104/3
env: ${{ matrix.env }} # make matrix env variables accessible
# lib_cicd_github install: upgrades pip, setuptools, wheel and pytest-pycodestyle
run: |
${{ env.cPIP }} install git+https://github.com/bitranox/lib_cicd_github.git
lib_cicd_github install
- name: Debug - printenv and colortest
env:
# make matrix env variables accessible
${{ matrix.env }}
shell: bash
run: |
# export for current step
export "BRANCH=$(lib_cicd_github get_branch)"
# export for subsequent steps
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
log_util --level=SPAM "working on branch $BRANCH"
log_util --level=SPAM "GITHUB_REF $GITHUB_REF"
log_util --level=VERBOSE "github.base_ref: ${{ github.base_ref }}"
log_util --level=VERBOSE "github.event: ${{ github.event }}"
log_util --level=VERBOSE "github.event_name: ${{ github.event_name }}"
log_util --level=VERBOSE "github.head_ref: ${{ github.head_ref }}"
log_util --level=VERBOSE "github.job: ${{ github.job }}"
log_util --level=VERBOSE "github.ref: ${{ github.ref }}"
log_util --level=VERBOSE "github.repository: ${{ github.repository }}"
log_util --level=VERBOSE "github.repository_owner: ${{ github.repository_owner }}"
log_util --level=VERBOSE "runner.os: ${{ runner.os }}"
log_util --level=VERBOSE "matrix.python-version: ${{ matrix.python-version }}"
printenv
log_util --colortest
- name: Run Tests
env:
# make matrix env variables accessible
${{ matrix.env }}
shell: bash
run: |
# export for current step
export "BRANCH=$(lib_cicd_github get_branch)"
# export for subsequent steps
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
# run the tests
lib_cicd_github script
- name: After Success
env:
${{matrix.env }}
shell: bash
continue-on-error: true
run: |
lib_cicd_github after_success
- name: Deploy
env:
# see: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
# see : https://github.com/rlespinasse/github-slug-action
# make matrix env variables accessible
${{matrix.env }}
shell: bash
run: |
lib_cicd_github deploy
ls -l ./dist
Loading

0 comments on commit 9207477

Please sign in to comment.