From 4e6869d2c5bf4a7bd9aeddc3d12e417558ec4f94 Mon Sep 17 00:00:00 2001 From: David Peter Date: Wed, 2 Apr 2025 14:03:43 +0200 Subject: [PATCH] [red-knot] Build red knot wheels --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ crates/red_knot/pyproject.toml | 20 ++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 crates/red_knot/pyproject.toml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a8cdff5088..dee20f51a7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -836,3 +836,34 @@ jobs: with: run: cargo codspeed run token: ${{ secrets.CODSPEED_TOKEN }} + + python-package-red-knot: + name: "python package (red knot)" + runs-on: ubuntu-latest + timeout-minutes: 20 + if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + persist-credentials: false + - uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5 + - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2 + - name: "Build wheels" + uses: PyO3/maturin-action@22fe573c6ed0c03ab9b84e631cbfa49bddf6e20e # v1.47.3 + with: + working-directory: crates/red_knot + args: --out ${{ github.workspace }}/dist + - name: "Test wheel" + id: test-wheel + run: | + WHEEL_PATH="$(find ${{ github.workspace }}/dist -name 'red_knot-*.whl' -print -quit)" + WHEEL_NAME="$(basename "$WHEEL_PATH")" + echo "Wheel: $WHEEL_PATH" + uvx --from "$WHEEL_PATH" red_knot --help + + echo "wheel_name=$WHEEL_NAME" >> "$GITHUB_OUTPUT" + echo "wheel_path=$WHEEL_PATH" >> "$GITHUB_OUTPUT" + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: ${{ steps.test-wheel.outputs.wheel_name }} + path: ${{ steps.test-wheel.outputs.wheel_path }} diff --git a/crates/red_knot/pyproject.toml b/crates/red_knot/pyproject.toml new file mode 100644 index 0000000000..b5f037e1be --- /dev/null +++ b/crates/red_knot/pyproject.toml @@ -0,0 +1,20 @@ +[project] +name = "red_knot" +version = "0.1.0" +description = "An extremely fast Python type checker." +authors = [{ name = "Astral Software Inc.", email = "hey@astral.sh" }] +readme = "README.md" +license = "MIT" + +[project.urls] +Repository = "https://github.com/astral-sh/ruff" + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[tool.maturin] +bindings = "bin" +manifest-path = "Cargo.toml" +module-name = "red_knot" +strip = true