xqpath 1.4.3

A high-performance jq-inspired path extractor and updater for structured data in Rust with advanced debugging, configuration management and interactive debugging capabilities
Documentation
# GitHub Actions CI 工作流配置
# 集成了测试脚本和Makefile的优化CI流程

name: CI

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main, develop]

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  RUSTFLAGS: -D warnings

jobs:
  # 快速检查 - 代码格式和语法
  quick-check:
    name: 快速检查
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: 安装 Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: 缓存 Cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: 代码格式检查
        run: cargo fmt --all -- --check

      - name: 代码质量检查
        run: make lint

      - name: 语法检查
        run: make check

  # 核心功能测试
  test-core:
    name: 核心测试
    runs-on: ubuntu-latest
    needs: quick-check

    steps:
      - uses: actions/checkout@v4

      - name: 安装 Rust
        uses: dtolnay/rust-toolchain@stable

      - name: 缓存 Cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-test-core-${{ hashFiles('**/Cargo.lock') }}

      - name: 运行核心测试
        run: make test-core

  # Feature 特性测试 - 并行执行
  test-features:
    name: 特性测试
    runs-on: ubuntu-latest
    needs: quick-check
    strategy:
      matrix:
        feature: [config, debug]

    steps:
      - uses: actions/checkout@v4

      - name: 安装 Rust
        uses: dtolnay/rust-toolchain@stable

      - name: 缓存 Cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-${{ matrix.feature }}-${{ hashFiles('**/Cargo.lock') }}

      - name: 测试 ${{ matrix.feature }} 功能
        run: make test-${{ matrix.feature }}

  # 完整测试套件
  test-full:
    name: 完整测试
    runs-on: ubuntu-latest
    needs: [test-core, test-features]

    steps:
      - uses: actions/checkout@v4

      - name: 安装 Rust
        uses: dtolnay/rust-toolchain@stable

      - name: 缓存 Cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-full-test-${{ hashFiles('**/Cargo.lock') }}

      - name: 运行完整测试
        run: make test-all

      - name: 测试统计
        run: make test-stats

  # 跨平台测试
  test-cross-platform:
    name: 跨平台测试
    runs-on: ${{ matrix.os }}
    needs: test-core
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
      - uses: actions/checkout@v4

      - name: 安装 Rust
        uses: dtolnay/rust-toolchain@stable

      - name: 缓存 Cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cross-${{ hashFiles('**/Cargo.lock') }}

      - name: 快速测试 (Unix)
        if: runner.os != 'Windows'
        run: |
          chmod +x scripts/test-runner.sh
          ./scripts/test-runner.sh quick -q

      - name: 快速测试 (Windows)
        if: runner.os == 'Windows'
        run: cargo test --features config-management,interactive-debug --quiet

  # 发布前检查 (仅主分支)
  pre-release:
    name: 发布前检查
    runs-on: ubuntu-latest
    needs: [test-full, test-cross-platform]
    if: github.ref == 'refs/heads/main'

    steps:
      - uses: actions/checkout@v4

      - name: 安装 Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: 缓存 Cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}

      - name: 发布前检查
        run: make pre-release

      - name: 构建发布版本
        run: make release

      - name: 上传构建产物
        uses: actions/upload-artifact@v4
        with:
          name: xqpath-release-${{ github.sha }}
          path: target/release/xqpath*