mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
* build: dev container
Add a VS Code Dev Container from the blueprint at bceaae212f
* build: dev container test setup
Add support for unit testing in the dev container environment with debugging and code coverage.
* ci: adjust to dev container test restructuring
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ci: fix coverage collection
* build: add dummy light to HA config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* build: update dev container to Python 3.11 (for HA 2023.6)
* Add VS Code tasks
* Use pre-commit hooks for linting
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Unpin HA version
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
74 lines
2.5 KiB
YAML
74 lines
2.5 KiB
YAML
name: pytest
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
|
|
jobs:
|
|
pytest:
|
|
name: Run pytest
|
|
runs-on: ubuntu-20.04
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- python-version: "3.10"
|
|
core-version: "2023.2.5"
|
|
- python-version: "3.10"
|
|
core-version: "2023.3.6"
|
|
- python-version: "3.10"
|
|
core-version: "2023.4.6"
|
|
- python-version: "3.10"
|
|
core-version: "2023.5.2"
|
|
- python-version: "3.11"
|
|
core-version: "2023.6.1"
|
|
- python-version: "3.11"
|
|
core-version: "dev"
|
|
steps:
|
|
- name: Check out code from GitHub
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Home Assistant
|
|
uses: ./.github/workflows/install_dependencies
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
core-version: ${{ matrix.core-version }}
|
|
|
|
- name: Click here for troubleshooting steps if tests break again.
|
|
run: |
|
|
echo "::notice::### If tests fail, try these debug steps: ###"
|
|
echo "::notice::### 1. Replace '-qq' from .github/workflow/pytest.yaml. with '-v' for extra verbosity. ###"
|
|
echo "::notice::### 2. Push or run action again. ###"
|
|
echo "::notice::### 3. Check for any log messages in github actions resembling the following using CTRL+F ###
|
|
echo "::notice::### 4. ERROR:homeassistant.setup:Setup failed for 'component': Unable to import component: No module named ''module'' ###"
|
|
echo "::notice::### 5. add 'component'.'module' (without the '') from the above log into the 'required' list inside of 'test_dependencies.py' ###"
|
|
echo "::notice::### 6. Try again! If more issues persist they should be easily solvable by reading the verbose logs now. ###"
|
|
|
|
- name: Link custom_components/adaptive_lighting
|
|
run: |
|
|
cd core
|
|
|
|
# Link adaptive_lighting tests
|
|
cd tests/components/
|
|
ln -fs ../../../tests adaptive_lighting
|
|
cd -
|
|
|
|
- name: Run pytest
|
|
timeout-minutes: 60
|
|
run: |
|
|
export PYTHONPATH=${PYTHONPATH}:${PWD}
|
|
cd core
|
|
python3 -X dev -m pytest \
|
|
-vvv \
|
|
-qq \
|
|
--timeout=9 \
|
|
--durations=10 \
|
|
--cov="custom_components.adaptive_lighting" \
|
|
--cov-report=xml \
|
|
-o console_output_style=count \
|
|
-p no:sugar \
|
|
tests/components/adaptive_lighting
|
|
env:
|
|
HA_CLONE: true
|