config.yml 3.52 KB
Newer Older
laser's avatar
laser committed
1
2
3
version: 2.1

jobs:
4
  build_and_test_linux:
laser's avatar
laser committed
5
6
    docker:
      - image: circleci/golang:1.12.1-stretch
7
    working_directory: ~/go/src/github.com/filecoin-project/go-sectorbuilder
laser's avatar
laser committed
8
    resource_class: xlarge
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
74
75
    steps:
      - configure_environment_variables
      - run:
          name: Install Rust toolchain
          command: |
            (sudo apt-get update && sudo apt-get install -y clang libssl-dev && which cargo && which rustc) || (curl https://sh.rustup.rs -sSf | sh -s -- -y)
            rustc --version
      - run:
          name: Install jq
          command: |
            sudo apt-get update
            sudo apt-get install -y jq
            jq --version
      - checkout
      - update_submodules
      - build_project
      - lint_project
      - restore_parameter_cache
      - fetch_filecoin_parameters
      - save_parameter_cache
      - test_project
  build_and_test_darwin:
    macos:
      xcode: "10.0.0"
    working_directory: ~/go/src/github.com/filecoin-project/go-sectorbuilder
    resource_class: medium
    steps:
      - configure_environment_variables
      - run:
          name: Install go
          command: |
            curl https://dl.google.com/go/go1.12.1.darwin-amd64.pkg -o /tmp/go.pkg && \
            sudo installer -pkg /tmp/go.pkg -target /
            go version
      - run:
          name: Install pkg-config
          command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config
      - run:
          name: Install Rust toolchain
          command: |
            curl https://sh.rustup.rs -sSf | sh -s -- -y
            rustc --version
      - run:
          name: Install jq
          command: |
            HOMEBREW_NO_AUTO_UPDATE=1 brew install jq
            jq --version
      - checkout
      - update_submodules
      - build_project
      - lint_project
      - restore_parameter_cache
      - fetch_filecoin_parameters
      - save_parameter_cache
      - test_project

workflows:
  version: 2
  build_and_test_linux:
    jobs:
      - build_and_test_linux
  build_and_test_darwin:
    jobs:
      - build_and_test_darwin

commands:
  configure_environment_variables:
laser's avatar
laser committed
76
77
78
79
    steps:
      - run:
          name: Configure environment variables
          command: |
80
81
            echo 'export PATH="/usr/local/go/bin:${HOME}/.cargo/bin:${PATH}:${HOME}/go/bin:${HOME}/.bin"' >> $BASH_ENV
            echo 'export GOPATH="${HOME}/go"' >> $BASH_ENV
laser's avatar
laser committed
82
83
            echo 'export FILECOIN_PARAMETER_CACHE="${HOME}/filecoin-proof-parameters/"' >> $BASH_ENV
            echo 'export GO111MODULE=on' >> $BASH_ENV
84
85
86
87
88
  fetch_filecoin_parameters:
    steps:
      - run:
          name: Fetch filecoin groth parameters
          command: |
Sidney Keese's avatar
Sidney Keese committed
89
            ./scripts/retry.sh 1 10 1000 ./scripts/with-dots.sh ./bin/paramfetch --params-for-sector-sizes=1024 --verbose
90
91
  update_submodules:
    steps:
laser's avatar
laser committed
92
93
94
      - run:
          name: Update submodules
          command: git submodule update --init --recursive
95
96
  build_project:
    steps:
laser's avatar
laser committed
97
      - run:
98
          name: Build project
laser's avatar
laser committed
99
          command: make
100
101
  lint_project:
    steps:
laser's avatar
laser committed
102
      - run:
103
104
105
106
107
108
109
110
111
112
113
          name: Lint project
          command: go run github.com/golangci/golangci-lint/cmd/golangci-lint run
  test_project:
    steps:
      - run:
          name: Test project
          command: go test
  restore_parameter_cache:
    steps:
      - restore_cache:
          keys:
Sidney Keese's avatar
Sidney Keese committed
114
            - v1-proof-params-{{ checksum "./bin/paramfetch" }}
115
116
117
  save_parameter_cache:
    steps:
      - save_cache:
Sidney Keese's avatar
Sidney Keese committed
118
          key: v1-proof-params-{{ checksum "./bin/paramfetch" }}
119
120
          paths:
            - "~/filecoin-proof-parameters/"