version: 2.0 defaults: &defaults working_directory: ~/ipfs/go-ipfs environment: GO111MODULE: "on" TEST_NO_FUSE: 1 TEST_NO_DOCKER: 1 GOPATH: /home/circleci/.go_workspace CIRCLE_TEST_REPORTS: /tmp/circleci-test-results CIRCLE: 1 SERVICE: circle-ci TEST_NO_DOCKER: 1 CIRCLE_ARTIFACTS: /tmp/circleci-artifacts TEST_VERBOSE: 1 TRAVIS: 1 IMPORT_PATH: github.com/ipfs/go-ipfs docker: - image: circleci/golang:1.11 jobs: gotest: <<: *defaults steps: - checkout - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS - restore_cache: keys: - v2-dep-{{ .Branch }}- - v2-dep-master- - run: rm -rf "$HOME/.go_workspace/src/$IMPORT_PATH" - run: mkdir -p "$HOME/.go_workspace/src/$IMPORT_PATH" - run: cp -aT . "$HOME/.go_workspace/src/$IMPORT_PATH" - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && go mod download - save_cache: key: v2-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }} paths: - ~/.go_workspace/pkg/mod - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && curl -s https://codecov.io/bash > codecov - run: | cd "$HOME/.go_workspace/src/$IMPORT_PATH" \ && make -j 1 test/unit/gotest.junit.xml \ && [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && bash codecov -cF unittests -X search -f coverage/unit_tests.coverprofile - run: when: always command: mv "$HOME/.go_workspace/src/${IMPORT_PATH}/test/unit/gotest.junit.xml" /tmp/circleci-test-results - 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 - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS - restore_cache: keys: - v2-dep-{{ .Branch }}- - v2-dep-master- - run: rm -rf "$HOME/.go_workspace/src/$IMPORT_PATH" - run: mkdir -p "$HOME/.go_workspace/src/$IMPORT_PATH" - run: cp -aT . "$HOME/.go_workspace/src/$IMPORT_PATH" - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && go mod download - save_cache: key: v2-dep-{{ .Branch }}-{{ checksum "~/ipfs/go-ipfs/go.sum" }} paths: - ~/.go_workspace/pkg/mod - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && curl -s https://codecov.io/bash > codecov - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && make -j 10 coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && bash codecov -cF sharness -X search -f coverage/sharness_tests.coverprofile - run: mv "$HOME/.go_workspace/src/${IMPORT_PATH}/test/sharness/test-results/sharness.xml" /tmp/circleci-test-results # make sure we fail if there are test failures - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && ls test/sharness/test-results/t*-*.sh.*.counts | test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - 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: - gotest - sharness