Skip to content

Commit

Permalink
Use uv instead of pip during tests
Browse files Browse the repository at this point in the history
While also using uv cache if the dependencies are the same in requirements and requirements-dev

fix: Auto-detection of python version

fix: Missed comment

Fix suggestions
  • Loading branch information
AtomHare committed May 21, 2024
1 parent 20149f3 commit da92413
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/lintandformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,22 @@ jobs:
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.11"
cache: "pip"

- name: Cache uv folder
id: cache-uv
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-uv-${{ hashFiles('requirements-common.txt', 'requirements-dev.txt') }}

- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install "fastapi[all]"
run: uv pip install --system -r requirements-dev.txt

- name: Cache .ruff_cache folder
id: ruff_cache
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,22 @@ jobs:
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.11"
cache: "pip"

- name: Cache uv folder
id: cache-uv
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-uv-${{ hashFiles('requirements-common.txt', 'requirements-dev.txt') }}

- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install "fastapi[all]"
run: uv pip install --system -r requirements-dev.txt

- name: Cache .pytest_cache folder
id: pytest_cache
Expand Down

0 comments on commit da92413

Please sign in to comment.