Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Optional local speedup on Linux (do not commit — CI may not have mold):
# [target.x86_64-unknown-linux-gnu]
# rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=mold"]

[build]
target-dir = "target"
incremental = true

# tree-sitter (via pulsing-forge) needs BSD endian macros when built against
# glibc 2.17 (manylinux2014). Its build.rs sets _DEFAULT_SOURCE, which glibc
# 2.17 ignores, leaving le16toh/be16toh undefined at link/load time.
[env]
CFLAGS = { value = "-D_GNU_SOURCE", condition = { platform = "linux" } }
4 changes: 4 additions & 0 deletions .cursor/rules/codestyle.mdc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
description:
alwaysApply: true
---

代码尽量简洁,不要过度抽象
接口优于面条代码
喜欢unix编程艺术
喜欢rust和haskell的设计理念
20 changes: 20 additions & 0 deletions .github/actions/setup-build-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ runs:
${{ runner.os }}-cargo-${{ inputs.rust-toolchain }}-
${{ runner.os }}-cargo-
- uses: cargo-bins/cargo-binstall@main
- name: Install Linux GUI build dependencies
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends \
libxcb1-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
libx11-dev \
libxi-dev \
libxrandr-dev \
libxcursor-dev \
libxinerama-dev \
libgl1-mesa-dev \
libfontconfig1-dev \
libfreetype6-dev \
libffi-dev \
pkg-config

- name: Install cargo tools
if: inputs.install-cargo-tools == 'true'
shell: bash
Expand Down
49 changes: 38 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
# 构建 macOS Wheel
# ============================================
build-macos:
name: Build Wheel (macOS)
name: Build (macOS wheel + binary)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -124,30 +124,41 @@ jobs:
args: --release --out dist
sccache: 'true'

