config.yml 4.13 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
    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
26
      - generate_parameter_checksum
27
      - restore_parameter_cache
28
      - obtain_filecoin_parameters
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
      - 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:
45
46
          name: Install pkg-config and md5sum
          command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config md5sha1sum
47
48
49
50
51
52
53
54
55
56
57
58
59
60
      - 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
61
      - generate_parameter_checksum
62
      - restore_parameter_cache
63
      - obtain_filecoin_parameters
64
65
66
67
68
      - save_parameter_cache
      - test_project

workflows:
  version: 2
69
  test_all:
70
71
72
73
74
75
    jobs:
      - build_and_test_linux
      - 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
            echo 'export RUST_LOG=info' >> $BASH_ENV
  obtain_filecoin_parameters:
86
87
    steps:
      - run:
88
89
90
          name: Obtain filecoin groth parameters
          command: ./paramcache --test-only
          no_output_timeout: 30m
91
92
  update_submodules:
    steps:
laser's avatar
laser committed
93
94
95
      - run:
          name: Update submodules
          command: git submodule update --init --recursive
96
97
  build_project:
    steps:
laser's avatar
laser committed
98
      - run:
99
          name: Build project
laser's avatar
laser committed
100
          command: make
101
102
103
104
105
106
      - run:
          name: Ensure paramcache is installed to project root
          command: |
            test -f ./paramcache \
              || (rustup run --install nightly cargo install filecoin-proofs --force --git=https://github.com/filecoin-project/rust-fil-proofs.git --branch=master --bin=paramcache --root=./ \
                && mv ./bin/paramcache ./paramcache)
107
108
  lint_project:
    steps:
laser's avatar
laser committed
109
      - run:
110
111
112
113
114
115
          name: Lint project
          command: go run github.com/golangci/golangci-lint/cmd/golangci-lint run
  test_project:
    steps:
      - run:
          name: Test project
116
          command: RUST_LOG=info go test
117
118
119
120
  restore_parameter_cache:
    steps:
      - restore_cache:
          keys:
121
            - v1-proof-params-{{ checksum "parameter-checksum.txt" }}
122
123
124
  save_parameter_cache:
    steps:
      - save_cache:
125
          key: v1-proof-params-{{ checksum "parameter-checksum.txt" }}
126
127
          paths:
            - "~/filecoin-proof-parameters/"
128
129
130
131
132
133
  generate_parameter_checksum:
    steps:
      - run:
          name: create parameter cache checksum
          command: md5sum ./paramcache | cut -d ' ' -f 1 >> parameter-checksum.txt