Split Databricks provider into CLI and REST implementations #524
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
| jobs: | |
| rust-checks: | |
| name: Check and Clippy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Cache cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: edda | |
| - name: Run cargo check all targets | |
| working-directory: ./edda | |
| run: cargo check --all-targets --workspace | |
| - name: Run cargo clippy | |
| working-directory: ./edda | |
| run: cargo clippy --workspace -- -W warnings | |
| continue-on-error: true | |
| rust-tests: | |
| name: Rust Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@nextest | |
| - name: Cache cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: edda | |
| - name: Run unit tests | |
| working-directory: ./edda | |
| run: cargo nextest run --lib --bins --workspace | |
| - name: Run integration tests | |
| working-directory: ./edda | |
| # Run with single thread due to Dagger connection race conditions | |
| # Exclude postponed crates (edda_agent, edda_cli) - they contain expensive E2E tests | |
| # that require LLM API calls, cost money, and test functionality that's currently postponed | |
| # Note: Tests with #[cfg_attr(not(feature = "dagger"), ignore)] will be skipped here | |
| # and run in the rust-tests-dagger job instead | |
| run: cargo nextest run --tests --workspace --exclude edda_agent --exclude edda_cli --test-threads=1 | |
| rust-tests-dagger: | |
| name: Rust Tests (Dagger) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@nextest | |
| - name: Cache cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: edda | |
| - name: Install Dagger CLI | |
| run: | | |
| curl -fsSL https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.19.2 BIN_DIR=/usr/local/bin sh | |
| - name: Run Dagger tests | |
| working-directory: ./edda | |
| # Run with single thread due to Dagger connection race conditions | |
| run: cargo nextest run --tests --workspace --features dagger --test-threads=1 | |
| check-release-condition: | |
| name: Check Release Condition | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| should_build: ${{ steps.check.outputs.should_build }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Check if release build needed | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| should_build="false" | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| # Always build on push to main | |
| should_build="true" | |
| echo "Rust build detected: push to main branch" | |
| elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # For PRs: check if edda_mcp Cargo.toml changed AND has [release] keyword | |
| PR_NUM=${{ github.event.pull_request.number }} | |
| # Check if Cargo.toml in changed files | |
| if gh pr diff $PR_NUM --name-only | grep -q "edda/edda_mcp/Cargo.toml"; then | |
| # Check if the latest commit has [release] keyword | |
| LAST_COMMIT_MSG=$(gh pr view $PR_NUM --json commits --jq '.commits[-1].messageHeadline') | |
| if [[ "$LAST_COMMIT_MSG" == *"[release]"* ]]; then | |
| should_build="true" | |
| echo "Rust build detected: Cargo.toml change + [release] keyword in latest commit" | |
| else | |
| echo "Cargo.toml changed but no [release] keyword in latest commit - skipping build" | |
| fi | |
| fi | |
| fi | |
| echo "should_build=${should_build}" >> $GITHUB_OUTPUT | |
| build-edda-mcp: | |
| name: Build edda_mcp (${{ matrix.platform }}) | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 15 | |
| needs: [rust-checks, rust-tests, rust-tests-dagger, check-release-condition] | |
| if: needs.check-release-condition.outputs.should_build == 'true' | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux-x86_64 | |
| runner: ubuntu-latest | |
| - platform: macos-arm64 | |
| runner: macos-15-xlarge | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: edda | |
| - name: Build release binary | |
| run: | | |
| cd edda | |
| cargo build --release -p edda_mcp | |
| ls -la target/release/ | |
| env: | |
| # Disable LTO on macOS for faster builds | |
| CARGO_PROFILE_RELEASE_LTO: ${{ matrix.platform == 'macos-arm64' && 'off' || 'thin' }} | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: edda-mcp-${{ matrix.platform }} | |
| path: edda/target/release/edda_mcp | |
| retention-days: 30 | |
| smoke-test-mcp: | |
| name: Smoke Test MCP Binary (${{ matrix.platform }}) | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 5 | |
| needs: build-edda-mcp | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux-x86_64 | |
| runner: ubuntu-latest | |
| - platform: macos-arm64 | |
| runner: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Download binary artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: edda-mcp-${{ matrix.platform }} | |
| path: ./binary | |
| - name: Make binary executable | |
| run: chmod +x ./binary/edda_mcp | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Run smoke test | |
| run: python3 scripts/smoke_test_mcp.py ./binary/edda_mcp | |
| env: | |
| DATABRICKS_HOST: "dummy" | |
| DATABRICKS_TOKEN: "dummy" | |
| DATABRICKS_WAREHOUSE_ID: "dummy" | |
| detect-release: | |
| name: Detect Version and Validate | |
| runs-on: ubuntu-latest | |
| needs: [check-release-condition, smoke-test-mcp] | |
| if: needs.check-release-condition.outputs.should_build == 'true' | |
| outputs: | |
| version: ${{ steps.extract.outputs.version }} | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| tag_exists: ${{ steps.tag_check.outputs.tag_exists }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 2 | |
| - name: Extract version from Cargo.toml | |
| id: extract | |
| run: | | |
| VERSION=$(grep '^version = ' edda/edda_mcp/Cargo.toml | head -n1 | sed 's/version = "\(.*\)"/\1/') | |
| echo "Extracted version: $VERSION" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check release conditions | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| should_release="false" | |
| # Check if Cargo.toml was changed | |
| if git diff --name-only HEAD~1 HEAD | grep -q "edda/edda_mcp/Cargo.toml"; then | |
| # For main branch, always release on Cargo.toml change | |
| if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| should_release="true" | |
| echo "Release detected: Cargo.toml change on main" | |
| elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # For PRs, check for [release] keyword in latest commit | |
| PR_NUM=${{ github.event.pull_request.number }} | |
| LAST_COMMIT_MSG=$(gh pr view $PR_NUM --json commits --jq '.commits[-1].messageHeadline') | |
| if [[ "$LAST_COMMIT_MSG" == *"[release]"* ]]; then | |
| should_release="true" | |
| echo "Release detected: Cargo.toml change + [release] keyword in latest commit" | |
| fi | |
| fi | |
| fi | |
| echo "should_release=$should_release" >> $GITHUB_OUTPUT | |
| - name: Validate version format | |
| if: steps.check.outputs.should_release == 'true' | |
| run: | | |
| VERSION="${{ steps.extract.outputs.version }}" | |
| # Check if this is a PR or push to main | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # PR releases must have -dev prefix | |
| if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-dev ]]; then | |
| echo "Error: PR releases must use dev version format (e.g., 0.0.3-dev.1)" | |
| echo "Found: $VERSION" | |
| exit 1 | |
| fi | |
| else | |
| # Main branch releases must NOT have any suffix | |
| if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Error: Main branch releases must follow format 0.0.0 (no suffix)" | |
| echo "Found: $VERSION" | |
| exit 1 | |
| fi | |
| fi | |
| - name: Check if tag already exists | |
| id: tag_check | |
| if: steps.check.outputs.should_release == 'true' | |
| run: | | |
| VERSION="${{ steps.extract.outputs.version }}" | |
| if git ls-remote --tags origin | grep -q "refs/tags/v$VERSION$"; then | |
| echo "⚠️ Tag v$VERSION already exists - skipping release" | |
| echo "Reason: Version $VERSION has already been released." | |
| echo "Action required: Bump the version in edda/edda_mcp/Cargo.toml to create a new release." | |
| echo "tag_exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "✓ Tag v$VERSION does not exist - proceeding with release" | |
| echo "tag_exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: detect-release | |
| if: needs.detect-release.outputs.should_release == 'true' && needs.detect-release.outputs.tag_exists != 'true' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Linux artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: edda-mcp-linux-x86_64 | |
| path: artifacts/linux | |
| - name: Download macOS artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: edda-mcp-macos-arm64 | |
| path: artifacts/macos | |
| - name: Prepare artifacts for release | |
| run: | | |
| mkdir -p release | |
| mv artifacts/linux/edda_mcp release/edda_mcp-linux-x86_64 | |
| mv artifacts/macos/edda_mcp release/edda_mcp-macos-arm64 | |
| chmod +x release/* | |
| ls -lh release/ | |
| - name: Create git tag | |
| run: | | |
| VERSION="${{ needs.detect-release.outputs.version }}" | |
| COMMIT_SHA="${{ github.sha }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag "v$VERSION" "$COMMIT_SHA" | |
| git push origin "v$VERSION" | |
| - name: Create GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| VERSION="${{ needs.detect-release.outputs.version }}" | |
| # Generate checksums | |
| cd release | |
| LINUX_CHECKSUM=$(sha256sum edda_mcp-linux-x86_64 | awk '{print $1}') | |
| MACOS_CHECKSUM=$(sha256sum edda_mcp-macos-arm64 | awk '{print $1}') | |
| cd .. | |
| cat > release_notes.md <<EOF | |
| Release v$VERSION | |
| ## SHA256 Checksums | |
| \`\`\` | |
| $LINUX_CHECKSUM edda_mcp-linux-x86_64 | |
| $MACOS_CHECKSUM edda_mcp-macos-arm64 | |
| \`\`\` | |
| EOF | |
| # Determine release flags based on version and branch | |
| RELEASE_FLAGS="" | |
| if [[ "$VERSION" =~ -dev ]]; then | |
| # Dev versions are pre-releases, not latest | |
| RELEASE_FLAGS="--prerelease" | |
| elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| # Main branch releases are marked as latest | |
| RELEASE_FLAGS="--latest" | |
| fi | |
| gh release create "v$VERSION" \ | |
| --repo "${{ github.repository }}" \ | |
| --title "v$VERSION" \ | |
| --notes-file release_notes.md \ | |
| $RELEASE_FLAGS \ | |
| release/* | |
| - name: Output release URL | |
| run: | | |
| VERSION="${{ needs.detect-release.outputs.version }}" | |
| echo "Release created successfully!" | |
| echo "View at: https://github.com/${{ github.repository }}/releases/tag/v$VERSION" |