-
Notifications
You must be signed in to change notification settings - Fork 16
133 lines (130 loc) · 3.91 KB
/
build_and_test.yml
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
name: Build and test
on:
push:
branches:
- main
pull_request:
branches:
- main
# Cancel previous PR build and test
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
cancel-in-progress: true
jobs:
license-check:
name: "License Check"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check license header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config: .github/.licenserc.yaml
build-test:
name: "Build Test CI"
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17, 21 ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
cache: 'gradle'
- name: Build with Gradle
run: |
./gradlew build
build-image:
name: "Build Operator Image CI"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
cache: 'gradle'
- name: Build Operator Image
run: |
./gradlew buildDockerImage
docker run spark-kubernetes-operator:$(./gradlew properties | grep '^version:' | awk '{print $2}')
k8s-integration-tests:
name: "K8s Integration Tests"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes_versions:
- "1.27.0"
- "1.31.0"
test_group:
- spark-versions
- python
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'adopt'
cache: 'gradle'
- name: Set up Minikube
uses: medyagh/setup-minikube@v0.0.18
with:
cache: true
kubernetes-version: ${{ matrix.kube-version }}
cpus: 2
memory: 6144m
- name: Set Up Go
uses: actions/setup-go@v5
- name: Set Up Chainsaw
run: |
go install github.com/kyverno/chainsaw@latest
- name: Print K8S pods and nodes info
run: |
kubectl get pods -A
kubectl describe node
- name: Run Spark K8s Operator on K8S
run: |
kubectl create clusterrolebinding serviceaccounts-cluster-admin --clusterrole=cluster-admin --group=system:serviceaccounts || true
eval $(minikube docker-env)
./gradlew buildDockerImage
./gradlew spark-operator-api:relocateGeneratedCRD
helm install spark-kubernetes-operator --create-namespace -f build-tools/helm/spark-kubernetes-operator/values.yaml build-tools/helm/spark-kubernetes-operator/
helm test spark-kubernetes-operator
# Use remote host' s docker image
minikube docker-env --unset
- name: Run E2E Test
run: |
chainsaw test --test-dir ./tests/e2e/${{ matrix.test_group }} --parallel 2
lint:
name: "Linter and documentation"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
cache: 'gradle'
- name: Linters
run: |
./gradlew build -x test
- name: Javadoc Generation
run: |
./gradlew javadoc
- name: Validate helm chart linting
run: |
helm lint --strict build-tools/helm/spark-kubernetes-operator