From c9f4078224dea7d5ff8edfbc7e07bb34986d3522 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 9 Jan 2019 19:55:55 +1100 Subject: [PATCH] Cache go master, use existing go for bootstrap, and tighten some cache keys --- .circleci/config.yml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 34d8e801..aa61f2f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,21 +18,35 @@ jobs: - run: echo $GOPATH - run: which go - run: go version - - run: cd /usr/local && sudo rm -r go && sudo mkdir go go1.4 && sudo chown `whoami` go go1.4 - - run: cd /usr/local && git clone git://github.com/golang/go - - run: cd /usr/local/go && git branch -f -t go1.4 origin/release-branch.go1.4 && cd .. && git clone --single-branch -b go1.4 go go1.4 - - run: cd /usr/local/go1.4/src && ./make.bash - - run: cd /usr/local/go/src && GOROOT_BOOTSTRAP=/usr/local/go1.4 ./make.bash + - run: | + cd /usr/local + sudo mkdir go.master + sudo chown `whoami` go.master + - restore_cache: + key: go-root- + - run: | + cd /usr/local + git clone git://github.com/golang/go go.master || true + cd go.master + git pull + [[ -x bin/go && `git rev-parse HEAD` == `cat anacrolix.built` ]] && exit + cd src + ./make.bash || exit + git rev-parse HEAD > ../anacrolix.built + - save_cache: + paths: /usr/local/go.master + key: go-root-{{ checksum "/usr/local/go.master/anacrolix.built" }} + - run: echo 'export PATH="/usr/local/go.master/bin:$PATH"' >> $BASH_ENV - run: go version - checkout - run: sudo apt-get update - run: sudo apt install fuse pv - restore_cache: keys: - - go-pkg + - go-pkg- - restore_cache: keys: - - go-cache + - go-cache- - run: go get -d ./... - run: go test -v -race ./... -count 2 - run: go test -bench . ./... @@ -43,13 +57,13 @@ jobs: # - run: GO111MODULE=off go install github.com/anacrolix/godo - run: go install ./cmd/torrentfs - save_cache: - key: go-pkg-{{ epoch }} + key: go-pkg-{{ checksum "go.mod" }} paths: - ~/go/pkg - run: sudo modprobe fuse - run: fs/test.sh - save_cache: - key: go-cache-{{ epoch }} + key: go-cache-{{ .Revision }} paths: - ~/.cache/go-build when: always