-
-
Notifications
You must be signed in to change notification settings - Fork 123
96 lines (78 loc) · 2.54 KB
/
ci-cd.yml
File metadata and controls
96 lines (78 loc) · 2.54 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Databricks Asset Bundle CI/CD - DEV Only
on:
push:
branches: [dbx-asset-bundles]
pull_request:
branches: [dbx-asset-bundles]
# Personal Access Token (PAT) authentication for DEV environment
jobs:
# Continuous Integration
validate:
name: Validate Bundle
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Setup Databricks CLI
uses: databricks/setup-cli@main
- name: Install dependencies
run: |
pip install -r ci-cd/requirements.txt || echo "No requirements.txt found"
- name: Validate Bundle Configuration
env:
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
run: |
databricks bundle validate
- name: Run Bundle Syntax Check (DEV only)
env:
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
run: |
databricks bundle validate --target dev
# Unit Tests (if you have test files)
test:
name: Run Tests
runs-on: ubuntu-latest
needs: validate
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install test dependencies
run: |
pip install pytest databricks-connect
pip install -r ci-cd/requirements.txt || echo "No requirements.txt found"
- name: Run unit tests
run: |
pytest ci-cd/tests/ -v || echo "No tests found"
# Deploy to Development
deploy-dev:
name: Deploy to Development
runs-on: ubuntu-latest
needs: [validate]
if: github.ref == 'refs/heads/dbx-asset-bundles'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Databricks CLI
uses: databricks/setup-cli@main
- name: Deploy to Development
env:
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
run: |
databricks bundle deploy --target dev
- name: Run Integration Tests (Optional)
run: |
# You can trigger specific jobs for validation
# databricks jobs run-now --job-id <job-id>
echo "Integration tests would run here"