From 72f66cfa6dcadd8440e1382d36b556a7a43a52bc Mon Sep 17 00:00:00 2001 From: Chris Patterson Date: Tue, 12 Jan 2021 13:29:18 -0500 Subject: [PATCH] Added a cache example when using matrix --- examples.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples.md b/examples.md index 793e84a..14c52c1 100644 --- a/examples.md +++ b/examples.md @@ -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+