Skip to content

Commit

Permalink
✏️ Add UV Cache github action
Browse files Browse the repository at this point in the history
  • Loading branch information
yezz123 committed Aug 25, 2024
1 parent 1c9a220 commit 9486505
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Test UV Cache Action

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test-uv-cache:
runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- macos-latest
- ubuntu-latest
- windows-latest
fail-fast: true

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup UV
uses: ./
with:
uv-version: 'latest'
uv-cache-dir: ~/.uv-cache

- name: Test UV installation
run: uv --version

- name: Create requirements file
run: |
echo "requests==2.26.0" > requirements.txt
echo "pandas==1.3.3" >> requirements.txt
- name: Install dependencies with UV
run: |
uv pip install -r requirements.txt
- name: Verify installations
run: |
python -c "import requests; import pandas; print('Imports successful')"
- name: Clear local UV cache
run: rm -rf ~/.uv-cache

- name: Setup UV again (should use cache)
uses: ./
with:
uv-version: 'latest'
uv-cache-dir: ~/.uv-cache

- name: Verify cache restored
run: |
uv pip list | grep -E "requests|pandas" || (echo "Cache restore failed" && exit 1)
- name: Install new package
run: uv pip install numpy

- name: Verify new installation
run: python -c "import numpy; print('Numpy import successful')"

0 comments on commit 9486505

Please sign in to comment.