summaryrefslogtreecommitdiffstats
path: root/.circleci/config.yml
blob: 4e14c1ff56fc22716f320d1e49f670ecb0e117f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
version: 2
jobs:
  build:
    docker:
      - image: circleci/golang:1.12
    working_directory: /go/src/github.com/jesseduffield/lazygit
    steps:
      - checkout
      - run:
          name: Ensure go.mod file is up to date
          command: |
            export GO111MODULE=on
            rm go.sum
            mv go.mod /tmp/
            go mod init
            export GO111MODULE=auto

            if [ $(diff /tmp/go.mod go.mod|wc -l) -gt 0 ]; then
              diff /tmp/go.mod go.mod
              exit 1;
            fi
      - run:
          name: Run gofmt -s
          command: |
            if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then
             find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;
             exit 1;
            fi
      - restore_cache:
          keys:
            - pkg-cache-{{ checksum "Gopkg.lock" }}-v4
      - run:
          name: Run tests
          command: |
            ./test.sh
      - run:
          name: Compile project on every platform
          command: |
            go get github.com/mitchellh/gox
            gox -parallel 10 -os "linux freebsd netbsd windows" -osarch "darwin/i386 darwin/amd64"
      - run:
          name: Push on codecov result
          command: |
            bash <(curl -s https://codecov.io/bash)
      - save_cache:
          key: pkg-cache-{{ checksum "Gopkg.lock" }}-v4
          paths:
            - ~/.cache/go-build

  release:
    docker:
      - image: circleci/golang:1.10
    working_directory: /go/src/github.com/jesseduffield/lazygit
    steps:
      - checkout
      - run:
          name: Run gorelease
          command: |
            curl -sL https://git.io/goreleaser | bash

workflows:
  version: 2
  build:
    jobs:
      - build
  release:
    jobs:
      - release:
          filters:
            tags:
              only: /v[0-9]+(\.[0-9]+)*/
            branches:
              ignore: /.*/