mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 07:47:08 +00:00
CI: Add job for pip check
(#64058)
This commit is contained in:
parent
a6503406a4
commit
d84beefd4e
@ -119,6 +119,12 @@ other: &other
|
|||||||
- .github/workflows/*
|
- .github/workflows/*
|
||||||
- homeassistant/scripts/**
|
- homeassistant/scripts/**
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
- .github/workflows/*
|
||||||
|
- homeassistant/package_constraints.txt
|
||||||
|
- requirements*.txt
|
||||||
|
- setup.py
|
||||||
|
|
||||||
any:
|
any:
|
||||||
- *base_platforms
|
- *base_platforms
|
||||||
- *components
|
- *components
|
||||||
|
33
.github/workflows/ci.yaml
vendored
33
.github/workflows/ci.yaml
vendored
@ -36,6 +36,7 @@ jobs:
|
|||||||
tests_glob: ${{ steps.info.outputs.tests_glob }}
|
tests_glob: ${{ steps.info.outputs.tests_glob }}
|
||||||
test_groups: ${{ steps.info.outputs.test_groups }}
|
test_groups: ${{ steps.info.outputs.test_groups }}
|
||||||
test_group_count: ${{ steps.info.outputs.test_group_count }}
|
test_group_count: ${{ steps.info.outputs.test_group_count }}
|
||||||
|
requirements: ${{ steps.core.outputs.requirements }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code from GitHub
|
- name: Check out code from GitHub
|
||||||
@ -671,6 +672,38 @@ jobs:
|
|||||||
python --version
|
python --version
|
||||||
mypy homeassistant/components/${{ needs.changes.outputs.integrations_glob }}
|
mypy homeassistant/components/${{ needs.changes.outputs.integrations_glob }}
|
||||||
|
|
||||||
|
pip-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: needs.changes.outputs.requirements == 'true'
|
||||||
|
needs:
|
||||||
|
- changes
|
||||||
|
- prepare-tests
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
python-version: [3.9]
|
||||||
|
name: Run pip check ${{ matrix.python-version }}
|
||||||
|
container: homeassistant/ci-azure:${{ matrix.python-version }}
|
||||||
|
steps:
|
||||||
|
- name: Check out code from GitHub
|
||||||
|
uses: actions/checkout@v2.4.0
|
||||||
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
|
id: cache-venv
|
||||||
|
uses: actions/cache@v2.1.7
|
||||||
|
with:
|
||||||
|
path: venv
|
||||||
|
key: ${{ runner.os }}-${{ matrix.python-version }}-${{
|
||||||
|
needs.prepare-tests.outputs.python-key }}
|
||||||
|
- name: Fail job if Python cache restore failed
|
||||||
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
echo "Failed to restore Python virtual environment from cache"
|
||||||
|
exit 1
|
||||||
|
- name: Run pip check
|
||||||
|
run: |
|
||||||
|
. venv/bin/activate
|
||||||
|
./script/pip_check $PIP_CACHE
|
||||||
|
|
||||||
pytest:
|
pytest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.changes.outputs.test_full_suite == 'true' || needs.changes.outputs.tests_glob
|
if: needs.changes.outputs.test_full_suite == 'true' || needs.changes.outputs.tests_glob
|
||||||
|
27
script/pip_check
Executable file
27
script/pip_check
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PIP_CACHE=$1
|
||||||
|
|
||||||
|
# Number of existing dependency conflicts
|
||||||
|
# Update if a PR resolve one!
|
||||||
|
DEPENDENCY_CONFLICTS=14
|
||||||
|
|
||||||
|
PIP_CHECK=$(pip check --cache-dir=$PIP_CACHE)
|
||||||
|
LINE_COUNT=$(echo "$PIP_CHECK" | wc -l)
|
||||||
|
echo "$PIP_CHECK"
|
||||||
|
|
||||||
|
if [[ $((LINE_COUNT)) -gt $DEPENDENCY_CONFLICTS ]]
|
||||||
|
then
|
||||||
|
echo "------"
|
||||||
|
echo "Requirements change added another dependency conflict."
|
||||||
|
echo "Make sure to check the 'pip check' output above!"
|
||||||
|
exit 1
|
||||||
|
elif [[ $((LINE_COUNT)) -lt $DEPENDENCY_CONFLICTS ]]
|
||||||
|
then
|
||||||
|
echo "------"
|
||||||
|
echo "It seems like this PR resolves $((
|
||||||
|
DEPENDENCY_CONFLICTS - LINE_COUNT)) dependency conflicts."
|
||||||
|
echo "Please update the 'DEPENDENCY_CONFLICTS' constant "
|
||||||
|
echo "in 'script/pip_check' to help prevent regressions."
|
||||||
|
echo "Update it to: $((LINE_COUNT))"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user