Serial Stream with HA and message delimiter #411
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MQTT IO CI | |
on: | |
- push | |
- pull_request | |
- release | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install | |
- name: Lint with pylint | |
run: poetry run pylint -d fixme mqtt_io | |
- name: Lint with mypy | |
run: poetry run mypy --show-error-codes --strict --no-warn-unused-ignores mqtt_io | |
- name: Test with behave | |
run: poetry run behave -t ~skip mqtt_io/tests/features | |
publish: | |
name: Publish to PyPI | |
if: github.event_name == 'release' && github.event.action == 'created' | |
runs-on: ubuntu-20.04 | |
needs: test | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install poetry | |
run: pip install poetry | |
- name: Build packages | |
run: poetry build | |
- name: Publish packages | |
uses: pypa/gh-action-pypi-publish@master | |
# if: startsWith(github.ref, 'refs/tags') | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
build_docker_image: | |
name: Build Docker Image | |
if: (github.event_name == 'release' && github.event.action == 'created') || github.event_name == 'push' | |
runs-on: ubuntu-20.04 | |
needs: test | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-qemu-action@v1 | |
- id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- if: github.event_name == 'release' && github.event.action == 'created' | |
run: | | |
# Remove prefix release | |
TAG_NAME=${GITHUB_REF##*/} | |
# Change slashes to hyphens | |
TAG_NAME=${TAG_NAME//\//-} | |
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t flyte/mqtt-io:${TAG_NAME} -t flyte/mqtt-io:latest --push . | |
- if: github.event_name == 'push' | |
run: | | |
# Remove prefix push | |
TAG_NAME=${GITHUB_REF##*/} | |
# Change slashes to hyphens | |
TAG_NAME=${TAG_NAME//\//-} | |
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t flyte/mqtt-io:${TAG_NAME} --push . | |
generate_docs: | |
name: Generate Documentation | |
if: github.event_name == 'push' | |
concurrency: generate_docs | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get branch names | |
id: branch-names | |
uses: tj-actions/branch-names@v8 | |
- name: Ensure we can checkout gh-pages for release (${{ steps.branch-names.outputs.tag }}) | |
if: steps.branch-names.outputs.is_tag == 'true' | |
run: | | |
git checkout gh-pages | |
git checkout ${{ steps.branch-names.outputs.tag }} | |
- name: Ensure we can checkout gh-pages for pr (${{ steps.branch-names.outputs.current_branch }}) | |
if: steps.branch-names.outputs.is_tag == 'false' | |
run: | | |
git checkout gh-pages | |
git checkout ${{ steps.branch-names.outputs.current_branch }} | |
- name: Setup Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies and generate docs | |
run: | | |
pip install poetry | |
ls | |
git status | |
poetry install | |
poetry run python docs_src/generate_docs.py | |