Cache go master, use existing go for bootstrap, and tighten some cache keys

This commit is contained in:
Matt Joiner 2019-01-09 19:55:55 +11:00
parent fa4dbacd79
commit c9f4078224
1 changed files with 23 additions and 9 deletions

View File

@ -18,21 +18,35 @@ jobs:
- run: echo $GOPATH - run: echo $GOPATH
- run: which go - run: which go
- run: go version - run: go version
- run: cd /usr/local && sudo rm -r go && sudo mkdir go go1.4 && sudo chown `whoami` go go1.4 - run: |
- run: cd /usr/local && git clone git://github.com/golang/go cd /usr/local
- 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 sudo mkdir go.master
- run: cd /usr/local/go1.4/src && ./make.bash sudo chown `whoami` go.master
- run: cd /usr/local/go/src && GOROOT_BOOTSTRAP=/usr/local/go1.4 ./make.bash - 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 - run: go version
- checkout - checkout
- run: sudo apt-get update - run: sudo apt-get update
- run: sudo apt install fuse pv - run: sudo apt install fuse pv
- restore_cache: - restore_cache:
keys: keys:
- go-pkg - go-pkg-
- restore_cache: - restore_cache:
keys: keys:
- go-cache - go-cache-
- run: go get -d ./... - run: go get -d ./...
- run: go test -v -race ./... -count 2 - run: go test -v -race ./... -count 2
- run: go test -bench . ./... - run: go test -bench . ./...
@ -43,13 +57,13 @@ jobs:
# - run: GO111MODULE=off go install github.com/anacrolix/godo # - run: GO111MODULE=off go install github.com/anacrolix/godo
- run: go install ./cmd/torrentfs - run: go install ./cmd/torrentfs
- save_cache: - save_cache:
key: go-pkg-{{ epoch }} key: go-pkg-{{ checksum "go.mod" }}
paths: paths:
- ~/go/pkg - ~/go/pkg
- run: sudo modprobe fuse - run: sudo modprobe fuse
- run: fs/test.sh - run: fs/test.sh
- save_cache: - save_cache:
key: go-cache-{{ epoch }} key: go-cache-{{ .Revision }}
paths: paths:
- ~/.cache/go-build - ~/.cache/go-build
when: always when: always