惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
G
Google Developers Blog
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
F
Full Disclosure
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
Help Net Security
Help Net Security
The Hacker News
The Hacker News
IT之家
IT之家
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
V
Visual Studio Blog
博客园 - 聂微东
Hacker News: Ask HN
Hacker News: Ask HN
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Last Week in AI
Last Week in AI
Schneier on Security
Schneier on Security
N
News and Events Feed by Topic
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
Google DeepMind News
Google DeepMind News
Cloudbric
Cloudbric
N
News | PayPal Newsroom
A
About on SuperTechFans
S
Schneier on Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
雷峰网
雷峰网
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
K
Kaspersky official blog
The Cloudflare Blog
I
Intezer

Backups done right! on restic

restic · Restic 0.19.1 Released restic · Restic 0.19.0 Released restic · Restic 0.18.1 Released restic · REST-server 0.14.0 released restic · Restic 0.18.0 Released restic · Restic 0.17.3 Released restic · Restic 0.17.2 Released restic · Restic 0.17.1 Released restic · Restic 0.17.0 Released restic · REST-server 0.13.0 released restic · Restic 0.16.5 Released restic · Restic 0.16.4 Released restic · Restic 0.16.3 Released restic · Restic 0.16.2 Released restic · Restic 0.16.1 Released restic · Restic 0.16.0 Released restic · REST-server 0.12.1 released restic · REST-server 0.12.0 released restic · Restic 0.15.2 released restic · Restic 0.15.1 Released restic · Restic 0.15.0 Released restic · Restic 0.14.0 Released restic · Restic 0.13.1 Released restic · Restic 0.13.0 Released restic · Rest Server 0.11.0 released restic · Restic 0.12.1 released restic · Restic 0.12.0 released restic · Restic 0.11.0 released restic · restic 0.10.0 released restic · Rest Server 0.10.0 Released restic · restic 0.9.6 released restic · restic 0.9.5 released restic · restic 0.9.4 released restic · New Year, New Infrastructure! restic · restic 0.9.3 released restic · Configuring GitHub Issue Templates restic · restic 0.9.2 released restic · restic 0.9.1 released restic · restic 0.9.0 released restic · The restic project turns four! restic · Using rclone as a restic Backend restic · restic 0.8.3 released restic · restic 0.8.2 released restic · moving to restic.net restic · restic 0.8.1 released restic · restic 0.8.0 released restic · Upcoming changes for the S3 backend restic · restic 0.7.3 released restic · restic 0.7.2 released restic · Meeting at FrOSCon 2017 restic · Discourse Forum restic · Please upgrade to restic 0.7.1! restic · restic 0.7.1 released restic · Meeting at FrOSCon 2017 restic · restic 0.7.0 released restic · restic on GoTime #48 restic · restic 0.6.0 released restic · restic 0.6.1 released restic · restic 0.6.0-rc.1 released restic · restic 0.5.0 released restic · restic 0.4.0 released restic · The Go Devroom at FOSDEM 2017 restic · restic 0.3.3 released, Debian package restic · restic 0.3.2 released restic · restic 0.3.1 released restic · restic 0.3.0 released restic · Removing Snapshots restic · restic 0.2.0 released restic · Documentation and Manual restic · OpenChaos at CCC Cologne: restic restic · Verifying Code Archive Integrity restic · Foundation - Introducing Content Defined Chunking (CDC) A Solution to the Backup Inconvenience restic · Introduction to the restic Blog
restic · Enabling the Go Build Cache on Travis/AppVeyor
2018-09-02 · via Backups done right! on restic

02 Sep 2018

The restic project runs the unit and integration tests for each pushed commit and each pull request. We’re using Travis CI for Linux and OS X, and AppVeyor for Windows. We’re very grateful that they provide their services free of charge for Open Source projects!

Our project not only runs the tests on Travis, but also compiles restic for each supported architecture, operating system, and version of Go. Go is known for its fast compilation times, but still, compilation takes its time. Roughly, for each version of Go, running all the tests takes between 13 and 25 minutes:

Build Times on Travis CI Before Caching Build Cache

With the release of Go 1.10, a build cache was introduced, which saves compiled artifacts in a cache directory. On Linux, that’s usually located in ~/.cache/go-build. So when the same package (with the same build tags and architecture and so on) is to be compiled again, the Go compiler can just use the cached version.

Travis executes the tests in a fresh container each time they are run, but we can tell it to keep the build cache directory and extract it before the tests are run next time. The entry in the configuration file .travis.yml looks like this:

cache:
  directories:
    - $HOME/.cache/go-build
    - $HOME/gopath/pkg/mod

This also caches another directory in the GOPATH called pkg/mod, which contains information about released modules. This is a feature introduced with Go 1.11.

The directories listed above work for Linux, but the Go build cache directory is somewhere else on OS X, so we need to add the cache entries to our build matrix:

matrix:
  include:
    - os: linux
      go: "1.9.x"
      cache:
        directories:
          - $HOME/.cache/go-build
          - $HOME/gopath/pkg/mod

    - os: linux
      go: "1.10.x"
      cache:
        directories:
          - $HOME/.cache/go-build
          - $HOME/gopath/pkg/mod

    - os: linux
      go: "1.11.x"
      sudo: true
      cache:
        directories:
          - $HOME/.cache/go-build
          - $HOME/gopath/pkg/mod

    - os: osx
      go: "1.11.x"
      cache:
        directories:
          - $HOME/Library/Caches/go-build
          - $HOME/gopath/pkg/mod

After a successful build, Travis will then archive both directories, and extract them again for the next test run. Indeed, this speeds up running the tests a great deal (depending on how much code has changed):

Build Times on Travis CI With Caching Build Cache

You can see in the screenshot above that the build time for Go 1.9 wasn’t reduced at all since it does not have the build cache feature.

AppVeyor also has a build cache feature, it can be enabled by specifying the list of directories to cache in the appveyor.yml like this:

cache:
  - '%LocalAppData%\go-build'

For restic, the build cache is not so relevant on AppVeyor, since we’re only using it to run our integration tests on Windows and don’t run any cross-compilation.

We hope that the build cache does not become too large, its size is limited for both Travis and AppVeyor. The Go compiler will delete files which haven’t been used recently, so we hope this is enough to keep the cache size small. We’ll keep you posted when we discover any problems with this approach.

Let us know what you think in the comments (which are hosted in our forum)!