Update CI configuration (#1923)

* CI: Remove deprecated `sudo` option in .travis.yml

Ref:
https://blog.travis-ci.com/2018-10-04-combining-linux-infrastructures

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>

* CI: Replace manual git install with official apt addon

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>

* CI: enable ccache to speed up build process

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>

* Unify git to use https for submodules on git.apache.org

Only https://git.apache.org/serf.git uses https seems not cool

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>

* CI: reduce git clone depth to speed up

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>

* CI: Cache git submodule to speed up

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>
diff --git a/.gitmodules b/.gitmodules
index 62d296f..48c4155 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,10 +1,10 @@
 # The two httpds are the longest syncs, so we'd like to start them first.
 [submodule "third_party/httpd/src"]
 	path = third_party/httpd/src
-	url = git://git.apache.org/httpd.git
+	url = https://git.apache.org/httpd.git
 [submodule "third_party/httpd24/src"]
 	path = third_party/httpd24/src
-	url = git://git.apache.org/httpd.git
+	url = https://git.apache.org/httpd.git
 [submodule "third_party/brotli/src"]
 	path = third_party/brotli/src
 	url = https://github.com/google/brotli.git
@@ -13,7 +13,7 @@
 	url = https://github.com/google/closure-library.git
 [submodule "third_party/aprutil/src"]
 	path = third_party/aprutil/src
-	url = git://git.apache.org/apr-util.git
+	url = https://git.apache.org/apr-util.git
 [submodule "third_party/re2/src"]
 	path = third_party/re2/src
 	url = https://github.com/google/re2.git
@@ -39,7 +39,7 @@
 	url = https://github.com/redis/hiredis.git
 [submodule "third_party/apr/src"]
 	path = third_party/apr/src
-	url = git://git.apache.org/apr.git
+	url = https://git.apache.org/apr.git
 [submodule "third_party/optipng"]
 	path = third_party/optipng
 	url = https://github.com/apache/incubator-pagespeed-optipng.git
diff --git a/.travis.yml b/.travis.yml
index 4e2bb64..fc8d702 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,4 @@
 language: c++
-sudo: required
 compiler:
   - gcc
 
@@ -8,20 +7,31 @@
   # speed it up. Here we prevent travis from using git clone --recursive, so
   # below in before_install we can manually update including --jobs.
   submodules: false
+  depth: 10
 
-before_install:
+cache:
+  ccache: true
+  directories:
+    - .git/modules/
+
+addons:
   # Unfortunately, the version of git we get by default is too low to support
   # --jobs on subdmodule, so update git before pulling in the submodules.
-  - sudo add-apt-repository -y ppa:git-core/ppa
-  - sudo apt-get update -q
-  - sudo apt-get install -q -y git
+  apt:
+    sources:
+      - git-core
+    packages:
+      - git
+
+before_install:
   # git.apache.org is the canonical repo but throttles network connections.
   # using github.com seems to reduce network errors a lot.
-  - git config --global url.https://github.com/apache/.insteadOf git://git.apache.org/
+  - git config --global url.https://github.com/apache/.insteadOf https://git.apache.org/
   - git submodule update --init --recursive --jobs=2
 env:
   global:
     - MAKEFLAGS=-j3
+    - PATH="/usr/lib/ccache/:$PATH"
   matrix:
     - BIT_FLAG=
     # This would do another build for 32-bit, but we're already borderline