File tree Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change
1
+ on :
2
+ schedule :
3
+ # Runs at 04:00 am
4
+ - cron : ' 0 4 * * *'
5
+ workflow_dispatch :
6
+ # Generates a list of libraries that cannot be
7
+ # compiled (printed to the action stdout)
8
+ name : Verify libraries compilation
9
+ jobs :
10
+ verify :
11
+ runs-on : ubuntu-20.04
12
+ steps :
13
+ - uses : actions/setup-java@v3
14
+ with :
15
+ distribution : temurin
16
+ java-version : 8
17
+ - uses : actions/checkout@v2
18
+ with :
19
+ path : google-api-java-client-services
20
+ # we install the moreutils `parallel` command
21
+ - run : sudo apt-get install moreutils
22
+ - working-directory : google-api-java-client-services
23
+ run : bash .github/workflows/verify_compilation.sh
24
+
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # This script loops over the generated clients and uses `mvn compile` to
3
+ # create a list of clients that cannot be compiled. The resulting list is
4
+ # printed to stdout
5
+ set -exo
6
+ repo_root=$( git rev-parse --show-toplevel)
7
+ export failed_libs=" ${repo_root} /failed_libs"
8
+
9
+ process_client () {
10
+ pom_dir=$1
11
+ pushd " ${pom_dir} "
12
+ lib_name=$( pwd | sed ' s/.*\(google-api-services-.*\)/\1/' )
13
+ mvn compile || echo " ${lib_name} " >> " ${failed_libs} "
14
+ popd # pom_dir
15
+ }
16
+
17
+ print_failed_libraries () {
18
+ if [[ $( cat " ${failed_libs} " | wc -l) -ne 0 ]]; then
19
+ echo " The following libraries had compilation errors:"
20
+ cat " ${failed_libs} "
21
+ exit 1
22
+ else
23
+ echo " All libraries were compiled successfully!"
24
+ fi
25
+ }
26
+
27
+ # export process_client so it can be accessed by the inner shell launched by the
28
+ # find command
29
+ export -f process_client
30
+ # for convenience in local setups, we remove the failed libraries list
31
+ # beforehand
32
+ if [[ -f " ${failed_libs} " ]]; then
33
+ rm " ${failed_libs} "
34
+ fi
35
+ pushd " ${repo_root} "
36
+
37
+ # some distros rename parallel to parallel.moreutils
38
+ parallel_bin=" parallel.moreutils"
39
+ which parallel.moreutils || parallel_bin=" parallel"
40
+
41
+ # runs mvn compile in parallel (max 50 jobs)
42
+ targets=$( find " clients" -mindepth 3 -name ' *2.0.0*' -printf ' %p ' )
43
+ echo " Attempting compilation on the following libraries:"
44
+ set +x
45
+ echo " ${targets} " | sed ' s/ /\n/g' | sort
46
+ set -x
47
+ ${parallel_bin} -j50 -i bash -xe -c ' process_client "{}"' -- ${targets}
48
+
49
+ print_failed_libraries
50
+
51
+
52
+ popd # repo_root
You can’t perform that action at this time.
0 commit comments