Skip to content

Deploy to Databricks #8

Deploy to Databricks

Deploy to Databricks #8

Workflow file for this run

name: Deploy to Databricks
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [created]
workflow_dispatch:
env:
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
jobs:
# CI Step: Runs on every PR and Push to validate code quality
ci-validation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: uv sync
- name: Run Linter (Ruff)
run: uv run ruff check .
- name: Run Type Checker (Mypy)
run: uv run mypy src/
- name: Run Unit Tests (Pytest)
# Coverage threshold is configured in pyproject.toml [tool.coverage.report]
run: uv run pytest --cov=src --cov-report=term-missing
# Deploy to QA: Runs automatically when code is merged to 'main'
deploy-qa:
needs: ci-validation
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Databricks CLI
uses: databricks/setup-cli@main
- name: Install uv (required for wheel build defined in databricks.yml)
uses: astral-sh/setup-uv@v3
- name: Deploy to QA Target
run: databricks bundle deploy -t qa
# Deploy to PROD: Runs only when a Release is created
deploy-prod:
needs: ci-validation
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Databricks CLI
uses: databricks/setup-cli@main
- name: Install uv (required for wheel build defined in databricks.yml)
uses: astral-sh/setup-uv@v3
- name: Deploy to Production Target
run: databricks bundle deploy -t prod