Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching for Python dependencies in GitHub Actions workflow #753

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/actions/Cache Python dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry # or change based on the tool you use
key: ${{ runner.os }}-python-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-python-

- name: Install dependencies
run: |
pip install hatch
hatch env create # creates the virtual environment and installs dependencies

- name: Run tests
run: hatch run test