forked from databricks/databricks-jdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (79 loc) · 2.72 KB
/
runJdbcComparator.yml
File metadata and controls
91 lines (79 loc) · 2.72 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
name: JDBC Driver Comparison
on:
schedule:
- cron: '0 0 * * 1' # Run at 00:00 UTC on Monday (1)
workflow_dispatch: # Allow manual trigger
jobs:
comparator:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Merge main into jdbc-comparator
run: |
git checkout jdbc-comparator
git merge main --allow-unrelated-histories --no-edit -X theirs || {
echo "Force merging by accepting all changes from main"
git checkout --theirs .
git add .
git commit --no-edit
}
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Set up PAT
env:
DATABRICKS_COMPARATOR_TOKEN: ${{ secrets.DATABRICKS_COMPARATOR_TOKEN }}
run: |
echo "DATABRICKS_COMPARATOR_TOKEN=${DATABRICKS_COMPARATOR_TOKEN}" >> $GITHUB_ENV
- name: Run Tests
run: mvn test -Dtest=JDBCDriverComparisonTest
- name: Format Email Content
run: |
chmod +x bin/format-comparator-email.sh
./bin/format-comparator-email.sh
- name: Check for Report and Differences
id: check_differences
run: |
if [ -f "jdbc-comparison-report.txt" ]; then
if grep -q "No differences found" "jdbc-comparison-report.txt"; then
echo "has_differences=false" >> $GITHUB_OUTPUT
else
echo "has_differences=true" >> $GITHUB_OUTPUT
fi
else
echo "Report file not found"
exit 1
fi
- name: Send Email
if: steps.check_differences.outputs.has_differences == 'true'
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.SMTP_USERNAME }}
password: ${{ secrets.SMTP_PASSWORD }}
subject: JDBC Driver Comparison Results - 🚨Differences Found
html_body: file://jdbc-comparison-report.html
to: ${{ secrets.EMAIL_RECIPIENTS }}
from: JDBC Comparator Runner
content_type: text/html
- name: Upload Report as Artifact
uses: actions/upload-artifact@v4
with:
name: jdbc-comparison-report
path: |
jdbc-comparison-report.txt
jdbc-comparison-report.html