version: 2.0 aliases: make_out_dirs: &make_out_dirs run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_WORKSPACE $CIRCLE_TEST_REPORTS/{unit,sharness} restore_gomod: &restore_gomod restore_cache: keys: - v4-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }}-{{ .Environment.CIRCLE_JOB }} - v4-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }}- - v4-dep-{{ .Branch }}- - v4-dep-master- store_gomod: &store_gomod save_cache: key: v4-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }}-{{ .Environment.CIRCLE_JOB }} paths: - ~/go/pkg/mod - ~/.cache/go-build/ defaults: &defaults working_directory: ~/ipfs/go-ipfs environment: GO111MODULE: "on" TEST_NO_DOCKER: 1 TEST_NO_FUSE: 1 GOPATH: /home/circleci/go CIRCLE_TEST_REPORTS: /tmp/circleci-test-results CIRCLE: 1 SERVICE: circle-ci CIRCLE_ARTIFACTS: /tmp/circleci-artifacts CIRCLE_WORKSPACE: /tmp/circleci-workspace TEST_VERBOSE: 1 TRAVIS: 1 jobs: gobuild: docker: - image: circleci/golang:1.12 <<: *defaults steps: - checkout - *make_out_dirs - *restore_gomod - run: command: make cmd/ipfs-try-build environment: TEST_NO_FUSE: 0 - run: command: make cmd/ipfs-try-build environment: TEST_NO_FUSE: 1 - *store_gomod golint: <<: *defaults docker: - image: circleci/golang:1.12 steps: - checkout - *make_out_dirs - *restore_gomod - run: | make -O test_go_lint - *store_gomod gotest: docker: - image: circleci/golang:1.12 <<: *defaults steps: - checkout - *make_out_dirs - *restore_gomod - run: | make -j 1 test/unit/gotest.junit.xml \ && [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] - run: when: always command: bash <(curl -s https://codecov.io/bash) -cF unittests -X search -f coverage/unit_tests.coverprofile - run: when: always command: mv "test/unit/gotest.junit.xml" /tmp/circleci-test-results/unit - *store_gomod - store_test_results: path: /tmp/circleci-test-results # Save artifacts - store_artifacts: path: /tmp/circleci-artifacts - store_artifacts: path: /tmp/circleci-test-results sharness: docker: - image: circleci/golang:1.12 <<: *defaults steps: - run: sudo apt install socat - checkout - *make_out_dirs - *restore_gomod - run: make -O -j 10 coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 - run: when: always command: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f coverage/sharness_tests.coverprofile - run: mv "test/sharness/test-results/sharness.xml" /tmp/circleci-test-results/sharness # make sure we fail if there are test failures - run: find test/sharness/test-results -name 't*-*.sh.*.counts' | test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - *store_gomod - store_test_results: path: /tmp/circleci-test-results # Save artifacts - store_artifacts: path: /tmp/circleci-artifacts - store_artifacts: path: /tmp/circleci-test-results build: docker: - image: circleci/golang:1.12 <<: *defaults steps: - checkout - *make_out_dirs - *restore_gomod - run: name: Building command: make build - run: name: Storing command: | mkdir -p /tmp/circleci-workspace/bin cp cmd/ipfs/ipfs /tmp/circleci-workspace/bin - persist_to_workspace: root: /tmp/circleci-workspace paths: - bin/ipfs - *store_gomod interop: docker: - image: circleci/node:10 <<: *defaults steps: - *make_out_dirs - attach_workspace: at: /tmp/circleci-workspace - run: git clone https://github.com/ipfs/interop.git - run: command: npm install working_directory: ~/ipfs/go-ipfs/interop environment: IPFS_GO_EXEC: /tmp/circleci-workspace/bin/ipfs - run: command: npm test working_directory: ~/ipfs/go-ipfs/interop environment: IPFS_GO_EXEC: /tmp/circleci-workspace/bin/ipfs go-ipfs-api: docker: - image: circleci/golang:1.12 <<: *defaults steps: - *make_out_dirs - attach_workspace: at: /tmp/circleci-workspace - run: git clone https://github.com/ipfs/go-ipfs-api.git - run: name: IPFS Daemon command: /tmp/circleci-workspace/bin/ipfs daemon --init --enable-namesys-pubsub background: true - run: name: Waiting for the daemon no_output_timeout: 10s command: | while ! /tmp/circleci-workspace/bin/ipfs id --api=/ip4/127.0.0.1/tcp/5001 2>/dev/null; do sleep 1 done - run: command: go test -v ./... working_directory: ~/ipfs/go-ipfs/go-ipfs-api go-ipfs-http-client: docker: - image: circleci/golang:1.12 <<: *defaults steps: - *make_out_dirs - attach_workspace: at: /tmp/circleci-workspace - run: git clone https://github.com/ipfs/go-ipfs-http-client.git - run: command: | export PATH=/tmp/circleci-workspace/bin:$PATH go test -v ./... working_directory: ~/ipfs/go-ipfs/go-ipfs-http-client - run: command: /tmp/circleci-workspace/bin/ipfs shutdown workflows: version: 2 test: jobs: - gobuild - golint - gotest - sharness - build - interop: requires: - build - go-ipfs-api: requires: - build - go-ipfs-http-client: requires: - build