Skip to content

Commit

Permalink
use uv for testing and requirements pinning
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhsmit committed Nov 27, 2024
1 parent 7fd9c58 commit ff19b20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/pin_requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.9", "3.10"]
python-version: ["3.10"]
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install pip-tools
run: pip install pip-tools
# Install a specific version of uv.
version: "0.5.4"

- name: Generate requirements file
run: pip-compile --output-file requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt pyproject.toml
run: uv pip compile --all-extras pyproject.toml -o requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt

- name: Upload requirements file
uses: actions/upload-artifact@v3
Expand Down
35 changes: 16 additions & 19 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,28 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" , "windows-latest"]
python-version: ["3.9", "3.10" ]
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
python-version: ["3.10" ]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements/requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt

- name: Install pinned requirements
# Install a specific version of uv.
version: "0.5.4"
enable-cache: true
cache-dependency-glob: requirements/requirements-ubuntu-latest-${{ matrix.python-version }}.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt --prefer-binary
- name: Install test requirements
run: pip install .[test]
python -m pip install uv
uv venv -p ${{ matrix.python-version }}
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
uv pip install -r requirements/requirements-ubuntu-latest-${{ matrix.python-version }}.txt
uv pip install -e .
- name: Run tests
run: |
Expand Down

0 comments on commit ff19b20

Please sign in to comment.