2022-09-06 05:48:01 +02:00
|
|
|
---
|
2020-07-14 14:34:44 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-07-15 21:30:04 +02:00
|
|
|
branches: [dev, beta, release]
|
2020-07-14 14:34:44 +02:00
|
|
|
|
|
|
|
pull_request:
|
2023-09-13 00:06:32 +02:00
|
|
|
paths:
|
|
|
|
- "**"
|
|
|
|
- "!.github/workflows/*.yml"
|
2024-08-13 22:13:09 +02:00
|
|
|
- "!.github/actions/build-image/*"
|
2023-09-13 00:06:32 +02:00
|
|
|
- ".github/workflows/ci.yml"
|
2024-02-21 05:14:30 +01:00
|
|
|
- "!.yamllint"
|
2024-03-10 22:36:44 +01:00
|
|
|
- "!.github/dependabot.yml"
|
2023-02-26 21:13:45 +01:00
|
|
|
merge_group:
|
2020-07-14 14:34:44 +02:00
|
|
|
|
2021-10-26 10:55:27 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-05-17 06:28:09 +02:00
|
|
|
env:
|
|
|
|
DEFAULT_PYTHON: "3.9"
|
|
|
|
PYUPGRADE_TARGET: "--py39-plus"
|
|
|
|
|
2021-11-25 22:02:39 +01:00
|
|
|
concurrency:
|
2022-09-06 05:48:01 +02:00
|
|
|
# yamllint disable-line rule:line-length
|
2021-11-25 22:02:39 +01:00
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-07-14 14:34:44 +02:00
|
|
|
jobs:
|
2023-05-17 06:28:09 +02:00
|
|
|
common:
|
|
|
|
name: Create common environment
|
|
|
|
runs-on: ubuntu-latest
|
2023-06-19 23:08:23 +02:00
|
|
|
outputs:
|
|
|
|
cache-key: ${{ steps.cache-key.outputs.key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Generate cache-key
|
|
|
|
id: cache-key
|
|
|
|
run: echo key="${{ hashFiles('requirements.txt', 'requirements_optional.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
2023-06-19 23:08:23 +02:00
|
|
|
id: python
|
2024-04-01 01:41:43 +02:00
|
|
|
uses: actions/setup-python@v5.1.0
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
- name: Restore Python virtual environment
|
|
|
|
id: cache-venv
|
2024-03-20 09:15:03 +01:00
|
|
|
uses: actions/cache@v4.0.2
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
|
|
|
path: venv
|
|
|
|
# yamllint disable-line rule:line-length
|
2023-06-19 23:08:23 +02:00
|
|
|
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ steps.cache-key.outputs.key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Create Python virtual environment
|
|
|
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
python -m venv venv
|
|
|
|
. venv/bin/activate
|
|
|
|
python --version
|
|
|
|
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
|
|
|
pip install -e .
|
|
|
|
|
|
|
|
black:
|
|
|
|
name: Check black
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Run black
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
black --verbose esphome tests
|
|
|
|
- name: Suggested changes
|
|
|
|
run: script/ci-suggest-changes
|
|
|
|
if: always()
|
|
|
|
|
|
|
|
flake8:
|
|
|
|
name: Check flake8
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Run flake8
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
flake8 esphome
|
|
|
|
- name: Suggested changes
|
|
|
|
run: script/ci-suggest-changes
|
|
|
|
if: always()
|
|
|
|
|
|
|
|
pylint:
|
|
|
|
name: Check pylint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Run pylint
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pylint -f parseable --persistent=n esphome
|
|
|
|
- name: Suggested changes
|
|
|
|
run: script/ci-suggest-changes
|
|
|
|
if: always()
|
|
|
|
|
|
|
|
pyupgrade:
|
|
|
|
name: Check pyupgrade
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Run pyupgrade
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pyupgrade ${{ env.PYUPGRADE_TARGET }} `find esphome -name "*.py" -type f`
|
|
|
|
- name: Suggested changes
|
|
|
|
run: script/ci-suggest-changes
|
|
|
|
if: always()
|
|
|
|
|
|
|
|
ci-custom:
|
|
|
|
name: Run script/ci-custom
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Register matcher
|
|
|
|
run: echo "::add-matcher::.github/workflows/matchers/ci-custom.json"
|
|
|
|
- name: Run script/ci-custom
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
script/ci-custom.py
|
|
|
|
script/build_codeowners.py --check
|
|
|
|
|
|
|
|
pytest:
|
|
|
|
name: Run pytest
|
2024-01-09 04:18:13 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
python-version:
|
|
|
|
- "3.9"
|
|
|
|
- "3.10"
|
|
|
|
- "3.11"
|
|
|
|
- "3.12"
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macOS-latest
|
|
|
|
- windows-latest
|
|
|
|
exclude:
|
|
|
|
# Minimize CI resource usage
|
|
|
|
# by only running the Python version
|
|
|
|
# version used for docker images on Windows and macOS
|
|
|
|
- python-version: "3.12"
|
|
|
|
os: windows-latest
|
|
|
|
- python-version: "3.10"
|
|
|
|
os: windows-latest
|
|
|
|
- python-version: "3.9"
|
|
|
|
os: windows-latest
|
|
|
|
- python-version: "3.12"
|
|
|
|
os: macOS-latest
|
|
|
|
- python-version: "3.10"
|
|
|
|
os: macOS-latest
|
|
|
|
- python-version: "3.9"
|
|
|
|
os: macOS-latest
|
|
|
|
runs-on: ${{ matrix.os }}
|
2023-05-17 06:28:09 +02:00
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2024-01-09 04:18:13 +01:00
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-06-19 23:08:23 +02:00
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Register matcher
|
|
|
|
run: echo "::add-matcher::.github/workflows/matchers/pytest.json"
|
|
|
|
- name: Run pytest
|
2024-01-09 04:18:13 +01:00
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: |
|
|
|
|
./venv/Scripts/activate
|
|
|
|
pytest -vv --cov-report=xml --tb=native tests
|
|
|
|
- name: Run pytest
|
|
|
|
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'
|
2023-05-17 06:28:09 +02:00
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
2024-01-09 04:18:13 +01:00
|
|
|
pytest -vv --cov-report=xml --tb=native tests
|
|
|
|
- name: Upload coverage to Codecov
|
2024-02-21 03:56:28 +01:00
|
|
|
uses: codecov/codecov-action@v4
|
2024-01-09 04:18:13 +01:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2023-05-17 06:28:09 +02:00
|
|
|
|
|
|
|
clang-format:
|
|
|
|
name: Check clang-format
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2023-05-17 06:28:09 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Install clang-format
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
2024-04-23 01:01:20 +02:00
|
|
|
pip install clang-format -c requirements_dev.txt
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Run clang-format
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
script/clang-format -i
|
|
|
|
git diff-index --quiet HEAD --
|
|
|
|
- name: Suggested changes
|
|
|
|
run: script/ci-suggest-changes
|
|
|
|
if: always()
|
|
|
|
|
|
|
|
clang-tidy:
|
2021-07-15 21:30:04 +02:00
|
|
|
name: ${{ matrix.name }}
|
2020-07-14 14:34:44 +02:00
|
|
|
runs-on: ubuntu-latest
|
2023-05-17 06:28:09 +02:00
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
- black
|
|
|
|
- ci-custom
|
|
|
|
- clang-format
|
|
|
|
- flake8
|
|
|
|
- pylint
|
|
|
|
- pytest
|
|
|
|
- pyupgrade
|
2020-07-14 14:34:44 +02:00
|
|
|
strategy:
|
2020-09-29 19:50:06 +02:00
|
|
|
fail-fast: false
|
2023-05-17 06:28:09 +02:00
|
|
|
max-parallel: 2
|
2020-07-14 14:34:44 +02:00
|
|
|
matrix:
|
2021-07-15 21:30:04 +02:00
|
|
|
include:
|
2021-09-20 09:07:38 +02:00
|
|
|
- id: clang-tidy
|
|
|
|
name: Run script/clang-tidy for ESP8266
|
2022-01-05 21:30:15 +01:00
|
|
|
options: --environment esp8266-arduino-tidy --grep USE_ESP8266
|
2021-09-20 09:07:38 +02:00
|
|
|
pio_cache_key: tidyesp8266
|
|
|
|
- id: clang-tidy
|
2022-01-05 21:30:15 +01:00
|
|
|
name: Run script/clang-tidy for ESP32 Arduino 1/4
|
|
|
|
options: --environment esp32-arduino-tidy --split-num 4 --split-at 1
|
2021-09-20 09:07:38 +02:00
|
|
|
pio_cache_key: tidyesp32
|
|
|
|
- id: clang-tidy
|
2022-01-05 21:30:15 +01:00
|
|
|
name: Run script/clang-tidy for ESP32 Arduino 2/4
|
|
|
|
options: --environment esp32-arduino-tidy --split-num 4 --split-at 2
|
2021-09-20 09:07:38 +02:00
|
|
|
pio_cache_key: tidyesp32
|
|
|
|
- id: clang-tidy
|
2022-01-05 21:30:15 +01:00
|
|
|
name: Run script/clang-tidy for ESP32 Arduino 3/4
|
|
|
|
options: --environment esp32-arduino-tidy --split-num 4 --split-at 3
|
2021-09-20 09:07:38 +02:00
|
|
|
pio_cache_key: tidyesp32
|
|
|
|
- id: clang-tidy
|
2022-01-05 21:30:15 +01:00
|
|
|
name: Run script/clang-tidy for ESP32 Arduino 4/4
|
|
|
|
options: --environment esp32-arduino-tidy --split-num 4 --split-at 4
|
2021-09-20 09:07:38 +02:00
|
|
|
pio_cache_key: tidyesp32
|
2021-09-20 11:47:51 +02:00
|
|
|
- id: clang-tidy
|
2022-01-05 21:30:15 +01:00
|
|
|
name: Run script/clang-tidy for ESP32 IDF
|
2021-09-20 11:47:51 +02:00
|
|
|
options: --environment esp32-idf-tidy --grep USE_ESP_IDF
|
|
|
|
pio_cache_key: tidyesp32-idf
|
2021-07-15 21:30:04 +02:00
|
|
|
|
2020-07-14 14:34:44 +02:00
|
|
|
steps:
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2023-06-19 23:08:23 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
2020-07-14 14:34:44 +02:00
|
|
|
with:
|
2023-06-19 23:08:23 +02:00
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
2024-05-10 01:04:32 +02:00
|
|
|
|
2021-09-20 09:07:38 +02:00
|
|
|
- name: Cache platformio
|
2024-05-10 01:04:32 +02:00
|
|
|
if: github.ref == 'refs/heads/dev'
|
2024-03-20 09:15:03 +01:00
|
|
|
uses: actions/cache@v4.0.2
|
2020-07-14 14:34:44 +02:00
|
|
|
with:
|
|
|
|
path: ~/.platformio
|
2024-05-10 01:04:32 +02:00
|
|
|
key: platformio-${{ matrix.pio_cache_key }}
|
|
|
|
|
|
|
|
- name: Cache platformio
|
|
|
|
if: github.ref != 'refs/heads/dev'
|
|
|
|
uses: actions/cache/restore@v4.0.2
|
|
|
|
with:
|
|
|
|
path: ~/.platformio
|
|
|
|
key: platformio-${{ matrix.pio_cache_key }}
|
2020-07-14 14:34:44 +02:00
|
|
|
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Install clang-tidy
|
2023-07-30 21:44:56 +02:00
|
|
|
run: sudo apt-get install clang-tidy-14
|
2020-07-15 01:37:30 +02:00
|
|
|
|
2020-07-14 14:34:44 +02:00
|
|
|
- name: Register problem matchers
|
|
|
|
run: |
|
2021-07-15 21:30:04 +02:00
|
|
|
echo "::add-matcher::.github/workflows/matchers/gcc.json"
|
2021-09-20 09:07:38 +02:00
|
|
|
echo "::add-matcher::.github/workflows/matchers/clang-tidy.json"
|
2020-07-15 14:00:02 +02:00
|
|
|
|
2024-06-13 12:15:38 +02:00
|
|
|
- name: Run 'pio run --list-targets -e esp32-idf-tidy'
|
|
|
|
if: matrix.name == 'Run script/clang-tidy for ESP32 IDF'
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
mkdir -p .temp
|
|
|
|
pio run --list-targets -e esp32-idf-tidy
|
|
|
|
|
2021-09-20 09:07:38 +02:00
|
|
|
- name: Run clang-tidy
|
|
|
|
run: |
|
2023-05-17 06:28:09 +02:00
|
|
|
. venv/bin/activate
|
2021-09-20 09:07:38 +02:00
|
|
|
script/clang-tidy --all-headers --fix ${{ matrix.options }}
|
|
|
|
env:
|
|
|
|
# Also cache libdeps, store them in a ~/.platformio subfolder
|
|
|
|
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
|
|
|
|
|
|
|
|
- name: Suggested changes
|
|
|
|
run: script/ci-suggest-changes
|
2022-09-06 05:48:01 +02:00
|
|
|
# yamllint disable-line rule:line-length
|
2023-05-17 06:28:09 +02:00
|
|
|
if: always()
|
2023-02-14 00:54:38 +01:00
|
|
|
|
2024-01-18 08:13:40 +01:00
|
|
|
list-components:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
2024-03-16 02:22:34 +01:00
|
|
|
if: github.event_name == 'pull_request'
|
2024-01-18 08:13:40 +01:00
|
|
|
outputs:
|
2024-04-23 11:19:10 +02:00
|
|
|
components: ${{ steps.list-components.outputs.components }}
|
|
|
|
count: ${{ steps.list-components.outputs.count }}
|
2024-01-18 08:13:40 +01:00
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2024-01-18 08:13:40 +01:00
|
|
|
with:
|
|
|
|
# Fetch enough history so `git merge-base refs/remotes/origin/dev HEAD` works.
|
|
|
|
fetch-depth: 500
|
2024-03-16 02:22:34 +01:00
|
|
|
- name: Get target branch
|
|
|
|
id: target-branch
|
2024-01-18 08:13:40 +01:00
|
|
|
run: |
|
2024-03-16 02:22:34 +01:00
|
|
|
echo "branch=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Fetch ${{ steps.target-branch.outputs.branch }} branch
|
|
|
|
run: |
|
|
|
|
git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +refs/heads/${{ steps.target-branch.outputs.branch }}:refs/remotes/origin/${{ steps.target-branch.outputs.branch }}
|
|
|
|
git merge-base refs/remotes/origin/${{ steps.target-branch.outputs.branch }} HEAD
|
2024-01-18 08:13:40 +01:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
|
|
|
- name: Find changed components
|
2024-04-23 11:19:10 +02:00
|
|
|
id: list-components
|
2024-01-18 08:13:40 +01:00
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
2024-04-23 11:19:10 +02:00
|
|
|
components=$(script/list-components.py --changed --branch ${{ steps.target-branch.outputs.branch }})
|
|
|
|
output_components=$(echo "$components" | jq -R -s -c 'split("\n")[:-1] | map(select(length > 0))')
|
|
|
|
count=$(echo "$output_components" | jq length)
|
|
|
|
|
|
|
|
echo "components=$output_components" >> $GITHUB_OUTPUT
|
|
|
|
echo "count=$count" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
echo "$count Components:"
|
|
|
|
echo "$output_components" | jq
|
2024-01-18 08:13:40 +01:00
|
|
|
|
|
|
|
test-build-components:
|
|
|
|
name: Component test ${{ matrix.file }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
- list-components
|
2024-04-23 11:19:10 +02:00
|
|
|
if: github.event_name == 'pull_request' && fromJSON(needs.list-components.outputs.count) > 0 && fromJSON(needs.list-components.outputs.count) < 100
|
2024-01-18 08:13:40 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 2
|
|
|
|
matrix:
|
2024-04-23 11:19:10 +02:00
|
|
|
file: ${{ fromJson(needs.list-components.outputs.components) }}
|
2024-01-18 08:13:40 +01:00
|
|
|
steps:
|
2024-06-12 09:58:56 +02:00
|
|
|
- name: Install dependencies
|
2024-06-12 03:42:01 +02:00
|
|
|
run: sudo apt-get install libsodium-dev libsdl2-dev
|
2024-03-10 04:08:58 +01:00
|
|
|
|
2024-01-18 08:13:40 +01:00
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2024-01-18 08:13:40 +01:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
|
|
|
- name: test_build_components -e config -c ${{ matrix.file }}
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
./script/test_build_components -e config -c ${{ matrix.file }}
|
|
|
|
- name: test_build_components -e compile -c ${{ matrix.file }}
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
./script/test_build_components -e compile -c ${{ matrix.file }}
|
|
|
|
|
2024-04-23 11:19:10 +02:00
|
|
|
test-build-components-splitter:
|
|
|
|
name: Split components for testing into 20 groups maximum
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
- list-components
|
|
|
|
if: github.event_name == 'pull_request' && fromJSON(needs.list-components.outputs.count) >= 100
|
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.split.outputs.components }}
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2024-04-23 11:19:10 +02:00
|
|
|
- name: Split components into 20 groups
|
|
|
|
id: split
|
|
|
|
run: |
|
|
|
|
components=$(echo '${{ needs.list-components.outputs.components }}' | jq -c '.[]' | shuf | jq -s -c '[_nwise(20) | join(" ")]')
|
|
|
|
echo "components=$components" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
test-build-components-split:
|
|
|
|
name: Test split components
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
- list-components
|
|
|
|
- test-build-components-splitter
|
|
|
|
if: github.event_name == 'pull_request' && fromJSON(needs.list-components.outputs.count) >= 100
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 4
|
|
|
|
matrix:
|
|
|
|
components: ${{ fromJson(needs.test-build-components-splitter.outputs.matrix) }}
|
|
|
|
steps:
|
|
|
|
- name: List components
|
|
|
|
run: echo ${{ matrix.components }}
|
|
|
|
|
2024-06-12 09:58:56 +02:00
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt-get install libsodium-dev libsdl2-dev
|
2024-04-23 11:19:10 +02:00
|
|
|
|
|
|
|
- name: Check out code from GitHub
|
2024-06-12 23:27:15 +02:00
|
|
|
uses: actions/checkout@v4.1.7
|
2024-04-23 11:19:10 +02:00
|
|
|
- name: Restore Python
|
|
|
|
uses: ./.github/actions/restore-python
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
cache-key: ${{ needs.common.outputs.cache-key }}
|
|
|
|
- name: Validate config
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
for component in ${{ matrix.components }}; do
|
|
|
|
./script/test_build_components -e config -c $component
|
|
|
|
done
|
|
|
|
- name: Compile config
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
2024-07-22 01:33:26 +02:00
|
|
|
mkdir build_cache
|
|
|
|
export PLATFORMIO_BUILD_CACHE_DIR=$PWD/build_cache
|
2024-04-23 11:19:10 +02:00
|
|
|
for component in ${{ matrix.components }}; do
|
|
|
|
./script/test_build_components -e compile -c $component
|
|
|
|
done
|
|
|
|
|
2023-02-14 00:54:38 +01:00
|
|
|
ci-status:
|
|
|
|
name: CI Status
|
|
|
|
runs-on: ubuntu-latest
|
2023-05-17 06:28:09 +02:00
|
|
|
needs:
|
|
|
|
- common
|
|
|
|
- black
|
|
|
|
- ci-custom
|
|
|
|
- clang-format
|
|
|
|
- flake8
|
|
|
|
- pylint
|
|
|
|
- pytest
|
|
|
|
- pyupgrade
|
|
|
|
- clang-tidy
|
2024-04-18 02:11:00 +02:00
|
|
|
- list-components
|
2024-04-23 11:19:10 +02:00
|
|
|
- test-build-components
|
|
|
|
- test-build-components-splitter
|
|
|
|
- test-build-components-split
|
2023-02-14 00:54:38 +01:00
|
|
|
if: always()
|
|
|
|
steps:
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Success
|
2023-02-14 00:54:38 +01:00
|
|
|
if: ${{ !(contains(needs.*.result, 'failure')) }}
|
|
|
|
run: exit 0
|
2023-05-17 06:28:09 +02:00
|
|
|
- name: Failure
|
2023-02-14 00:54:38 +01:00
|
|
|
if: ${{ contains(needs.*.result, 'failure') }}
|
2024-04-18 02:11:00 +02:00
|
|
|
env:
|
|
|
|
JSON_DOC: ${{ toJSON(needs) }}
|
|
|
|
run: |
|
|
|
|
echo $JSON_DOC | jq
|
|
|
|
exit 1
|