stateengine plugin: introduce regex casting, used for conditionset co… #733
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: "Unittests Plugins" | |
#on: [workflow_dispatch, push] | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '*' | |
- '!release_doc' | |
pull_request: | |
branches: | |
- 'develop' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 #latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
name: Python ${{ matrix.python-version }} | |
steps: | |
- name: Setup OS (Ubuntu) | |
run: | | |
sudo apt-get update | |
sudo apt-get install libudev-dev | |
sudo apt-get install librrd-dev libpython3-dev | |
sudo apt-get install gcc --only-upgrade | |
- name: Get branch name | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- name: Workflow Information | |
run: | | |
echo github.event_name '${{ github.event_name }}' | |
echo github.workflow '${{ github.workflow }}' | |
echo github.action_repository '${{ github.action_repository }}' | |
echo github.actor '${{ github.actor }}' | |
echo github.ref_name '${{ github.ref_name }}' | |
echo github.ref '${{ github.ref }}' | |
echo github.base_ref '${{ github.base_ref }}' | |
echo github.head_ref '${{ github.head_ref }}' | |
echo github.pull_request.base.ref '${{ github.pull_request.base.ref }}' | |
echo steps.extract_branch.outputs.branch '${{ steps.extract_branch.outputs.branch }}' | |
- name: Check if branch '${{ steps.extract_branch.outputs.branch }}' exists in smarthomeNG/smarthome | |
run: echo "code=$(git ls-remote --exit-code --heads https://github.com/smarthomeNG/smarthome ${{ steps.extract_branch.outputs.branch }} > /dev/null; echo $? )" >>$GITHUB_OUTPUT | |
id: shng_branch_check | |
- name: Checkout core from branch '${{ steps.extract_branch.outputs.branch }}' (for push on known smarthomeNG/smarthome branch) | |
if: github.event_name != 'pull_request' && steps.shng_branch_check.outputs.code == '0' | |
uses: actions/checkout@v3 | |
with: | |
repository: smarthomeNG/smarthome | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
- name: Checkout core from branch 'develop' (for pull request or push on unknown smarthomeNG/smarthome branch) | |
if: github.event_name == 'pull_request' || steps.shng_branch_check.outputs.code == '2' | |
uses: actions/checkout@v3 | |
with: | |
repository: smarthomeNG/smarthome | |
ref: develop | |
- name: Checkout plugins from branch '${{steps.extract_branch.outputs.branch}}' | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/plugins | |
ref: ${{steps.extract_branch.outputs.branch}} | |
path: plugins | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- run: python3 -m pip install --upgrade pip | |
- name: Install setuptools (needed for Python 3.12) | |
run: pip install setuptools | |
- name: Install requirements for unit testing | |
run: pip install -r tests/requirements.txt | |
- name: Build Requirements for SmartHomeNG | |
run: python3 tools/build_requirements.py | |
- name: Install SmartHomeNG base requirements | |
# base requirements are needed for pytest to run | |
run: pip install -r requirements/base.txt | |
# --- up to here, the workflow is identical for CORE and PLUGINS --- | |
- name: Install SmartHomeNG all requirements | |
# all requirements are needed for pytest to run plugin tests | |
run: pip install -r requirements/all.txt | |
- name: '>>> Run Python Unittests for PLUGINS <<<' | |
working-directory: ./plugins | |
run: pytest |