-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (65 loc) · 2.11 KB
/
deploy.yml
File metadata and controls
82 lines (65 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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