config.yml 3.36 KB
Newer Older
Jakub Sztandera's avatar
Jakub Sztandera committed
1
version: 2.0
Łukasz Magiera's avatar
Łukasz Magiera committed
2 3 4 5

defaults: &defaults
  working_directory: ~/ipfs/go-ipfs
  environment:
Jakub Sztandera's avatar
Jakub Sztandera committed
6
    GO111MODULE: "on"
Łukasz Magiera's avatar
Łukasz Magiera committed
7
    TEST_NO_FUSE: 1
Jakub Sztandera's avatar
Jakub Sztandera committed
8 9
    TEST_NO_DOCKER: 1
    GOPATH: /home/circleci/.go_workspace
Łukasz Magiera's avatar
Łukasz Magiera committed
10 11 12 13 14 15 16 17 18 19
    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:
Jakub Sztandera's avatar
Jakub Sztandera committed
20
    - image: circleci/golang:1.11
Łukasz Magiera's avatar
Łukasz Magiera committed
21 22 23 24 25 26 27 28 29

jobs:
  gotest:
    <<: *defaults
    steps:
    - checkout
    - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
    - restore_cache:
        keys:
Jakub Sztandera's avatar
Jakub Sztandera committed
30 31
        - v2-dep-{{ .Branch }}-
        - v2-dep-master-
Łukasz Magiera's avatar
Łukasz Magiera committed
32 33 34 35 36 37 38

    - 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" && make deps

    - save_cache:
Jakub Sztandera's avatar
Jakub Sztandera committed
39
        key: v2-dep-{{ .Branch }}-{{ epoch }}
Łukasz Magiera's avatar
Łukasz Magiera committed
40 41 42 43 44 45 46
        paths:
        - ~/.go_workspace
        - ~/.go_workspace/src/gx/ipfs
        - ./node_modules


    - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && curl -s https://codecov.io/bash > codecov
47
    - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && make -j 1 test/unit/gotest.junit.xml
Łukasz Magiera's avatar
Łukasz Magiera committed
48
    - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && bash codecov -cF unittests -X search -f coverage/unit_tests.coverprofile
49
    - run: mv "$HOME/.go_workspace/src/${IMPORT_PATH}/test/unit/gotest.junit.xml" /tmp/circleci-test-results
Łukasz Magiera's avatar
Łukasz Magiera committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63
    - 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:
    - checkout
    - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
    - restore_cache:
        keys:
Jakub Sztandera's avatar
Jakub Sztandera committed
64 65
        - v2-dep-{{ .Branch }}-
        - v2-dep-master-
Łukasz Magiera's avatar
Łukasz Magiera committed
66 67 68 69 70 71 72

    - 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" && make deps

    - save_cache:
Jakub Sztandera's avatar
Jakub Sztandera committed
73
        key: v2-dep-{{ .Branch }}-{{ epoch }}
Łukasz Magiera's avatar
Łukasz Magiera committed
74 75 76 77 78 79 80
        paths:
        - ~/.go_workspace
        - ~/go1.11.linux-amd64.tar.gz
        - ~/.go_workspace/src/gx/ipfs
        - ./node_modules

    - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && curl -s https://codecov.io/bash > codecov
81
    - 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
Łukasz Magiera's avatar
Łukasz Magiera committed
82
    - run: cd "$HOME/.go_workspace/src/$IMPORT_PATH" && bash codecov -cF sharness -X search -f coverage/sharness_tests.coverprofile
83 84 85 86
    - 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'
Łukasz Magiera's avatar
Łukasz Magiera committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100
    - 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