diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 3bb8c2a..40365e2 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -17,5 +17,37 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + + - name: Cache $HOME/.local # Significantly speeds up Poetry Install + uses: actions/cache@v3 + with: + path: ~/.local + key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/tests.yml') }} + + - uses: actions/setup-python@v4 + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Load pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }} + restore-keys: ${{ runner.os }}-pip + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install Belay + run: poetry install --no-interaction + - uses: pre-commit/action@v2.0.3