Skip to content

Commit

Permalink
Use setup-python action to cache dependencies (google#9159)
Browse files Browse the repository at this point in the history
Signed-off-by: jongwooo <[email protected]>

## 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 <[email protected]>
  • Loading branch information
jongwooo authored Jan 30, 2023
1 parent b452496 commit 58ad90a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/project_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 58ad90a

Please sign in to comment.