diff --git a/.github/actions/build-image/action.yaml b/.github/actions/build-image/action.yaml index 87ea28fd20..d36bd65bb6 100644 --- a/.github/actions/build-image/action.yaml +++ b/.github/actions/build-image/action.yaml @@ -34,6 +34,16 @@ runs: echo $l >> $GITHUB_OUTPUT done + # set cache-to only if dev branch + - id: cache-to + shell: bash + run: |- + if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then + echo "value=type=gha,mode=max" >> $GITHUB_OUTPUT + else + echo "value=" >> $GITHUB_OUTPUT + fi + - name: Build and push to ghcr by digest id: build-ghcr uses: docker/build-push-action@v5.3.0 @@ -43,7 +53,7 @@ runs: platforms: ${{ inputs.platform }} target: ${{ inputs.target }} cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: ${{ steps.cache-to.outputs.value }} build-args: | BASEIMGTYPE=${{ inputs.baseimg }} BUILD_VERSION=${{ inputs.version }} @@ -66,7 +76,7 @@ runs: platforms: ${{ inputs.platform }} target: ${{ inputs.target }} cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: ${{ steps.cache-to.outputs.value }} build-args: | BASEIMGTYPE=${{ inputs.baseimg }} BUILD_VERSION=${{ inputs.version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbebc55676..ba0a8a363c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -364,12 +364,20 @@ jobs: with: python-version: ${{ env.DEFAULT_PYTHON }} cache-key: ${{ needs.common.outputs.cache-key }} + - name: Cache platformio + if: github.ref == 'refs/heads/dev' uses: actions/cache@v4.0.2 with: path: ~/.platformio - # yamllint disable-line rule:line-length - key: platformio-${{ matrix.pio_cache_key }}-${{ hashFiles('platformio.ini') }} + 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 }} - name: Install clang-tidy run: sudo apt-get install clang-tidy-14 diff --git a/esphome/config.py b/esphome/config.py index 36a81f677b..4f340225fe 100644 --- a/esphome/config.py +++ b/esphome/config.py @@ -148,6 +148,8 @@ class Config(OrderedDict, fv.FinalValidateConfig): path = path or [] try: yield + except cv.FinalExternalInvalid as e: + self.add_error(e) except vol.Invalid as e: e.prepend(path) self.add_error(e) diff --git a/esphome/config_validation.py b/esphome/config_validation.py index 512f1d8f67..5fc72921e1 100644 --- a/esphome/config_validation.py +++ b/esphome/config_validation.py @@ -267,6 +267,10 @@ class Required(vol.Required): super().__init__(key, msg=msg) +class FinalExternalInvalid(Invalid): + """Represents an invalid value in the final validation phase where the path should not be prepended.""" + + def check_not_templatable(value): if isinstance(value, Lambda): raise Invalid("This option is not templatable!")