Skip to content

Commit

Permalink
Change python caching
Browse files Browse the repository at this point in the history
  • Loading branch information
philgyford committed Jul 20, 2024
1 parent c7f94b4 commit 2ae28ce
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,27 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"

# Via https://adamj.eu/tech/2023/11/02/github-actions-faster-python-virtual-environments/
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
path: .venv

- name: Install dependencies
run: python -m pip install -r requirements.txt
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: Saved cached virtualenv
uses: actions/cache/save@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
path: .venv

- name: Run ruff
# ruff is already installed from our requirements
Expand Down

0 comments on commit 2ae28ce

Please sign in to comment.