- name: Build pulsing binary
run: bash scripts/build-binary.sh --release --package

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: dist/*.whl

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-macos
path: |
dist/bin/*
dist/pulsing-*.tar.gz

# ============================================
# 构建 Linux x86-64 Wheel (使用 just 命令)
# 构建 Linux x86-64 (wheel + binary)
# ============================================
build-linux-x86-64:
name: Build Wheel (Linux x86-64)
name: Build (Linux x86-64 wheel + binary)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build wheel in manylinux container
- name: Build wheel + binary in manylinux container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace -w /workspace \
quay.io/pypa/manylinux2014_x86_64 \
bash -c "
curl -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin && \
just ci-setup-manylinux && \
just ci-build manylinux=true
just ci-build manylinux=true package=package
"

- name: Upload wheels
Expand All @@ -156,11 +167,19 @@ jobs:
name: wheels-linux-x86-64
path: dist/*.whl

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-linux-x86-64
path: |
dist/bin/*
dist/pulsing-*.tar.gz

# ============================================
# 构建 Linux aarch64 Wheel(使用 QEMU 仿真原生构建)
# ============================================
build-linux-aarch64:
name: Build Wheel (Linux aarch64)
name: Build (Linux aarch64 wheel + binary)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -173,15 +192,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build wheel in QEMU
- name: Build wheel + binary in QEMU
run: |
docker run --rm --platform linux/arm64 \
-v ${{ github.workspace }}:/workspace -w /workspace \
quay.io/pypa/manylinux2014_aarch64 \
bash -c "
curl -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin && \
just ci-setup-manylinux && \
just ci-build manylinux=true
just ci-build manylinux=true package=package
"

- name: Upload wheels
Expand All @@ -190,6 +209,14 @@ jobs:
name: wheels-linux-aarch64
path: dist/*.whl

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-linux-aarch64
path: |
dist/bin/*
dist/pulsing-*.tar.gz

# ============================================
# macOS Python 测试(多 Python 版本)
# ============================================
Expand Down Expand Up @@ -218,7 +245,7 @@ jobs:

- name: Install wheel and test dependencies
run: |
pip install dist/*.whl
pip install dist/pulsing-*.whl
pip install pytest pytest-asyncio pytest-cov

- name: Test with pytest
Expand Down Expand Up @@ -258,7 +285,7 @@ jobs:

- name: Install wheel and test dependencies
run: |
pip install dist/*.whl
pip install dist/pulsing-*.whl
pip install pytest pytest-asyncio pytest-cov

- name: Test with pytest
Expand Down Expand Up @@ -356,7 +383,7 @@ jobs:

- name: Install wheel and test dependencies
run: |
pip install dist/*.whl
pip install dist/pulsing-*.whl
pip install pytest pytest-asyncio pytest-cov

- name: Run tests and collect coverage
Expand Down
47 changes: 43 additions & 4 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Build wheel in manylinux container
- name: Build wheel + binary in manylinux container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace -w /workspace \
quay.io/pypa/manylinux2014_x86_64 \
bash -c "
curl -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin && \
just ci-setup-manylinux && \
just ci-build manylinux=true
just ci-build manylinux=true package=package
"

- name: Upload wheels
Expand All @@ -38,6 +38,14 @@ jobs:
name: wheels-linux-x86-64
path: dist

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-linux-x86-64
path: |
dist/bin/*
dist/pulsing-*.tar.gz

# ============================================
# Build Linux aarch64 wheels (使用 QEMU 仿真原生构建)
# ============================================
Expand All @@ -55,15 +63,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build wheel in QEMU
- name: Build wheel + binary in QEMU
run: |
docker run --rm --platform linux/arm64 \
-v ${{ github.workspace }}:/workspace -w /workspace \
quay.io/pypa/manylinux2014_aarch64 \
bash -c "
curl -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin && \
just ci-setup-manylinux && \
just ci-build manylinux=true
just ci-build manylinux=true package=package
"

- name: Upload wheels
Expand All @@ -72,6 +80,14 @@ jobs:
name: wheels-linux-aarch64
path: dist

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-linux-aarch64
path: |
dist/bin/*
dist/pulsing-*.tar.gz

# ============================================
# Build macOS wheels (arm64 + x86_64)
# ============================================
Expand Down Expand Up @@ -100,12 +116,23 @@ jobs:
args: --release --out dist
sccache: 'true'

- name: Build pulsing binary
run: bash scripts/build-binary.sh --release --package

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: dist

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-macos
path: |
dist/bin/*
dist/pulsing-*.tar.gz

# ============================================
# Build Windows wheels
# ============================================
Expand All @@ -129,12 +156,24 @@ jobs:
args: --release --out dist
sccache: 'true'

- name: Build pulsing binary
shell: bash
run: bash scripts/build-binary.sh --release --package

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: bin-windows
path: |
dist/bin/*
dist/pulsing-*.zip

# ============================================
# Build source distribution
# ============================================
Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,15 @@ docs/site/
stress_test_*.json
queue_benchmark_*.json
dist/*.whl
dist/bin/
dist/pulsing-*.tar.gz
dist/pulsing-*.zip

# npc workspace local state (per-project; run `npc init` in your app repo)
.pulsing/

# Vendored Codex reference tree (refresh: scripts/sync-codex-forge.sh)
vendor/
.cursor/
.claude/
.devcontainer/
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ uv run python -c "import pulsing; print(pulsing.__version__)"
项目使用 [just](https://github.com/casey/just) 作为任务运行器,所有常用命令都在 `Justfile` 中定义。

```bash
just dev # 编译并安装(开发模式,等同于 maturin develop)
just test # 运行全部测试(Rust + Python)
just dev # 编译并安装(开发模式,等同于 maturin develop)
just build-release # 发布构建:当前平台 wheel + pulsing 单文件二进制
just test # 运行全部测试(Rust + Python)
just test-python # 仅运行 Python 测试
just test-rust # 仅运行 Rust 测试
just fmt # 格式化代码(Rust + Python)
Expand Down
Loading
Loading