10000 Merge pull request #506 from actions/cache-matrix-example · actions/cache@26c48dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 26c48dc

Browse files
authored
Merge pull request #506 from actions/cache-matrix-example
Added a cache example when using matrix
2 parents 9f3a4d3 + 72f66cf commit 26c48dc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

examples.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,31 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
345345
${{ runner.os }}-pip-
346346
```
347347

348+
### Multiple OS's in a workflow with a matrix
349+
350+
``` yaml
351+
jobs:
352+
build:
353+
runs-on: ${{ matrix.os }}
354+
strategy:
355+
matrix:
356+
os: [ubuntu-latest, macos-latest, windows-latest]
357+
include:
358+
- os: ubuntu-latest
359+
path: ~/.cache/pip
360+
- os: macos-latest
361+
path: ~/Library/Caches/pip
362+
- os: windows-latest
363+
path: ~\AppData\Local\pip\Cache
364+
steps:
365+
- uses: actions/cache@v2
366+
with:
367+
path: ${{ matrix.path }}
368+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
369+
restore-keys: |
370+
${{ runner.os }}-pip-
371+
```
372+
348373
### Using pip to get cache location
349374

350375
> Note: This requires pip 20.1+

0 commit comments

Comments
 (0)
0