forked from googleapis/google-api-java-client-services
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathverify.sh
More file actions
40 lines (32 loc) · 1.49 KB
/
verify.sh
File metadata and controls
40 lines (32 loc) · 1.49 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
set -ex
export repo_dir=$(realpath $(dirname "${BASH_SOURCE[0]}")/../../)
pushd "${repo_dir}/clients"
# We only test against the latest variant
readonly CURRENT_VARIANT="2.0.0"
# An optional argument to only compile libraries starting with this letter
starting_letter="$1"
# find all generated clients' pom.xml
find . -wholename "*${CURRENT_VARIANT}/pom.xml" -not -path '*/target/*' > pom_list_raw
cat pom_list_raw
# trim down to those starting with "${starting_letter}"
cat pom_list_raw | { grep "google-api-services-${starting_letter}" || true; } > pom_list
cat pom_list
# format result to list of Maven modules
cat pom_list | cut -d'/' -f2-4 \
| sed 's/\(.*\)/<module>\1<\/module>/' > module_list
cat module_list
# produce a temporary pom with the modules
(echo "<project><modelVersion>4.0.0</modelVersion><groupId>temp</groupId><artifactId>temp</artifactId><version>1.0</version><packaging>pom</packaging><modules>"; cat module_list; echo "</modules></project>") > pom.xml
cat pom.xml
# use generated pom to test compilation
mvn clean compile -T 1.5C -Dmaven.testSkip=true -Denforcer.skip -fae --fail-at-end 2>&1 | tee out
cat out | grep 'rev20' | grep 's]' | { grep 'FAILURE' || true; } > errors
if [[ $(cat errors | wc -l) -gt 0 ]]; then
echo "Compilation errors found in the following libraries:"
cat errors
# send to GH output
if [[ -f "${GITHUB_OUTPUT}" ]]; then
echo "failed_libraries_${starting_letter}=$(cat errors | tr '\n' ',')" > "${GITHUB_OUTPUT}"
fi
fi
echo "No compilation errors found"