Skip to content

Commit facc2b0

Browse files
committed
Update python unit test pipeline
1 parent 3dd218d commit facc2b0

2 files changed

Lines changed: 47 additions & 85 deletions

File tree

.github/workflows/databricks-unit-test-cicd.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,56 @@
1-
name: Run Python Unit Testing on Cluster
2-
3-
on:
4-
pull_request:
1+
name: CF.Cumulus-Databricks-CICD-Unit-Test
2+
3+
concurrency: 1
4+
5+
on:
56
workflow_dispatch:
67

7-
env:
8-
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
9-
10-
jobs:
11-
run-python-unit-tests:
8+
9+
jobs:
10+
deploy_dev:
11+
name: "Deploy unit test to dev"
1212
runs-on: ubuntu-latest
13-
timeout-minutes: 15
13+
environment: dev
14+
defaults:
15+
run:
16+
working-directory: ./src/azure.databricks/python
17+
18+
steps:
19+
- uses: actions/checkout@v3
1420

15-
steps:
16-
- name: Checkout repo
17-
uses: actions/checkout@v4
18-
- name: Unit tests for PySpark Notebooks on Databricks
19-
uses: databricks/run-notebook@main
21+
- name: Set up Python 3.10
22+
uses: actions/setup-python@v4
2023
with:
21-
databricks-token: ${{ secrets.DATABRICKS_TOKEN }}
24+
python-version: '3.10'
25+
- run: python -m pip install --upgrade pip
26+
- run: pip install wheel
27+
- run: pip3 install wheel
28+
- run: pip install -r requirements.txt
29+
- run: |
30+
pip install databricks-cli
31+
echo "[dev]" >> ~/.databrickscfg
32+
echo "host = ${{ secrets.DATABRICKS_HOST }}" >> ~/.databrickscfg
33+
echo "token = ${{ secrets.DATABRICKS_TOKEN }}" >> ~/.databrickscfg
2234
23-
local-notebook-path: src/azure.databricks/python/tests/pytest_databricks.py
35+
- name: Set up Databricks CLI
36+
uses: databricks/setup-cli@main
2437

25-
existing-cluster-id: ${{ secrets.DATABRICKS_CLUSTER_ID}}
38+
- name: Cleanup old code
39+
run: databricks workspace delete /Workspace/Shared/UnitTest --recursive
40+
continue-on-error: true
41+
env:
42+
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
43+
DATABRICKS_BUNDLE_ENV: dev
2644

27-
git-commit: "${{ github.event.pull_request.head.sha }}"
45+
- name: Deploy DAB
46+
run: databricks bundle deploy --target unit-test --profile dev
47+
env:
48+
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
49+
DATABRICKS_BUNDLE_ENV: dev
2850

29-
# Grant all users view permission on the notebook's results, so that they can
30-
# see the result of the notebook, if they have related access permissions.
31-
access-control-list-json: >
32-
[
33-
{
34-
"group_name": "users",
35-
"permission_level": "CAN_VIEW"
36-
}
37-
]
38-
run-name: "Python functions unit test suite"
51+
- name: Run unit tests
52+
run: databricks bundle run run_unit_tests -p dev
53+
env:
54+
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
55+
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
56+

0 commit comments

Comments
 (0)