From 58ad90a61acbc8daa26d226e5dc2fd6c118df380 Mon Sep 17 00:00:00 2001 From: Jongwoo Han Date: Tue, 31 Jan 2023 02:09:06 +0900 Subject: [PATCH] Use setup-python action to cache dependencies (#9159) Signed-off-by: jongwooo ## Details Updated workflows to cache dependencies using [actions/setup-python](https://github.com/actions/setup-python#caching-packages-dependencies). `setup-python@v3` or newer has caching **built-in**. ### AS-IS ```yaml - name: Setup python environment uses: actions/setup-python@v3 with: python-version: 3.8 ``` ### TO-BE ```yaml - name: Setup python environment uses: actions/setup-python@v3 with: python-version: 3.8 cache: pip cache-dependency-path: | infra/ci/requirements.txt infra/build/functions/requirements.txt infra/cifuzz/requirements.txt ``` ## References - [https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows) - [https://thearchivelog.dev/article/caching-dependencies-to-speed-up-workflows/](https://thearchivelog.dev/article/caching-dependencies-to-speed-up-workflows/) Signed-off-by: jongwooo --- .github/workflows/presubmit.yml | 4 ++++ .github/workflows/project_tests.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 5ae93faee533..a31b13a7a6d9 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -29,6 +29,10 @@ jobs: uses: actions/setup-python@v3 with: python-version: 3.8 + cache: pip + cache-dependency-path: | + infra/ci/requirements.txt + infra/build/functions/requirements.txt - name: Install dependencies run: | diff --git a/.github/workflows/project_tests.yml b/.github/workflows/project_tests.yml index 0b2e31cdef96..c82aaf149e2b 100644 --- a/.github/workflows/project_tests.yml +++ b/.github/workflows/project_tests.yml @@ -73,6 +73,9 @@ jobs: uses: actions/setup-python@v3 with: python-version: 3.8 + cache: pip + cache-dependency-path: | + infra/ci/requirements.txt - name: Install dependencies run: |