From 5c6435c687bbcfe5e76c53adc969ba254b34231d Mon Sep 17 00:00:00 2001 From: "Felt, Nicholas" Date: Tue, 27 Aug 2024 09:45:00 -0700 Subject: [PATCH] feat: Add a pre-commit cache to the test-code and update-python-and-pre-commit-dependencies reusable workflows --- .github/workflows/_reusable-test-code.yml | 6 ++++++ ..._reusable-update-python-and-pre-commit-dependencies.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/_reusable-test-code.yml b/.github/workflows/_reusable-test-code.yml index 5d1e0192..a8f33076 100644 --- a/.github/workflows/_reusable-test-code.yml +++ b/.github/workflows/_reusable-test-code.yml @@ -50,6 +50,12 @@ jobs: check-latest: true - name: Install dependencies run: python -m pip install tox tox-gh-actions + - name: Set up pre-commit cache + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') + }} - name: Run tox run: tox -v - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/_reusable-update-python-and-pre-commit-dependencies.yml b/.github/workflows/_reusable-update-python-and-pre-commit-dependencies.yml index bd75d04d..ff1921e6 100644 --- a/.github/workflows/_reusable-update-python-and-pre-commit-dependencies.yml +++ b/.github/workflows/_reusable-update-python-and-pre-commit-dependencies.yml @@ -77,6 +77,13 @@ jobs: passphrase: ${{ secrets.gpg-signing-key-passphrase }} git_user_signingkey: true git_commit_gpgsign: true + - name: Set up pre-commit cache + if: ${{ inputs.update-pre-commit || inputs.run-pre-commit }} + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') + }} - if: ${{ endsWith(github.repository, '/python-package-ci-cd') }} # Run the local action when this is run in the python-package-ci-cd repository uses: ./actions/update_development_dependencies with: