config.yml 3.88 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
dignifiedquire's avatar
dignifiedquire committed
8
    resource_class: 2xlarge
9
10
11
12
13
    steps:
      - configure_environment_variables
      - run:
          name: Install Rust toolchain
          command: |
14
            (sudo apt-get update && sudo apt-get install -y ocl-icd-opencl-dev clang libssl-dev && which cargo && which rustc) || (curl https://sh.rustup.rs -sSf | sh -s -- -y)
15
16
17
18
19
20
21
22
23
24
25
26
            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
27
      - obtain_filecoin_parameters
28
29
30
31
32
33
      - save_parameter_cache
      - test_project
  build_and_test_darwin:
    macos:
      xcode: "10.0.0"
    working_directory: ~/go/src/github.com/filecoin-project/go-sectorbuilder
dignifiedquire's avatar
dignifiedquire committed
34
    resource_class: large
35
36
37
38
39
40
41
42
43
    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:
44
45
          name: Install pkg-config and md5sum
          command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config md5sha1sum
46
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
      - restore_parameter_cache
61
      - obtain_filecoin_parameters
62
63
64
65
66
      - save_parameter_cache
      - test_project

workflows:
  version: 2
67
  test_all:
68
69
70
71
72
73
    jobs:
      - build_and_test_linux
      - build_and_test_darwin

commands:
  configure_environment_variables:
laser's avatar
laser committed
74
75
76
77
    steps:
      - run:
          name: Configure environment variables
          command: |
78
79
            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
80
            echo 'export FIL_PROOFS_PARAMETER_CACHE="${HOME}/filecoin-proof-parameters/"' >> $BASH_ENV
laser's avatar
laser committed
81
            echo 'export GO111MODULE=on' >> $BASH_ENV
82
83
            echo 'export RUST_LOG=info' >> $BASH_ENV
  obtain_filecoin_parameters:
84
85
    steps:
      - run:
86
          name: Obtain filecoin groth parameters
87
          command: ./paramcache --params-for-sector-sizes=1024
88
          no_output_timeout: 30m
89
90
  update_submodules:
    steps:
laser's avatar
laser committed
91
92
93
      - run:
          name: Update submodules
          command: git submodule update --init --recursive
94
95
  build_project:
    steps:
laser's avatar
laser committed
96
      - run:
97
          name: Build project
laser's avatar
laser committed
98
          command: make
99
100
101
102
      - run:
          name: Ensure paramcache is installed to project root
          command: |
            test -f ./paramcache \
dignifiedquire's avatar
dignifiedquire committed
103
              || (rustup run --install nightly cargo install filecoin-proofs --force --git=https://github.com/filecoin-project/rust-fil-proofs.git --branch="feat/election-post" --bin=paramcache --root=./ \
104
                && mv ./bin/paramcache ./paramcache)
105
106
  lint_project:
    steps:
laser's avatar
laser committed
107
      - run:
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
114
          command: RUST_LOG=info go test -p 1
115
116
117
118
  restore_parameter_cache:
    steps:
      - restore_cache:
          keys:
119
            - v17-proof-params-{{ arch }}
120
121
122
  save_parameter_cache:
    steps:
      - save_cache:
123
          key: v17-proof-params-{{ arch }}
124
125
          paths:
            - "~/filecoin-proof-parameters/"