]> Sergey Matveev's repositories - btrtrc.git/blobdiff - .circleci/config.yml
Drop support for go 1.20
[btrtrc.git] / .circleci / config.yml
index d253efa0895a8eda449e56ec800462b16f2c63d2..f25b011d42b79f8f0ba122a5773191fbb80e7c49 100644 (file)
@@ -2,34 +2,63 @@ version: 2
 jobs:
   build:
     machine: true
+    # This would be for if we didn't have machine: true. Could help with circleci local execute, which doesn't support VMs?
+    # docker:
+    #   - image: cimg/go:1.13
     environment:
-      # PROJECT_GO_PACKAGE: github.com/anacrolix/torrent
-    # 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
-    # working_directory: ~/go/src/github.com/anacrolix/torrent
+      GO_BRANCH: release-branch.go1.16
     steps:
-      # - run: echo $PROJECT_GO_PACKAGE
       - run: echo $CIRCLE_WORKING_DIRECTORY
       - run: echo $PWD
+      - run: echo $GOPATH
       - run: echo 'export GOPATH=$HOME/go' >> $BASH_ENV
       - run: echo 'export PATH="$GOPATH/bin:$PATH"' >> $BASH_ENV
       - run: echo $GOPATH
+      - run: which go || sudo apt install golang-go
       - run: go version
-      - run: cd /usr/local && sudo rm -r go && sudo mkdir go go1.4 && sudo chown `whoami` go go1.4 && git clone git://github.com/golang/go && cd go && git branch -f -t go1.4 origin/release-branch.go1.4 && cd .. && git clone --single-branch -b go1.4 go go1.4 && cd go1.4/src && ./make.bash && cd ../../go/src && GOROOT_BOOTSTRAP=/usr/local/go1.4 ./make.bash
+      - run: |
+          cd /usr/local
+          sudo mkdir go.local
+          sudo chown `whoami` go.local
+      - restore_cache:
+          key: go-local-
+      - run: |
+          cd /usr/local
+          git clone git://github.com/golang/go go.local || true
+          cd go.local
+          git fetch
+          git checkout "$GO_BRANCH"
+          [[ -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.local
+          key: go-local-{{ checksum "/usr/local/go.local/anacrolix.built" }}
+      - run: echo 'export PATH="/usr/local/go.local/bin:$PATH"' >> $BASH_ENV
       - run: go version
       - checkout
       - run: sudo apt-get update
       - run: sudo apt install fuse pv
-      # - run: go get -t -d -v -race $PROJECT_GO_PACKAGE/...
+      - restore_cache:
+          keys:
+            - go-pkg-
+      - restore_cache:
+          keys:
+            - go-cache-
+      - run: go get -d ./...
       - run: go test -v -race ./... -count 2
       - run: go test -bench . ./...
-      # - run: CGO_ENABLED=0 go get -t -d -v $PROJECT_GO_PACKAGE/...
       - run: set +e; CGO_ENABLED=0 go test -v ./...; true
-      - run: go install golang.org/x/mobile/cmd/gomobile
-      - run: gomobile init
-      - run: gomobile build -target=android $PROJECT_GO_PACKAGE
-      # - run: GO111MODULE=off go install github.com/anacrolix/godo
-      - run: go install ./cmd/torrentfs
+      - run: GOARCH=386 go test ./... -count 2 -bench . || true
+      - run: go install github.com/anacrolix/godo@latest
+      - save_cache:
+          key: go-pkg-{{ checksum "go.mod" }}
+          paths:
+            - ~/go/pkg
       - run: sudo modprobe fuse
       - run: fs/test.sh
+      - save_cache:
+          key: go-cache-{{ .Revision }}
+          paths:
+            - ~/.cache/go-build