From 7eb2921194c0261b3d8e1055eaf6b21b536b47db Mon Sep 17 00:00:00 2001 From: Javed Habib Date: Tue, 21 May 2024 18:22:22 +0530 Subject: [PATCH] feat(ci): cache invalidation --- .github/workflows/code_quality.yaml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code_quality.yaml b/.github/workflows/code_quality.yaml index e63af73..8fe668a 100644 --- a/.github/workflows/code_quality.yaml +++ b/.github/workflows/code_quality.yaml @@ -16,15 +16,32 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Install poetry - run: pipx install poetry - - name: Set up Python uses: actions/setup-python@v5 - id: cq with: python-version: '3.11' - cache: 'poetry' + + - name: Install Poetry + run: pip install poetry + + - name: Generate hash of req dependencies + id: cq + run: | + poetry export --only=lint --format=requirements.txt --output=requirements.txt + echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cache/pypoetry + ~/.cache/pip + key: ${{ runner.os }}-poetry-${{ env.hash }} + restore-keys: | + ${{ runner.os }}-poetry- + + - name: Echo env + run: poetry env info - name: Install lint dependencies run: poetry install --only=lint --no-interaction --no-root @@ -99,4 +116,4 @@ jobs: run: poetry install --only=lint --no-interaction --no-root - name: Check spellings - run: poetry run typos . + run: poetry run typos .