From 1ca157def46f5e1f7f6850f5fe23782895052bc4 Mon Sep 17 00:00:00 2001 From: Rafal Zielinski Date: Thu, 2 Oct 2025 12:53:33 +0100 Subject: [PATCH] feat: added caching to the gitea workflow Signed-off-by: Rafal Zielinski --- .gitea/workflows/integration-test.yml | 46 ++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/integration-test.yml b/.gitea/workflows/integration-test.yml index 8924543..3b56d84 100644 --- a/.gitea/workflows/integration-test.yml +++ b/.gitea/workflows/integration-test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: python-version: ["3.13"] - home-assistant-version: ["2024.12.0", "2025.9.4"] + home-assistant-version: ["2025.9.4"] steps: - name: Checkout Code @@ -23,6 +23,50 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' # Built-in pip caching + + - name: Cache pip dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-${{ hashFiles('**/requirements-dev.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}- + ${{ runner.os }}-pip-${{ matrix.python-version }}- + ${{ runner.os }}-pip- + + - name: Cache pytest cache + uses: actions/cache@v4 + with: + path: .pytest_cache + key: ${{ runner.os }}-pytest-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-pytest-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}- + ${{ runner.os }}-pytest-${{ matrix.python-version }}- + ${{ runner.os }}-pytest- + + - name: Cache Home Assistant installation + uses: actions/cache@v4 + with: + path: | + /opt/hostedtoolcache/Python/${{ matrix.python-version }}*/x64/lib/python*/site-packages/homeassistant* + ~/.local/lib/python*/site-packages/homeassistant* + key: ${{ runner.os }}-ha-${{ matrix.python-version }}-${{ matrix.home-assistant-version }} + restore-keys: | + ${{ runner.os }}-ha-${{ matrix.python-version }}-${{ matrix.home-assistant-version }} + + - name: Cache coverage data + uses: actions/cache@v4 + with: + path: | + .coverage + .coverage.* + htmlcov/ + key: ${{ runner.os }}-coverage-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-coverage-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}- + ${{ runner.os }}-coverage-${{ matrix.python-version }}- + ${{ runner.os }}-coverage- - name: Install Dependencies run: |