-
Notifications
You must be signed in to change notification settings - Fork 11
139 lines (129 loc) · 5.57 KB
/
e2e-tests.yml
File metadata and controls
139 lines (129 loc) · 5.57 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
# Copyright (c) 2025 ADBC Drivers Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Tests Workflow
on:
push:
branches:
- main
paths:
- '.github/workflows/e2e-tests.yml'
- 'ci/scripts/**'
- 'csharp/**'
pull_request:
# No paths filter — workflow must always fire so the gate step can post
# the auto-pass check for non-csharp PRs. Path-based gating is handled
# in the gate step below (same pattern as trigger-integration-tests.yml).
types: [opened, synchronize, reopened, labeled]
merge_group:
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
run-e2e-tests:
runs-on: ubuntu-latest
env:
DATABRICKS_SERVER_HOSTNAME: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_HTTP_PATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
DATABRICKS_TEST_CLIENT_ID: ${{ secrets.DATABRICKS_TEST_CLIENT_ID }}
DATABRICKS_TEST_CLIENT_SECRET: ${{ secrets.DATABRICKS_TEST_CLIENT_SECRET }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Check if tests should run
id: gate
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ github.event.action }}" == "labeled" ]] && [[ "${{ github.event.label.name }}" == "e2e-test" ]]; then
echo "run=true" >> $GITHUB_OUTPUT && echo "✅ e2e-test label added — running E2E tests"
else
# Auto-pass on PR so it can enter the queue; tests run in merge queue
echo "run=false" >> $GITHUB_OUTPUT && echo "⏭️ PR event — E2E tests run in merge queue"
fi
elif [[ "${{ github.event_name }}" == "merge_group" ]]; then
CHANGED=$(git diff --name-only "${{ github.event.merge_group.base_sha }}" "${{ github.event.merge_group.head_sha }}")
if echo "$CHANGED" | grep -qE "^(csharp/|ci/scripts/|\.github/workflows/e2e-tests\.yml)"; then
echo "run=true" >> $GITHUB_OUTPUT && echo "✅ Relevant files changed"
else
echo "run=false" >> $GITHUB_OUTPUT && echo "⏭️ No relevant files changed, skipping E2E tests"
fi
else
echo "run=true" >> $GITHUB_OUTPUT
fi
- name: Set up .NET
if: steps.gate.outputs.run == 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Generate OAuth access token
if: steps.gate.outputs.run == 'true'
id: oauth
run: |
OAUTH_RESPONSE=$(curl -s -X POST "https://${{ env.DATABRICKS_SERVER_HOSTNAME }}/oidc/v1/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=${{ env.DATABRICKS_TEST_CLIENT_ID }}" \
-d "client_secret=${{ env.DATABRICKS_TEST_CLIENT_SECRET }}" \
-d "scope=sql")
OAUTH_TOKEN=$(echo "$OAUTH_RESPONSE" | python3 -c "import sys, json; print(json.load(sys.stdin)['access_token'])")
if [ -z "$OAUTH_TOKEN" ]; then
echo "ERROR: Failed to generate OAuth token"
exit 1
fi
echo "::add-mask::$OAUTH_TOKEN"
echo "OAUTH_TOKEN=$OAUTH_TOKEN" >> $GITHUB_OUTPUT
- name: Create Databricks config file
if: steps.gate.outputs.run == 'true'
run: |
mkdir -p ~/.databricks
cat > ~/.databricks/connection.json << EOF
{
"uri": "https://${{ env.DATABRICKS_SERVER_HOSTNAME }}${{ env.DATABRICKS_HTTP_PATH }}",
"auth_type": "oauth",
"grant_type": "client_credentials",
"client_id": "${{ env.DATABRICKS_TEST_CLIENT_ID }}",
"client_secret": "${{ env.DATABRICKS_TEST_CLIENT_SECRET }}",
"scope": "sql",
"access_token": "${{ steps.oauth.outputs.OAUTH_TOKEN }}",
"type": "databricks",
"catalog": "main",
"db_schema": "adbc_testing",
"query": "SELECT * FROM main.adbc_testing.adbc_testing_table",
"expectedResults": 12,
"isCITesting": true,
"tracePropagationEnabled": "true",
"traceParentHeaderName": "traceparent",
"traceStateEnabled": "false",
"metadata": {
"catalog": "main",
"schema": "adbc_testing",
"table": "adbc_testing_table",
"expectedColumnCount": 19
}
}
EOF
echo "DATABRICKS_TEST_CONFIG_FILE=$HOME/.databricks/connection.json" >> $GITHUB_ENV
- name: Build
if: steps.gate.outputs.run == 'true'
shell: bash
run: |
./ci/scripts/csharp_build.sh "${{ github.workspace }}"
- name: Run All Tests
if: steps.gate.outputs.run == 'true'
shell: bash
run: |
export DATABRICKS_TEST_CONFIG_FILE="$HOME/.databricks/connection.json"
./ci/scripts/csharp_test_databricks_e2e.sh "${{ github.workspace }}"