From 6f2656eb490dff7cd15546ee5f52e2633f720a92 Mon Sep 17 00:00:00 2001 From: haixuantao Date: Wed, 15 Jan 2025 16:36:34 +0100 Subject: [PATCH] Replace poetry with uv in CI/CD --- .github/workflows/node-hub-ci-cd.yml | 19 +++++++++---------- .github/workflows/node_hub_test.sh | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/node-hub-ci-cd.yml b/.github/workflows/node-hub-ci-cd.yml index 591d4877..c4d9d8ee 100644 --- a/.github/workflows/node-hub-ci-cd.yml +++ b/.github/workflows/node-hub-ci-cd.yml @@ -81,10 +81,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 ruff pytest @@ -100,7 +99,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 @@ -141,9 +139,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 @@ -154,7 +152,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) @@ -167,7 +165,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. @@ -183,13 +181,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 diff --git a/.github/workflows/node_hub_test.sh b/.github/workflows/node_hub_test.sh index 71905996..ae7e119d 100755 --- a/.github/workflows/node_hub_test.sh +++ b/.github/workflows/node_hub_test.sh @@ -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 @@ -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 . ruff check . pytest fi