Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
travis is on Xenial now
[simgrid.git] / tools / jenkins / project_description.sh
1 #!/bin/bash
2
3 get_boost(){
4     grep -m 1 "Boost version:" ./consoleText | sed  "s/.*-- Boost version: \([a-zA-Z0-9\.]*\)/\1/g"
5 }
6
7 get_compiler(){
8     grep -m 1 "The C compiler identification" ./consoleText | sed  "s/.*-- The C compiler identification is \([a-zA-Z0-9\.]*\)/\1/g"
9 }
10
11 get_java(){
12     grep -m 1 "Found Java:" ./consoleText | sed "s/.*-- Found Java.*found suitable version \"\([a-zA-Z0-9\.]*\)\",.*/\1/g"
13 }
14
15 get_cmake(){
16     grep -m 1 "Cmake version" ./consoleText| sed "s/.*-- Cmake version \([a-zA-Z0-9\.]*\)/\1/g"
17 }
18
19 get_ns3(){
20   found=$(grep -c "NS-3 found" ./consoleText)
21   if [ $found != 0 ]; then
22     echo "✔"
23   else
24     echo ""
25   fi
26 }
27
28 get_python(){
29   found=$(grep -c "Compile Python bindings .....: ON" ./consoleText)
30   if [ $found != 0 ]; then
31     echo "✔"
32   else
33     echo ""
34   fi
35 }
36
37 if [ -f consoleText ]; then
38   rm consoleText
39 fi
40
41
42 if [ -z $BUILD_URL ]; then
43   BUILD_URL="https://ci.inria.fr/simgrid/job/SimGrid/lastBuild"
44 fi
45
46 #get the list of nodes on jenkins
47 wget --quiet ${BUILD_URL}/consoleText >/dev/null 2>&1
48 nodes=($(grep -rR "Triggering SimGrid ? Debug," ./consoleText | sed "s/Triggering SimGrid ? Debug,\(.*\)/\1/g"| sort))
49 rm consoleText
50
51
52 echo "<br>Description of the nodes - Automatically updated by project_description.sh script - Don't edit here<br><br>
53 <table id="configuration-matrix"> 
54 <tr class="matrix-row">  <td class="matrix-header" style="min-width:75px">Name of the Builder</td><td class="matrix-header" style="min-width:75px">OS</td><td class="matrix-header" style="min-width:75px">Compiler</td><td class="matrix-header" style="min-width:75px">Boost</td><td class="matrix-header" style="min-width:75px">Java</td><td class="matrix-header" style="min-width:75px">Cmake</td><td class="matrix-header" style="min-width:50px">NS3</td><td class="matrix-header" style="min-width:50px">Python</td></tr>"
55
56 for node in "${nodes[@]}"
57 do
58     wget --quiet ${BUILD_URL}/build_mode=Debug,node=${node}/consoleText >/dev/null 2>&1
59     if [ ! -f consoleText ]; then
60       echo "file not existing for node ${node}"
61       exit 1
62     fi
63     boost=$(get_boost)
64     compiler=$(get_compiler)
65     java=$(get_java)
66     cmake=$(get_cmake)
67     ns3=$(get_ns3)
68     py=$(get_python)
69     os=$(grep -m 1 "OS Version" ./consoleText| sed "s/OS Version : \(.*\)/\1/g")
70     echo "<tr> <td class=\"matrix-leftcolumn\">$node</td><td class=\"matrix-cell\" style=\"text-align:left\">$os</td><td class=\"matrix-cell\" style=\"text-align:left\">$compiler</td><td class=\"matrix-cell\" style=\"text-align:left\">$boost</td><td class=\"matrix-cell\" style=\"text-align:left\">$java</td><td class=\"matrix-cell\" style=\"text-align:left\">$cmake</td><td class=\"matrix-cell\" style=\"text-align:center\">$ns3</td><td class=\"matrix-cell\" style=\"text-align:center\">$py</td></tr>"
71     rm consoleText
72 done
73
74
75 #Travis - get ID of the last jobs with the API
76 BUILD_NUM=$(curl -s 'https://api.travis-ci.org/repos/simgrid/simgrid/builds?limit=1' | grep -o '^\[{"id":[0-9]*,' | grep -o '[0-9]' | tr -d '\n')
77 BUILDS=($(curl -s https://api.travis-ci.org/repos/simgrid/simgrid/builds/${BUILD_NUM} | grep -o '{"id":[0-9]*,' | grep -o '[0-9]*'| tail -n 2))
78
79 for id in "${!BUILDS[@]}"
80 do
81     wget --quiet https://api.travis-ci.org/v3/job/${BUILDS[$id]}/log.txt -O ./consoleText >/dev/null 2>&1
82     sed -i -e "s/\r//g" ./consoleText
83     if [ $id == 0 ]; then
84       node="<a href=\"https://travis-ci.org/simgrid/simgrid\">travis-linux</a>"
85       os="Ubuntu 16.04 (<a href=\"https://docs.travis-ci.com/user/reference/xenial/\">Xenial</a>) 64 bits"
86     else
87       node="<a href=\"https://travis-ci.org/simgrid/simgrid\">travis-mac</a>"
88       os="Mac OSX High Sierra (kernel: 17.4.0)"
89     fi
90     boost=$(get_boost)
91     compiler=$(get_compiler)
92     java=$(get_java)
93     cmake=$(get_cmake)
94     ns3=$(get_ns3)
95     py=$(get_python)
96     echo "<tr> <td class=\"matrix-leftcolumn\">$node</td><td class=\"matrix-cell\" style=\"text-align:left\">$os</td><td class=\"matrix-cell\" style=\"text-align:left\">$compiler</td><td class=\"matrix-cell\" style=\"text-align:left\">$boost</td><td class=\"matrix-cell\" style=\"text-align:left\">$java</td><td class=\"matrix-cell\" style=\"text-align:left\">$cmake</td><td class=\"matrix-cell\" style=\"text-align:center\">$ns3</td><td class=\"matrix-cell\" style=\"text-align:center\">$py</td></tr>"
97     rm consoleText
98 done
99
100 #Appveyor - get ID of the last job with the API
101 BUILD_ID=$(curl -s "https://ci.appveyor.com/api/projects/mquinson/simgrid" | grep -o '\[{"jobId":"[a-zA-Z0-9]*",' | sed "s/\[{\"jobId\":\"//" | sed "s/\",//")
102 wget --quiet https://ci.appveyor.com/api/buildjobs/$BUILD_ID/log -O ./consoleText >/dev/null 2>&1
103 sed -i -e "s/\r//g" ./consoleText
104 node="<a href="https://ci.appveyor.com/project/mquinson/simgrid">appveyor</a>"
105 os="Windows Server 2012 - VS2015 + mingw64 5.3.0"
106 boost=$(get_boost)
107 compiler=$(get_compiler)
108 java=$(get_java)
109 cmake=$(get_cmake)
110 ns3=$(get_ns3)
111 py=$(get_python)
112 echo "<tr> <td class=\"matrix-leftcolumn\">$node</td><td class=\"matrix-cell\" style=\"text-align:left\">$os</td><td class=\"matrix-cell\" style=\"text-align:left\">$compiler</td><td class=\"matrix-cell\" style=\"text-align:left\">$boost</td><td class=\"matrix-cell\" style=\"text-align:left\">$java</td><td class=\"matrix-cell\" style=\"text-align:left\">$cmake</td><td class=\"matrix-cell\" style=\"text-align:center\">$ns3</td><td class=\"matrix-cell\" style=\"text-align:center\">$py</td></tr>"
113 rm consoleText
114
115 echo "</table>"