diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 45fe336d77..a8e93248bb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -468,6 +468,8 @@ jobs:
       - 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