obsidian-cli-inspector 1.0.3

Local-first CLI/TUI for indexing and querying Obsidian vaults
Documentation
name: PR Workflow

on:
  pull_request:
    branches: [ master, alpha ]
  workflow_dispatch:

concurrency:
  group: pr-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUST_TOOLCHAIN: 1.91.1

jobs:
  commit-lint:
    name: Enforce Conventional Commits
    runs-on: ubuntu-latest
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')

    permissions:
      contents: read

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Run commitlint
        uses: wagoid/commitlint-github-action@v6
        with:
          configFile: commitlint.config.mjs

  validate:
    name: Lint & Format
    runs-on: ubuntu-latest
    needs: [commit-lint]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')

    permissions:
      contents: read

    steps:
      - uses: actions/checkout@v4

      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          components: rustfmt, clippy

      - uses: Swatinem/rust-cache@v2

      - name: Format check
        run: make fmt-check

      - name: Clippy check
        run: make clippy-check

  unittest:
    name: Unit Tests
    runs-on: ubuntu-latest
    needs: [validate]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')

    permissions:
      contents: read

    steps:
      - uses: actions/checkout@v4

      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}

      - uses: Swatinem/rust-cache@v2

      - name: Run tests
        run: make test

  e2e:
    name: E2E Tests
    runs-on: ubuntu-latest
    needs: [validate]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')

    permissions:
      contents: read

    steps:
      - uses: actions/checkout@v4

      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}

      - uses: Swatinem/rust-cache@v2

      - name: test unified contracts
        run: make -C tests/e2e contracts

  coverage:
    name: coverage
    runs-on: ubuntu-latest
    needs: [unittest, e2e]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}

      - name: Rust Cache
        uses: Swatinem/rust-cache@v2

      - name: Install kcov dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev

      - name: Build and install kcov
        run: |
          wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
          tar xzf master.tar.gz
          cd kcov-master
          mkdir build
          cd build
          cmake ..
          make
          sudo make install
          cd ../..
          rm -rf kcov-master master.tar.gz

      - name: Generate coverage with kcov
        run: make coverage

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          directory: target/cov/
          fail_ci_if_error: true
  cargo-publish-dry-run:
    name: Cargo Publish Dry Run
    runs-on: ubuntu-latest
    needs: [coverage]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')

    permissions:
      contents: read

    steps:
      - uses: actions/checkout@v4

      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}

      - uses: Swatinem/rust-cache@v2

      - name: Verify crate can be published
        run: cargo publish --dry-run --locked

  aur-publish-dry-run:
    name: AUR Build
    needs: [coverage]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')
    uses: ./.github/workflows/aur-build.yml

  aur-unstable-git-dry-run:
    name: AUR Unstable Git Build (Dry Run)
    needs: [coverage]
    if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending')
    uses: ./.github/workflows/aur-unstable-git-build.yml
    with:
      ref: ${{ github.head_ref }}
      publish: false