Home | History | Annotate | Download | only in skqp
      1 #!/bin/sh
      2 
      3 # Copyright 2018 Google Inc.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 BRANCH="${1:-origin/skqp/dev}"
      8 COUNT="${2:-40}"
      9 
     10 DST=$(mktemp)
     11 
     12 cat > "$DST" << EOF
     13 <!DOCTYPE html>
     14 <html lang="en">
     15 <head>
     16 <meta charset="utf-8">
     17 <title>SkQP Pre-built APKs</title>
     18 <meta name="viewport" content="width=device-width, initial-scale=1.0">
     19 <style>
     20 body {
     21 font-family:sans-serif;
     22 max-width:55em;
     23 margin:8px auto;
     24 padding:0 8px;
     25 }
     26 td { padding:12px 6px; }
     27 </style>
     28 </head>
     29 <body>
     30 <h1>SkQP Pre-built APKs</h1>
     31 <table>
     32 <tr>
     33 <th>APK</th>
     34 <th>Date</th>
     35 <th>Commit</th>
     36 </tr>
     37 EOF
     38 
     39 for commit in $(git log "$BRANCH" -${COUNT} -\-format=%H) ; do
     40     printf '.' >&2
     41     short="$(git log -1 -\-format=%h $commit)"
     42     url="https://storage.googleapis.com/skia-skqp/skqp-universal-${short}.apk"
     43     if [ 200 -ne "$(curl -s -o /dev/null -w "%{http_code}" "$url")" ] ; then
     44         continue
     45     fi
     46     date=$(TZ='' git log -\-date='format-local:%Y-%m-%d %H:%M:%S %Z' -1 $commit -\-format=%cd)
     47     subj=$(git log -1 $commit -\-format='%<(50,trunc)%s' | sed 's/  *$//')
     48 
     49     commit_url="https://skia.googlesource.com/skia/+/${commit}"
     50     {
     51         printf '<tr>\n<td><a href="%s">skqp-universal-%s.apk</a></td>\n' "$url" "$short"
     52         printf '<td>%s</td>\n<td><a href="%s">%s</a></td>\n</tr>\n' "$date" "$commit_url" "$subj"
     53     }  >> "$DST"
     54 done
     55 printf '</body>\n</head>\n' >> "$DST"
     56 
     57 echo
     58 
     59 echo 'gsutil -h "Content-Type:text/html" cp' \"$DST\" gs://skia-skqp/apklist
     60 echo 'https://storage.googleapis.com/skia-skqp/apklist'
     61