From 5b10f59a0f149c46e6f3fde1383a5ed4fae5182b Mon Sep 17 00:00:00 2001 From: Maciej Brencz Date: Thu, 29 Oct 2020 17:05:25 +0100 Subject: [PATCH] CI: cache pip dependencies --- .github/workflows/pythonapp.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 742e82e6..c445dc48 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -10,8 +10,7 @@ on: branches: [ master ] jobs: - build: - + test: runs-on: ubuntu-latest steps: @@ -20,6 +19,20 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.8 + + # https://github.com/actions/cache/blob/main/examples.md#using-pip-to-get-cache-location + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + - name: pip cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install dependencies run: | python -m pip install --upgrade pip