Skip to content

Commit

Permalink
Replace poetry with uv in CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
haixuanTao committed Jan 15, 2025
1 parent 9f64eae commit a6e8c9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/node-hub-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ jobs:
with:
python-version: "3.10"

- name: Set up UV and poetry
- name: Set up UV
if: runner.os == 'Linux' || github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/'))
run: |
curl -sSL https://install.python-poetry.org | python3 -
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
uv pip install black pylint pytest
Expand All @@ -91,7 +90,6 @@ jobs:
## Run Linting and testing only on Mac for release workflows.
if: runner.os == 'Linux' || github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/'))
run: |
alias pip="uv pip"
chmod +x ../../.github/workflows/node_hub_test.sh
../../.github/workflows/node_hub_test.sh
Expand Down Expand Up @@ -132,9 +130,9 @@ jobs:
with:
python-version: "3.10"

- name: Set up Poetry
- name: Set up UV
run: |
curl -sSL https://install.python-poetry.org | python3 -
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up Rust
Expand All @@ -145,7 +143,7 @@ jobs:
- name: Publish Projects
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASS }}
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_PASS }}
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_PASS }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
dir=$(pwd)
Expand All @@ -158,7 +156,7 @@ jobs:
if [[ -f "Cargo.toml" && -f "pyproject.toml" ]]; then
echo "Publishing $dir using maturin..."
if [[ "${{ runner.os }}" == "Linux" ]]; then
pip3 install "maturin[zig]"
uv pip install "maturin[zig]"
## The CI/CD is sequential to limit the number of workers used.
Expand All @@ -174,13 +172,14 @@ jobs:
maturin publish --target armv7-unknown-linux-musleabihf --zig --skip-existing
else
pip3 install maturin
uv pip install maturin
maturin publish --skip-existing
fi
else
if [ -f "pyproject.toml" ]; then
echo "Publishing $dir using Poetry..."
poetry publish --build --skip-existing
echo "Publishing $dir using UV..."
uv build
uv publish
fi
if [ -f "Cargo.toml" ]; then
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node_hub_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ else
cargo build
cargo test

pip3 install "maturin[zig]"
uv pip install "maturin[zig]"
maturin build --zig

# aarch64-unknown-linux-gnu
Expand All @@ -42,7 +42,7 @@ else
else
if [ -f "$dir/pyproject.toml" ]; then
echo "Running linting and tests for Python project in $dir..."
pip install .
uv pip install .
black --check .
pylint --disable=C,R --ignored-modules=cv2,pyrealsense2 **/*.py
pytest
Expand Down

0 comments on commit a6e8c9c

Please sign in to comment.