From 8cca0238406fc2c34c50ea44f45fdf5fbc36efa4 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 2 Jun 2020 12:30:10 -0700 Subject: [PATCH] cache the pre-commit environment --- .github/workflows/main.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 262ed5946..056c8d3db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,6 @@ jobs: "macos-py37", "macos-py38", - "linting", "docs", "doctesting", ] @@ -112,10 +111,6 @@ jobs: tox_env: "py38-xdist" use_coverage: true - - name: "linting" - python: "3.7" - os: ubuntu-latest - tox_env: "linting" - name: "docs" python: "3.7" os: ubuntu-latest @@ -168,6 +163,20 @@ jobs: CODECOV_NAME: ${{ matrix.name }} run: bash scripts/report-coverage.sh -F GHA,${{ runner.os }} + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: set PY + run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" + - uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - run: pip install tox + - run: tox -e linting + deploy: if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'