-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
ci_integration_test.sh
executable file
·72 lines (64 loc) · 2.79 KB
/
ci_integration_test.sh
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
#!/usr/bin/env bash
set -e
. tools/lib/lib.sh
# runs integration tests for an integration name
connector="$1"
all_integration_tests=$(./gradlew integrationTest --dry-run | grep 'integrationTest SKIPPED' | cut -d: -f 4)
run() {
if [[ "$connector" == "all" ]] ; then
echo "Running: ./gradlew --no-daemon --scan integrationTest"
./gradlew --no-daemon --scan integrationTest
else
if [[ "$connector" == *"base-normalization"* ]]; then
selected_integration_test="base-normalization"
integrationTestCommand="$(_to_gradle_path "airbyte-integrations/bases/base-normalization" integrationTest)"
export SUB_BUILD="CONNECTORS_BASE"
./gradlew --no-daemon --scan airbyteDocker
elif [[ "$connector" == *"bases"* ]]; then
connector_name=$(echo $connector | cut -d / -f 2)
selected_integration_test=$(echo "$all_integration_tests" | grep "^$connector_name$" || echo "")
integrationTestCommand="$(_to_gradle_path "airbyte-integrations/$connector" integrationTest)"
export SUB_BUILD="CONNECTORS_BASE"
elif [[ "$connector" == *"connectors"* ]]; then
connector_name=$(echo $connector | cut -d / -f 2)
selected_integration_test=$(echo "$all_integration_tests" | grep "^$connector_name$" || echo "")
integrationTestCommand="$(_to_gradle_path "airbyte-integrations/$connector" integrationTest)"
else
selected_integration_test=$(echo "$all_integration_tests" | grep "^$connector$" || echo "")
integrationTestCommand=":airbyte-integrations:connectors:$connector:integrationTest"
fi
if [ -n "$selected_integration_test" ] ; then
echo "Running: ./gradlew --no-daemon --scan $integrationTestCommand"
./gradlew --no-daemon --scan "$integrationTestCommand"
else
echo "Connector '$connector' not found..."
return 1
fi
fi
}
# Copy command output to extract gradle scan link.
run | tee build.out
# return status of "run" command, not "tee"
# https://tldp.org/LDP/abs/html/internalvariables.html#PIPESTATUSREF
run_status=${PIPESTATUS[0]}
test $run_status == "0" || {
# Build failed
link=$(cat build.out | grep -A1 "Publishing build scan..." | tail -n1 | tr -d "\n")
# Save gradle scan link to github GRADLE_SCAN_LINK variable for next job.
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
echo "GRADLE_SCAN_LINK=$link" >> $GITHUB_ENV
exit $run_status
}
# Build successed
coverage_report=`sed -n '/^[ \t]*-\+ coverage: /,/TOTAL /p' build.out`
if ! test -z "$coverage_report"
then
echo "PYTHON_UNITTEST_COVERAGE_REPORT<<EOF" >> $GITHUB_ENV
echo "Python tests coverage:" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "$coverage_report" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "PYTHON_UNITTEST_COVERAGE_REPORT=No Python unittests run" >> $GITHUB_ENV
fi