-
Notifications
You must be signed in to change notification settings - Fork 130
245 lines (211 loc) · 7.75 KB
/
Copy pathnightly.yml
File metadata and controls
245 lines (211 loc) · 7.75 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: nightly
on:
workflow_dispatch: # Allows manual triggering of the workflow
schedule:
- cron: '0 4 * * *' # Runs automatically at 4:00 AM UTC every day
permissions:
id-token: write
issues: write
contents: read
pull-requests: read
concurrency:
group: single-acceptance-job-per-repo
jobs:
integration:
environment: tool
runs-on: larger
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: '3.12'
- name: Install hatch
run: pip install hatch==1.15.0
- name: Run unit tests and generate test coverage report
run: make test
# Acceptance tests are run from within tests/integration folder.
# We need to make sure .coveragerc is there so that code coverage is generated for the right modules.
- name: Prepare .coveragerc for integration tests
run: cp .coveragerc tests/integration
# Run tests from `tests/integration` as defined in .codegen.json
# and generate code coverage for modules defined in .coveragerc
- name: Run integration tests and generate test coverage report
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.4
with:
vault_uri: ${{ secrets.VAULT_URI }}
timeout: 2h
create_issues: true
codegen_path: tests/integration/.codegen.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
# collects all coverage reports: coverage.xml from integration tests, coverage-unit.xml from unit tests
- name: Publish test coverage
uses: codecov/codecov-action@v5
with:
use_oidc: true
integration_serverless:
environment: tool
runs-on: larger
env:
DATABRICKS_SERVERLESS_COMPUTE_ID: auto
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: '3.12'
- name: Install hatch
run: pip install hatch==1.15.0
- name: Run integration tests on serverless cluster
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.4
with:
vault_uri: ${{ secrets.VAULT_URI }}
timeout: 2h
create_issues: true
codegen_path: tests/integration/.codegen.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
DATABRICKS_SERVERLESS_COMPUTE_ID: ${{ env.DATABRICKS_SERVERLESS_COMPUTE_ID }}
e2e:
environment: tool
runs-on: larger
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: '3.12'
- name: Install hatch
run: pip install hatch==1.15.0
- name: Install Databricks CLI
run: |
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh
databricks --version
- name: Azure login (OIDC)
uses: azure/login@v2
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
allow-no-subscriptions: true
- name: Set env vars for Azure CLI auth
run: |
val=$(az keyvault secret show --id "${{ secrets.VAULT_URI }}/secrets/DATABRICKS-HOST" --query value -o tsv)
echo "DATABRICKS_HOST=$val" >> $GITHUB_ENV
echo "DATABRICKS_AUTH_TYPE=azure-cli" >> $GITHUB_ENV
- name: Run e2e tests
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.4
with:
vault_uri: ${{ secrets.VAULT_URI }}
timeout: 2h
create_issues: true
codegen_path: tests/e2e/.codegen.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
e2e_serverless:
environment: tool
runs-on: larger
env:
DATABRICKS_SERVERLESS_COMPUTE_ID: auto
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: '3.12'
- name: Install hatch
run: pip install hatch==1.15.0
- name: Install Databricks CLI
run: |
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh
databricks --version
- name: Azure login (OIDC)
uses: azure/login@v2
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
allow-no-subscriptions: true
- name: Set env vars for Azure CLI auth
run: |
val=$(az keyvault secret show --id "${{ secrets.VAULT_URI }}/secrets/DATABRICKS-HOST" --query value -o tsv)
echo "DATABRICKS_HOST=$val" >> $GITHUB_ENV
echo "DATABRICKS_AUTH_TYPE=azure-cli" >> $GITHUB_ENV
- name: Run e2e tests on serverless cluster
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.4
with:
vault_uri: ${{ secrets.VAULT_URI }}
timeout: 2h
create_issues: true
codegen_path: tests/e2e/.codegen.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
DATABRICKS_SERVERLESS_COMPUTE_ID: ${{ env.DATABRICKS_SERVERLESS_COMPUTE_ID }}
benchmark:
environment: tool
runs-on: larger
env:
DATABRICKS_SERVERLESS_COMPUTE_ID: auto
BENCHMARKS_DIR: tests/perf/.benchmarks
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: '3.12'
- name: Install hatch
run: pip install hatch==1.15.0
- name: Login to Azure for azure-cli authentication
uses: azure/login@v2
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
allow-no-subscriptions: true
- name: Run performance tests and compare with baseline
timeout-minutes: 120
env:
DATABRICKS_SERVERLESS_COMPUTE_ID: ${{ env.DATABRICKS_SERVERLESS_COMPUTE_ID }}
run: |
export DATABRICKS_HOST=$(az keyvault secret show --id "${{ secrets.VAULT_URI }}/secrets/DATABRICKS-HOST" --query value -o tsv)
export DATABRICKS_AUTH_TYPE=azure-cli
# We are not using acceptance action as it does not show the comparison results.
# The run fails if performance degrades by more than 25%.
# Tests are run sequentially to reduce variability.
# Do at least 5 rounds to get more stable results.
hatch run pytest tests/perf -v -n 1 \
--benchmark-storage=$BENCHMARKS_DIR \
--benchmark-compare=baseline \
--benchmark-compare-fail=mean:25% \
--benchmark-min-rounds=5