version: 2.1 jobs: build_and_test_linux: docker: - image: circleci/golang:1.12.1-stretch working_directory: ~/go/src/github.com/filecoin-project/go-sectorbuilder resource_class: xlarge 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 - obtain_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 and md5sum command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config md5sha1sum - 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 - obtain_filecoin_parameters - save_parameter_cache - test_project workflows: version: 2 test_all: jobs: - build_and_test_linux - build_and_test_darwin commands: configure_environment_variables: steps: - run: name: Configure environment variables command: | 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 echo 'export FIL_PROOFS_PARAMETER_CACHE="${HOME}/filecoin-proof-parameters/"' >> $BASH_ENV echo 'export GO111MODULE=on' >> $BASH_ENV echo 'export RUST_LOG=info' >> $BASH_ENV obtain_filecoin_parameters: steps: - run: name: Obtain filecoin groth parameters command: ./paramcache --test-only no_output_timeout: 30m update_submodules: steps: - run: name: Update submodules command: git submodule update --init --recursive build_project: steps: - run: name: Build project command: make - 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) lint_project: steps: - run: name: Lint project command: go run github.com/golangci/golangci-lint/cmd/golangci-lint run test_project: steps: - run: name: Test project command: RUST_LOG=info go test restore_parameter_cache: steps: - restore_cache: keys: - v14b-proof-params save_parameter_cache: steps: - save_cache: key: v14b-proof-params paths: - "~/filecoin-proof-parameters/"