-
Notifications
You must be signed in to change notification settings - Fork 9
78 lines (74 loc) · 2.3 KB
/
ci-java.yml
File metadata and controls
78 lines (74 loc) · 2.3 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
name: Java CI
on:
workflow_call:
inputs:
use_local_sdk:
description: 'Override databricks-zerobus-ingest-sdk with the local path dep (for integration testing unreleased Rust changes)'
type: boolean
default: false
artifact_suffix:
description: 'Suffix to append to artifact names to avoid conflicts when called multiple times in one workflow run'
type: string
default: ''
jobs:
fmt:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: java
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: Check formatting
run: mvn spotless:check
- name: Fail on formatting differences
if: failure()
run: |
echo "Code formatting issues detected. Run 'mvn spotless:apply' to fix."
exit 1
test:
strategy:
fail-fast: false
matrix:
os: [linux-ubuntu-latest, windows-server-latest]
javaVersion: ['11', '17', '21']
runs-on:
group: databricks-protected-runner-group
labels: ${{ matrix.os }}
defaults:
run:
working-directory: java
steps:
- uses: actions/checkout@v4
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up JDK ${{ matrix.javaVersion }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.javaVersion }}
distribution: 'temurin'
cache: 'maven'
- name: Patch Rust workspace to use local SDK
if: inputs.use_local_sdk
shell: bash
run: printf '\n[patch.crates-io]\ndatabricks-zerobus-ingest-sdk = { path = "sdk" }\n' >> ../rust/Cargo.toml
- name: Build with Maven
run: mvn clean compile
- name: Run tests
run: mvn test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-java-${{ matrix.javaVersion }}${{ inputs.artifact_suffix }}
path: |
java/target/surefire-reports/
java/target/test-classes/
retention-days: 7