2017-08-27 00:10:17 +08:00
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
2017-08-29 12:02:30 +08:00
|
|
|
machine: true
|
|
|
|
environment:
|
2018-07-25 16:57:49 +08:00
|
|
|
# PROJECT_GO_PACKAGE: github.com/anacrolix/torrent
|
2017-08-29 12:02:30 +08:00
|
|
|
# Should use PROJECT_GO_PACKAGE here but it's not interpolated for this
|
|
|
|
# field. https://discuss.circleci.com/t/environment-variable-expansion-in-
|
|
|
|
# working-directory/11322/4
|
2018-07-25 16:57:49 +08:00
|
|
|
# working_directory: ~/go/src/github.com/anacrolix/torrent
|
2017-08-27 00:10:17 +08:00
|
|
|
steps:
|
2018-07-25 16:57:49 +08:00
|
|
|
# - run: echo $PROJECT_GO_PACKAGE
|
2017-08-29 12:02:30 +08:00
|
|
|
- run: echo $CIRCLE_WORKING_DIRECTORY
|
|
|
|
- run: echo $PWD
|
2019-01-08 13:37:40 +08:00
|
|
|
- run: echo $GOPATH
|
2017-08-29 12:02:30 +08:00
|
|
|
- run: echo 'export GOPATH=$HOME/go' >> $BASH_ENV
|
|
|
|
- run: echo 'export PATH="$GOPATH/bin:$PATH"' >> $BASH_ENV
|
|
|
|
- run: echo $GOPATH
|
2019-01-08 13:37:40 +08:00
|
|
|
- run: which go
|
2017-08-29 12:02:30 +08:00
|
|
|
- run: go version
|
2019-01-09 16:55:55 +08:00
|
|
|
- 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
|
2017-08-29 12:02:30 +08:00
|
|
|
- run: go version
|
2017-08-27 00:10:17 +08:00
|
|
|
- checkout
|
2017-10-12 13:32:11 +08:00
|
|
|
- run: sudo apt-get update
|
2017-08-29 12:02:30 +08:00
|
|
|
- run: sudo apt install fuse pv
|
2019-01-08 13:57:33 +08:00
|
|
|
- restore_cache:
|
2019-01-08 13:59:49 +08:00
|
|
|
keys:
|
2019-01-09 16:55:55 +08:00
|
|
|
- go-pkg-
|
2019-01-09 09:25:06 +08:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2019-01-09 16:55:55 +08:00
|
|
|
- go-cache-
|
2019-01-09 08:21:49 +08:00
|
|
|
- run: go get -d ./...
|
2018-07-25 16:57:49 +08:00
|
|
|
- run: go test -v -race ./... -count 2
|
|
|
|
- run: go test -bench . ./...
|
|
|
|
- run: set +e; CGO_ENABLED=0 go test -v ./...; true
|
2018-07-27 08:44:26 +08:00
|
|
|
- run: go install ./cmd/torrentfs
|
2019-01-08 13:57:33 +08:00
|
|
|
- save_cache:
|
2019-01-09 16:55:55 +08:00
|
|
|
key: go-pkg-{{ checksum "go.mod" }}
|
2019-01-08 13:59:49 +08:00
|
|
|
paths:
|
2019-01-09 08:23:07 +08:00
|
|
|
- ~/go/pkg
|
2017-08-29 12:02:30 +08:00
|
|
|
- run: sudo modprobe fuse
|
|
|
|
- run: fs/test.sh
|
2019-01-09 09:25:06 +08:00
|
|
|
- save_cache:
|
2019-01-09 16:55:55 +08:00
|
|
|
key: go-cache-{{ .Revision }}
|
2019-01-09 09:25:06 +08:00
|
|
|
paths:
|
|
|
|
- ~/.cache/go-build
|
|
|
|
when: always
|