Skip to content

Commit

Permalink
Feat: integrate uv in the ci pipelines and the docs (sparckles#1040)
Browse files Browse the repository at this point in the history
* Feat: migrate codspeed workflow to uv

* fix: some commands and pin 3.8

* fix: minor bugs

* feat: migrate lint-pr action to uv

* fix codespeed action

* feat: migrate to uv for preview-deployments action

* revert: changes revert to original

* fix: poetry install bug in workflow

* fix: Improve action and the speed

* fix: Improve the speed of the action

* fix: use the global packages

* Migrate preview-deployments action to uv

* feat: Migrate release-CI to uv
  • Loading branch information
Mr-Sunglasses authored Nov 22, 2024
1 parent 4029312 commit 9a95611
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 30 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,38 @@ on:
# performance analysis in order to generate initial data.
workflow_dispatch:

env:
UV_SYSTEM_PYTHON: 1

jobs:
benchmarks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: actions/setup-python@v5
with:
python-version: "3.8"

- name: Install dependencies

- name: Install dependencies with uv
run: |
python -m pip install --upgrade pip
pip install poetry==1.3.0
poetry export --with test --with dev --without-hashes --output requirements.txt
pip install -r requirements.txt
pip install -e .
uv pip install poetry
uv run poetry export --with test --with dev --without-hashes --output requirements.txt
uv pip install -r requirements.txt
uv pip install -e .
- name: Add macos target
if: matrix.os == 'macos'
run: rustup target add aarch64-apple-darwin
- name: Setup Rust part of the project
run: |
maturin build -i python --universal2 --out dist
pip install --no-index --find-links=dist/ robyn
uv pip install --no-index --find-links=dist/ robyn
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest integration_tests --codspeed
run: pytest integration_tests --codspeed
22 changes: 14 additions & 8 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ on:
pull_request:
branches: [main]


env:
UV_SYSTEM_PYTHON: 1

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
python-version: "3.11"

- name: Install dependencies with uv
run: |
python -m pip install --upgrade pip
pip install ruff isort black
uv pip install ruff isort black
- name: Run linters
run: |
ruff check .
isort --check-only --diff .
uv run ruff check .
uv run isort --check-only --diff .
19 changes: 14 additions & 5 deletions .github/workflows/preview-deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
branches:
- main

env:
UV_SYSTEM_PYTHON: 1

jobs:
macos:
runs-on: macos-12
Expand All @@ -19,6 +22,8 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -32,15 +37,15 @@ jobs:
args: -i python --release --out dist --no-sdist
- name: Install build wheel - x86_64
run: |
pip install --force-reinstall dist/robyn*.whl
uv pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
- name: Build wheels - universal2
uses: PyO3/maturin-action@v1
with:
args: -i python --release --universal2 --out dist --no-sdist
- name: Install build wheel - universal2
run: |
pip install --force-reinstall dist/robyn*_universal2.whl
uv pip install --force-reinstall dist/robyn*_universal2.whl
cd ~ && python -c 'import robyn'
windows:
Expand All @@ -51,6 +56,8 @@ jobs:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -64,7 +71,7 @@ jobs:
- name: Install build wheel
shell: bash
run: |
pip install --force-reinstall dist/robyn*.whl
uv pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
linux:
Expand All @@ -76,6 +83,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -88,7 +97,7 @@ jobs:
- name: Install build wheel
if: matrix.target == 'x86_64'
run: |
pip install --force-reinstall dist/robyn*.whl
uv pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
linux-cross:
Expand Down Expand Up @@ -140,4 +149,4 @@ jobs:
source venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
cd ~ && python -c 'import robyn'
28 changes: 19 additions & 9 deletions .github/workflows/release-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- v*
env:
UV_SYSTEM_PYTHON: 1
jobs:
macos:
runs-on: macos-12
Expand All @@ -12,7 +14,9 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -25,15 +29,15 @@ jobs:
args: -i python --release --out dist
- name: Install build wheel - x86_64
run: |
pip install --force-reinstall dist/robyn*.whl
uv pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
- name: Build wheels - universal2
uses: PyO3/maturin-action@v1
with:
args: -i python --release --universal2 --out dist
- name: Install build wheel - universal2
run: |
pip install --force-reinstall dist/robyn*_universal2.whl
uv pip install --force-reinstall dist/robyn*_universal2.whl
cd ~ && python -c 'import robyn'
- name: Upload wheels
uses: actions/upload-artifact@v3
Expand All @@ -48,7 +52,9 @@ jobs:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
Expand All @@ -61,7 +67,7 @@ jobs:
- name: Install build wheel
shell: bash
run: |
pip install --force-reinstall dist/robyn*.whl
uv pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
- name: Upload wheels
uses: actions/upload-artifact@v3
Expand All @@ -77,7 +83,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build Wheels
Expand All @@ -89,7 +97,7 @@ jobs:
- name: Install build wheel
if: matrix.target == 'x86_64'
run: |
pip install --force-reinstall dist/robyn*.whl
uv pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
- name: Upload wheels
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -158,13 +166,15 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
uv pip install --upgrade twine
twine upload --skip-existing *

0 comments on commit 9a95611

Please sign in to comment.