Skip to content

Commit

Permalink
Merge pull request #506 from actions/cache-matrix-example
Browse files Browse the repository at this point in the history
Added a cache example when using matrix
  • Loading branch information
Konrad Pabjan authored and GitHub committed Jan 12, 2021
2 parents 9f3a4d3 + 72f66cf commit 26c48dc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,31 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
${{ runner.os }}-pip-
```

### Multiple OS's in a workflow with a matrix

``` yaml
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
steps:
- uses: actions/cache@v2
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
```

### Using pip to get cache location

> Note: This requires pip 20.1+
Expand Down

0 comments on commit 26c48dc

Please sign in to comment.