diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5af3ec9e9..73f2c2a65e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ concurrency: jobs: common: name: Create common environment - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: cache-key: ${{ steps.cache-key.outputs.key }} steps: @@ -60,232 +60,232 @@ jobs: 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 - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - cache-key: ${{ needs.common.outputs.cache-key }} - - name: Run black - run: | - . venv/bin/activate - black --verbose esphome tests - - name: Suggested changes - run: script/ci-suggest-changes - if: always() + # black: + # name: Check black + # runs-on: ubuntu-24.04 + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ env.DEFAULT_PYTHON }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - 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 - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - cache-key: ${{ needs.common.outputs.cache-key }} - - name: Run flake8 - run: | - . venv/bin/activate - flake8 esphome - - name: Suggested changes - run: script/ci-suggest-changes - if: always() + # flake8: + # name: Check flake8 + # runs-on: ubuntu-24.04 + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ env.DEFAULT_PYTHON }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - 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 - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - cache-key: ${{ needs.common.outputs.cache-key }} - - name: Run pylint - run: | - . venv/bin/activate - pylint -f parseable --persistent=n esphome - - name: Suggested changes - run: script/ci-suggest-changes - if: always() + # pylint: + # name: Check pylint + # runs-on: ubuntu-24.04 + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ env.DEFAULT_PYTHON }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - 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 - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - cache-key: ${{ needs.common.outputs.cache-key }} - - 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() + # pyupgrade: + # name: Check pyupgrade + # runs-on: ubuntu-24.04 + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ env.DEFAULT_PYTHON }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - 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 - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - cache-key: ${{ needs.common.outputs.cache-key }} - - 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 + # ci-custom: + # name: Run script/ci-custom + # runs-on: ubuntu-24.04 + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ env.DEFAULT_PYTHON }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - 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 - 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 }} - needs: - - common - steps: - - name: Check out code from GitHub - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ matrix.python-version }} - cache-key: ${{ needs.common.outputs.cache-key }} - - name: Register matcher - run: echo "::add-matcher::.github/workflows/matchers/pytest.json" - - name: Run pytest - 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' - run: | - . venv/bin/activate - pytest -vv --cov-report=xml --tb=native tests - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} + # pytest: + # name: Run pytest + # 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 }} + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ matrix.python-version }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - name: Register matcher + # run: echo "::add-matcher::.github/workflows/matchers/pytest.json" + # - name: Run pytest + # 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' + # run: | + # . venv/bin/activate + # pytest -vv --cov-report=xml --tb=native tests + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v5 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} - clang-format: - name: Check clang-format - runs-on: ubuntu-latest - needs: - - common - steps: - - name: Check out code from GitHub - uses: actions/checkout@v4.1.7 - - name: Restore Python - uses: ./.github/actions/restore-python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - cache-key: ${{ needs.common.outputs.cache-key }} - - name: Install clang-format - run: | - . venv/bin/activate - pip install clang-format -c requirements_dev.txt - - 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-format: + # name: Check clang-format + # runs-on: ubuntu-24.04 + # needs: + # - common + # steps: + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - name: Restore Python + # uses: ./.github/actions/restore-python + # with: + # python-version: ${{ env.DEFAULT_PYTHON }} + # cache-key: ${{ needs.common.outputs.cache-key }} + # - name: Install clang-format + # run: | + # . venv/bin/activate + # pip install clang-format -c requirements_dev.txt + # - 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: name: ${{ matrix.name }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: - common - - black - - ci-custom - - clang-format - - flake8 - - pylint - - pytest - - pyupgrade + # - black + # - ci-custom + # - clang-format + # - flake8 + # - pylint + # - pytest + # - pyupgrade strategy: fail-fast: false max-parallel: 2 matrix: include: - - id: clang-tidy - name: Run script/clang-tidy for ESP8266 - options: --environment esp8266-arduino-tidy --grep USE_ESP8266 - pio_cache_key: tidyesp8266 - - id: clang-tidy - name: Run script/clang-tidy for ESP32 Arduino 1/4 - options: --environment esp32-arduino-tidy --split-num 4 --split-at 1 - pio_cache_key: tidyesp32 - - id: clang-tidy - name: Run script/clang-tidy for ESP32 Arduino 2/4 - options: --environment esp32-arduino-tidy --split-num 4 --split-at 2 - pio_cache_key: tidyesp32 - - id: clang-tidy - name: Run script/clang-tidy for ESP32 Arduino 3/4 - options: --environment esp32-arduino-tidy --split-num 4 --split-at 3 - pio_cache_key: tidyesp32 - - id: clang-tidy - name: Run script/clang-tidy for ESP32 Arduino 4/4 - options: --environment esp32-arduino-tidy --split-num 4 --split-at 4 - pio_cache_key: tidyesp32 + # - id: clang-tidy + # name: Run script/clang-tidy for ESP8266 + # options: --environment esp8266-arduino-tidy --grep USE_ESP8266 + # pio_cache_key: tidyesp8266 + # - id: clang-tidy + # name: Run script/clang-tidy for ESP32 Arduino 1/4 + # options: --environment esp32-arduino-tidy --split-num 4 --split-at 1 + # pio_cache_key: tidyesp32 + # - id: clang-tidy + # name: Run script/clang-tidy for ESP32 Arduino 2/4 + # options: --environment esp32-arduino-tidy --split-num 4 --split-at 2 + # pio_cache_key: tidyesp32 + # - id: clang-tidy + # name: Run script/clang-tidy for ESP32 Arduino 3/4 + # options: --environment esp32-arduino-tidy --split-num 4 --split-at 3 + # pio_cache_key: tidyesp32 + # - id: clang-tidy + # name: Run script/clang-tidy for ESP32 Arduino 4/4 + # options: --environment esp32-arduino-tidy --split-num 4 --split-at 4 + # pio_cache_key: tidyesp32 - id: clang-tidy name: Run script/clang-tidy for ESP32 IDF options: --environment esp32-idf-tidy --grep USE_ESP_IDF @@ -316,8 +316,8 @@ jobs: - name: Install clang-tidy run: | - sudo apt-get update - sudo apt-get install clang-tidy-14 + clang-tidy --version + clang-tidy-18 --version - name: Register problem matchers run: | @@ -345,7 +345,7 @@ jobs: if: always() list-components: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: - common if: github.event_name == 'pull_request' @@ -385,119 +385,119 @@ jobs: echo "$count Components:" echo "$output_components" | jq - test-build-components: - name: Component test ${{ matrix.file }} - runs-on: ubuntu-latest - needs: - - common - - list-components - if: github.event_name == 'pull_request' && fromJSON(needs.list-components.outputs.count) > 0 && fromJSON(needs.list-components.outputs.count) < 100 - strategy: - fail-fast: false - max-parallel: 2 - matrix: - file: ${{ fromJson(needs.list-components.outputs.components) }} - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install libsdl2-dev + # test-build-components: + # name: Component test ${{ matrix.file }} + # runs-on: ubuntu-24.04 + # needs: + # - common + # - list-components + # if: github.event_name == 'pull_request' && fromJSON(needs.list-components.outputs.count) > 0 && fromJSON(needs.list-components.outputs.count) < 100 + # strategy: + # fail-fast: false + # max-parallel: 2 + # matrix: + # file: ${{ fromJson(needs.list-components.outputs.components) }} + # steps: + # - name: Install dependencies + # run: | + # sudo apt-get update + # sudo apt-get install libsdl2-dev - - name: Check out code from GitHub - uses: actions/checkout@v4.1.7 - - 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 }} + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - 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 }} - 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 - uses: actions/checkout@v4.1.7 - - 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-splitter: + # name: Split components for testing into 20 groups maximum + # runs-on: ubuntu-24.04 + # 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 + # uses: actions/checkout@v4.1.7 + # - 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 }} + # test-build-components-split: + # name: Test split components + # runs-on: ubuntu-24.04 + # 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 }} - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install libsdl2-dev + # - name: Install dependencies + # run: | + # sudo apt-get update + # sudo apt-get install libsdl2-dev - - name: Check out code from GitHub - uses: actions/checkout@v4.1.7 - - 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 - mkdir build_cache - export PLATFORMIO_BUILD_CACHE_DIR=$PWD/build_cache - for component in ${{ matrix.components }}; do - ./script/test_build_components -e compile -c $component - done + # - name: Check out code from GitHub + # uses: actions/checkout@v4.1.7 + # - 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 + # mkdir build_cache + # export PLATFORMIO_BUILD_CACHE_DIR=$PWD/build_cache + # for component in ${{ matrix.components }}; do + # ./script/test_build_components -e compile -c $component + # done ci-status: name: CI Status - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: - common - - black - - ci-custom - - clang-format - - flake8 - - pylint - - pytest - - pyupgrade + # - black + # - ci-custom + # - clang-format + # - flake8 + # - pylint + # - pytest + # - pyupgrade - clang-tidy - list-components - - test-build-components - - test-build-components-splitter - - test-build-components-split + # - test-build-components + # - test-build-components-splitter + # - test-build-components-split if: always() steps: - name: Success