version: 2.0 aliases: make_out_dirs: &make_out_dirs run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS/{unit,sharness} restore_gomod: &restore_gomod restore_cache: keys: - v3-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }}-{{ .Environment.CIRCLE_JOB }} - v3-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }}- - v3-dep-{{ .Branch }}- - v3-dep-master- store_gomod: &store_gomod save_cache: key: v3-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 TEST_VERBOSE: 1 TRAVIS: 1 docker: - image: circleci/golang:1.12 jobs: gobuild: <<: *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 steps: - checkout - *make_out_dirs - *restore_gomod - run: | make -O test_go_lint - *store_gomod gotest: <<: *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: <<: *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 workflows: version: 2 test: jobs: - gobuild - golint - gotest - sharness