mc-mcp 0.1.10

A Model Context Protocol (MCP) server for metacontract smart contract development.
name: CI

on:
  push:
    branches: [ main ]
    tags: [ 'v*.*.*' ]
  pull_request:
    branches: [ main, dev ]

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout mc-mcp
        uses: actions/checkout@v4

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true

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

      - name: Cache cargo build
        uses: actions/cache@v3
        with:
          path: target
          key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}

      - name: Build
        run: cargo build --all --release

      - name: Run tests (all, including ignored)
        run: |
          cargo test --all -- --test-threads=1
          cargo test --all -- --ignored --test-threads=1

  build-and-release-index:
    needs: build-and-test
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout mc-mcp
        uses: actions/checkout@v4

      - name: Checkout metacontract-docs
        uses: actions/checkout@v4
        with:
          repository: metacontract/mc
          path: mc

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true

      - name: Prepare artifacts directory
        run: mkdir -p artifacts

      - name: Build prebuilt index
        run: cargo run --release --bin build_index -- mc/site/docs artifacts/prebuilt_index.jsonl || (echo "build_index failed, listing docs dir:" && ls -lR mc/site/docs && exit 1)

      - name: Compress index
        run: gzip -9 -f artifacts/prebuilt_index.jsonl

      - name: Archive docs directory
        run: tar -czvf artifacts/docs.tar.gz -C mc/site docs

      - name: Create Release and Upload Asset
        uses: softprops/action-gh-release@v1
        with:
          files: |
            artifacts/prebuilt_index.jsonl.gz
            artifacts/docs.tar.gz