-
Notifications
You must be signed in to change notification settings - Fork 10
246 lines (213 loc) · 8.53 KB
/
ci.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
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
246
name: CI
on:
push:
branches:
- 'spark-*'
tags:
- '*'
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
spark-version: ${{ steps.params.outputs.spark-version }}
spark-compat-version: ${{ steps.params.outputs.spark-compat-version }}
spark-version-matrix: ${{ format('["{0}"]', steps.params.outputs.spark-version) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Parametrize Extraction
id: params-extract
run: |
echo "::set-output name=spark-version::$(grep --max-count=1 "<spark.version>.*</spark.version>" pom.xml | sed -E -e "s/\s*<[^>]+>//g")"
echo "::set-output name=spark-compat-version::$(grep --max-count=1 "<spark.compat.version>.*</spark.compat.version>" pom.xml | sed -E -e "s/\s*<[^>]+>//g")"
shell: bash
- name: Parametrize
id: params
env:
SPARK_VERSION: ${{ steps.params-extract.outputs.spark-version }}
SPARK_COMPAT_VERSION: ${{ steps.params-extract.outputs.spark-compat-version }}
run: |
echo "::set-output name=spark-version::$(echo "$SPARK_VERSION" | sed "s/\${spark.compat.version}/$SPARK_COMPAT_VERSION/")"
echo "::set-output name=spark-compat-version::$SPARK_COMPAT_VERSION"
shell: bash
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ steps.params.outputs.spark-version }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build
run: mvn --batch-mode compile test-compile package -DskipTests
- name: Upload Binaries
uses: actions/upload-artifact@v2
with:
name: Binaries
path: |
target
!target/*-javadoc.jar
!target/site
test:
name: Unit Tests (Dgraph ${{ matrix.dgraph-version }} and Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
dgraph-version: [20.11.2]
python-version: [3.6]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Binaries Artifact
uses: actions/download-artifact@v2
with:
name: Binaries
path: target
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-test-${{ steps.params.outputs.spark-version }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-test-
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Scala Test
env:
DGRAPH_TEST_CLUSTER_VERSION: ${{ matrix.dgraph-version }}
run: mvn --batch-mode test
- name: Cache Pip packages
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-test-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-test-${{ matrix.python-version }}-
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r python/requirements.txt
pip install pytest
- name: Python Test
env:
DGRAPH_TEST_CLUSTER_VERSION: ${{ matrix.dgraph-version }}
PYTHONPATH: python:python/test
run: |
mkdir -p target/surefire-reports
python -m pytest python/test --junit-xml target/surefire-reports/pytest.xml
- name: Generate Unit Test Report
if: failure()
run: mvn --batch-mode surefire-report:report-only
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Unit Test Results (Dgraph ${{ matrix.dgraph-version }} and Python ${{ matrix.python-version }})
path: |
target/surefire-reports/*.xml
!target/surefire-reports/TEST-org.scalatest*.xml
target/site/surefire-report.html
integration:
name: Integration Tests (Dgraph ${{ matrix.dgraph-version }})
runs-on: ubuntu-latest
needs: build
if: "false"
strategy:
fail-fast: false
matrix:
spark-version: ${{ fromJSON(needs.build.outputs.spark-version-matrix) }}
dgraph-version: [20.03.7, 20.07.2, 20.11.2]
include:
- spark-version: ${{ needs.build.outputs.spark-version }}
spark-compat-version: ${{ needs.build.outputs.spark-compat-version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Binaries Artifact
uses: actions/download-artifact@v2
with:
name: Binaries
path: target
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-integration-${{ matrix.spark-version }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-integration-
- name: Cache Spark Binaries
uses: actions/cache@v2
with:
path: ~/spark
key: ${{ runner.os }}-spark-binaries-${{ matrix.spark-version }}
- name: Setup Spark Binaries
env:
SPARK_PACKAGE: spark-${{ matrix.spark-version }}/spark-${{ matrix.spark-version }}-bin-hadoop2.7.tgz
run: |
if [[ ! -e ~/spark ]]
then
wget --progress=dot:giga https://archive.apache.org/dist/spark/${SPARK_PACKAGE} -O - | tar -xzC "${{ runner.temp }}"
archive=$(basename "${SPARK_PACKAGE}") bash -c "mv -v "${{ runner.temp }}/\${archive/%.tgz/}" ~/spark"
fi
shell: bash
- name: Parametrize
id: params
run: |
echo "::set-output name=artifact-id::$(grep --max-count=1 "<artifactId>.*</artifactId>" pom.xml | sed -E -e "s/\s*<[^>]+>//g")"
echo "::set-output name=version::$(grep --max-count=1 "<version>.*</version>" pom.xml | sed -E -e "s/\s*<[^>]+>//g")"
echo "::set-output name=graphframes-version::$(grep -A 5 "<artifactId>graphframes</artifactId>" pom.xml | grep -v "<\!--" | tail -n +2 | head -n 1 | sed -E -e "s/^ +<version>//" -e "s/-.*//")"
echo "::set-output name=home::$(cd ~; pwd)"
shell: bash
- name: Prepare Integration Tests
run: |
mvn --batch-mode install -DskipTests
cd examples/scala
mvn --batch-mode package
# spark-submit is not capable of downloading these dependencies, fetching them through mvn
mvn --batch-mode dependency:get -DgroupId=com.google.errorprone -DartifactId=error_prone_annotations -Dversion=2.3.3
mvn --batch-mode dependency:get -DgroupId=com.google.code.findbugs -DartifactId=jsr305 -Dversion=3.0.2
mvn --batch-mode dependency:get -DgroupId=org.codehaus.mojo -DartifactId=animal-sniffer-annotations -Dversion=1.17
mvn --batch-mode dependency:get -DgroupId=com.google.code.gson -DartifactId=gson -Dversion=2.8.6
mvn --batch-mode dependency:get -DgroupId=org.slf4j -DartifactId=slf4j-api -Dversion=1.7.16
shell: bash
- name: Start Dgraph cluster
id: dgraph
env:
DGRAPH_TEST_CLUSTER_VERSION: ${{ matrix.dgraph-version }}
run: |
echo "::set-output name=docker::$(./dgraph-instance.background.sh)"
sleep 10
if [[ "${{ matrix.dgraph-version }}" != "20.03."* ]]
then
./dgraph-instance.drop-all.sh
fi
./dgraph-instance.schema.sh
./dgraph-instance.insert.sh
shell: bash
- name: Integration Tests
env:
SPARK_HOME: ${{ steps.params.outputs.home }}/spark
ARTIFACT_ID: ${{ steps.params.outputs.artifact-id }}
VERSION: ${{ steps.params.outputs.version }}
# There is no Spark 3.1 release of graphframes yet, so we use Spark 3.0 for now
run: |
${SPARK_HOME}/bin/spark-submit --packages uk.co.gresearch.spark:${ARTIFACT_ID}:${VERSION},graphframes:graphframes:${{ steps.params.outputs.graphframes-version }}-spark3.0-s_2.12 --class uk.co.gresearch.spark.dgraph.connector.example.ExampleApp examples/scala/target/spark-dgraph-connector-examples_*.jar
shell: bash
- name: Stop Dgraph cluster
if: always() && steps.dgraph.outcome == 'success'
run: |
docker stop ${{ steps.dgraph.outputs.docker }}
shell: bash