Skip to content

Commit

Permalink
Merge pull request #6 from gpongelli/complete_workflow
Browse files Browse the repository at this point in the history
Complete workflow
  • Loading branch information
gpongelli authored Feb 23, 2023
2 parents feaf519 + 515b874 commit b6d84e7
Show file tree
Hide file tree
Showing 8 changed files with 1,592 additions and 1,034 deletions.
137 changes: 121 additions & 16 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,167 @@ on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, main ]
tags:
- '*.*.*'
pull_request:
branches: [ master, main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write


# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
strategy:
fail-fast: false
matrix:
python-versions: [3.8, 3.9, "3.10", "3.11"]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
poetry-version: [ "1.3" ]
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
os: [ubuntu-20.04, ubuntu-22.04] # dependency issues on macos-latest and windows-latest
os: [ubuntu-latest, windows-latest, macos-latest] # dependency issues on macos-latest and windows-latest
runs-on: ${{ matrix.os }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
- name: Install Poetry
run: pipx install poetry

# https://github.com/actions/setup-python
- uses: actions/setup-python@v4
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
python-version: ${{ matrix.python-versions }}
cache: 'poetry'
poetry-version: ${{ matrix.poetry-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry install --with devel --sync
python -m pip install --upgrade pip setuptools
poetry install --with devel --sync
# pip install poetry tox tox-gh-actions

- name: build documentation
run: poetry run tox -e docs
run: poetry run tox --skip-pkg-install -e docs

- name: linter checks with tox
run:
poetry run tox -e lint
poetry run tox --skip-pkg-install -e lint

- name: test with tox
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context
- name: test with tox - Windows
if: runner.os == 'Windows'
run:
poetry run tox -e py${{ matrix.python-versions }}
poetry run tox --skip-pkg-install -e py${{ matrix.python-version }}-win

- name: test with tox - Linux
if: runner.os == 'Linux'
run:
poetry run tox --skip-pkg-install -e py${{ matrix.python-version }}-lin

- name: test with tox - MacOS
if: runner.os == 'macOS'
run:
poetry run tox --skip-pkg-install -e py${{ matrix.python-version }}-mac

- name: list files
run: ls -l .

# https://github.com/codecov/codecov-action
# Easily upload coverage reports to Codecov from GitHub Actions
- uses: codecov/codecov-action@v3
if: runner.os == 'macOS'
with:
fail_ci_if_error: true
files: ./xml_coverage_py${{ matrix.python-versions }}.xml
token: ${{ secrets.CODECOV_TOKEN }}
files: ./xml_coverage_py${{ matrix.python-version }}-mac.xml

# This workflow contains a single job called "release"
release:
needs: [ test ]
name: Create Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04

strategy:
matrix:
python-version: [ "3.11" ]
poetry-version: [ "1.3" ]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# https://github.com/BinPar/read-conventional-commit-changelog
- name: Get Changelog Entry
id: changelog
uses: BinPar/[email protected]

# https://github.com/actions/setup-python
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
poetry install --with devel --sync
# Build and publish documentation
- name: Setup Pages
uses: actions/configure-pages@v2

- name: build documentation
run: poetry run tox --skip-pkg-install -e docs

- name: Upload doc artifact
uses: actions/upload-pages-artifact@v1
with:
path: './docs/build/html'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

- name: Build wheels and source tarball
run: >-
poetry build
- name: show temporary files
run: >-
ls -l
# https://github.com/softprops/action-gh-release
- name: create github release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.make_gh_release_token }}
body: ${{ steps.changelog.outputs.version-changelog }}
files: dist/*.whl
draft: false
prerelease: false

# https://github.com/pypa/gh-action-pypi-publish
- name: publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.pypi_username }}
password: ${{ secrets.pypi_password }}
skip_existing: true
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml → .github/workflows/docs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# The type of runner that the job will run on
strategy:
matrix:
python-versions: [3.9]
python-version: [3.9]
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
os: [ubuntu-20.04] # dependency issues on macos-latest and windows-latest
runs-on: ${{ matrix.os }}
Expand All @@ -45,7 +45,7 @@ jobs:
# https://github.com/actions/setup-python
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-versions }}
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/preview.yml → .github/workflows/preview
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

strategy:
matrix:
python-versions: [3.9]
python-version: [3.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -33,7 +33,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-versions }}
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
Expand All @@ -44,7 +44,7 @@ jobs:

- name: test with tox
run:
poetry run tox -e py${{ matrix.python-versions }}
poetry run tox -e py${{ matrix.python-version }}

- name: Build wheels and source tarball
run: |
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/release.yml → .github/workflows/release
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ jobs:
# This workflow contains a single job called "release"
release:
name: Create Release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
python-versions: [3.9]
python-version: [ "3.11" ]
poetry-version: [ "1.3" ]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -43,15 +44,15 @@ jobs:
id: changelog
uses: BinPar/[email protected]

# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
- name: Install Poetry
run: pipx install poetry

# https://github.com/actions/setup-python
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-versions }}
cache: 'poetry'
python-version: ${{ matrix.python-version }}

- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install dependencies
run: |
Expand All @@ -63,7 +64,7 @@ jobs:
uses: actions/configure-pages@v2

- name: build documentation
run: poetry run tox -e docs
run: poetry run tox --skip-pkg-install -e docs

- name: Upload doc artifact
uses: actions/upload-pages-artifact@v1
Expand Down
22 changes: 10 additions & 12 deletions broadlink_listener/cli_tools/smartir_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ def __init__( # pylint: disable=too-many-branches,too-many-statements

except KeyError as key_err:
raise click.exceptions.UsageError(f"Missing mandatory field in json file: {key_err}") from None
else:
self._setup_combinations()
self.__temperature = ''
self.__operation_mode = ''
self.__fan_mode = ''
self.__swing_mode = ''

self._setup_combinations()
self.__temperature = ''
self.__operation_mode = ''
self.__fan_mode = ''
self.__swing_mode = ''
self._setup_signal_handler()

@property
Expand All @@ -203,8 +203,6 @@ def _setup_signal_handler(self):
signal.signal(signal.SIGTERM, self._signal_handler)
if _system == 'windows':
signal.signal(signal.SIGBREAK, self._signal_handler) # pylint: disable=no-member
signal.signal(signal.CTRL_C_EVENT, self._signal_handler) # pylint: disable=no-member
signal.signal(signal.CTRL_BREAK_EVENT, self._signal_handler) # pylint: disable=no-member

def _signal_handler(self, _signumber, _frame):
self._save_partial_dict()
Expand Down Expand Up @@ -411,10 +409,10 @@ def _save_partial_dict(self):
del _no_off['commands']['off']
except KeyError:
return
else:
with open(_modified_file_name, 'w', encoding='utf-8') as out_file:
json.dump(_no_off[_DictKeys.COMMANDS.value], out_file, indent=2)
self.__partial_inc += 1

with open(_modified_file_name, 'w', encoding='utf-8') as out_file:
json.dump(_no_off[_DictKeys.COMMANDS.value], out_file, indent=2)
self.__partial_inc += 1

def _load_partial_dict(self):
_previous = glob.glob(
Expand Down
Loading

0 comments on commit b6d84e7

Please sign in to comment.