<commit_before>version: 2

executorType: docker

containerInfo:
  - image: koding/base@sha256:55cf1b683bde71eac3a162775d8adad1e6061832cb55fe8b39866ea98c3df74a

  - image: mongo:2.6
    cmd: ["--nojournal", "--noprealloc", "--smallfiles"]

  - image: koding/postgres

  - image: rabbitmq:3

  - image: redis

stages:

  build:
    workDir: ~/koding
    steps:

      - type: checkout

      - type: cache-restore
        keys:
          - node_modules-{{ checksum "package.json" }}
      - type: cache-restore
        keys:
          - client-node_modules-{{ checksum "client/package.json" }}
      - type: cache-restore
        keys:
          - landing-node_modules-{{ checksum "client/landing/package.json" }}

      - type: shell
        name: npm install
        command: npm install --unsafe-perm

      - type: cache-save
        key: node_modules-{{ checksum "package.json" }}
        paths:
          - node_modules

      - type: cache-save
        key: client-node_modules-{{ checksum "client/package.json" }}
        paths:
          - client/node_modules

      - type: cache-save
        key: landing-node_modules-{{ checksum "client/landing/package.json" }}
        paths:
          - client/landing/node_modules

      - type: shell
        name: coffeelint
        command: $(npm bin)/coffeelint --quiet .

      - type: shell
        name: configure
        command: ./configure --host localhost:8090 --hostname localhost

      - type: shell
        name: check remote API consistency
        command: ./run exec scripts/api-generator.coffee --check

      - type: shell
        name: check client code quality
        command: scripts/check_client_code_quality.sh

      - type: cache-restore
        keys:
          - client-happypack-{{ .Branch }}-{{ .Revision }}
          - client-happypack-{{ .Branch }}
          - client-happypack-master

      - type: shell
        name: build client
        command: make -C client dist

      - type: cache-save
        key: client-happypack-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
        paths:
          - client/.happypack
      - type: cache-save
        key: client-happypack-{{ .Branch }}-{{ epoch }}
        paths:
          - client/.happypack

      - type: cache-restore
        keys:
          - go-{{ .Branch }}-{{ .Revision }}
          - go-{{ .Branch }}
          - go-master

      - type: shell
        name: go build
        command: go/build.sh

      - type: cache-save
        key: go-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
        paths:
          - go/bin
          - go/pkg
      - type: cache-save
        key: go-{{ .Branch }}-{{ epoch }}
        paths:
          - go/bin
          - go/pkg

      - type: shell
        name: check kite configuration
        command: ./run exec scripts/gotests.sh kites koding/kites/config

      - type: shell
        name: check generated JSON files
        command: ./run exec scripts/check-generated-files.sh

      - type: shell
        name: test kites
        command: ./run exec go/src/koding/kites/e2etest/e2etest.sh

      - type: shell
        name: test klient
        command: ./run exec scripts/test-klient.sh

      - type: shell
        name: test kd
        command: ./run exec scripts/test-kd.sh

      - type: shell
        name: test kontrol
        command: ./run exec scripts/gotests.sh koding/kites/kontrol/kontrol

      - type: shell
        name: test kloud
        command: ./run exec scripts/gotests.sh kites \
          koding/kites/kloud/provider/... koding/kites/kloud/credential/... \
          koding/kites/kloud/stack/... koding/kites/kloud/kloud/...

      - type: shell
        name: test mongo models
        command: ./run exec go test koding/db/mongodb/modelhelper

      - type: shell
        name: run database migration
        command: ./run migrations up

      - type: shell
        name: set up dnsmasq
        command: |
          service dnsmasq start
          echo nameserver 127.0.0.1 > /etc/resolv.conf

      - type: shell
        name: run
        command: |
          ./run exec supervisord -c supervisord.conf
          nginx -c $(pwd)/nginx.conf
          ./run health-check 30 600<commit_msg>Set hostname to dev.koding.com in Circle CI build stage<commit_after>version: 2

executorType: docker

containerInfo:
  - image: koding/base@sha256:55cf1b683bde71eac3a162775d8adad1e6061832cb55fe8b39866ea98c3df74a

  - image: mongo:2.6
    cmd: ["--nojournal", "--noprealloc", "--smallfiles"]

  - image: koding/postgres

  - image: rabbitmq:3

  - image: redis

stages:

  build:
    workDir: ~/koding
    steps:

      - type: checkout

      - type: cache-restore
        keys:
          - node_modules-{{ checksum "package.json" }}
      - type: cache-restore
        keys:
          - client-node_modules-{{ checksum "client/package.json" }}
      - type: cache-restore
        keys:
          - landing-node_modules-{{ checksum "client/landing/package.json" }}

      - type: shell
        name: npm install
        command: npm install --unsafe-perm

      - type: cache-save
        key: node_modules-{{ checksum "package.json" }}
        paths:
          - node_modules

      - type: cache-save
        key: client-node_modules-{{ checksum "client/package.json" }}
        paths:
          - client/node_modules

      - type: cache-save
        key: landing-node_modules-{{ checksum "client/landing/package.json" }}
        paths:
          - client/landing/node_modules

      - type: shell
        name: coffeelint
        command: $(npm bin)/coffeelint --quiet .

      - type: shell
        name: configure
        command: ./configure --host dev.koding.com:8090 --hostname dev.koding.com

      - type: shell
        name: check remote API consistency
        command: ./run exec scripts/api-generator.coffee --check

      - type: shell
        name: check client code quality
        command: scripts/check_client_code_quality.sh

      - type: cache-restore
        keys:
          - client-happypack-{{ .Branch }}-{{ .Revision }}
          - client-happypack-{{ .Branch }}
          - client-happypack-master

      - type: shell
        name: build client
        command: make -C client dist

      - type: cache-save
        key: client-happypack-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
        paths:
          - client/.happypack
      - type: cache-save
        key: client-happypack-{{ .Branch }}-{{ epoch }}
        paths:
          - client/.happypack

      - type: cache-restore
        keys:
          - go-{{ .Branch }}-{{ .Revision }}
          - go-{{ .Branch }}
          - go-master

      - type: shell
        name: go build
        command: go/build.sh

      - type: cache-save
        key: go-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
        paths:
          - go/bin
          - go/pkg
      - type: cache-save
        key: go-{{ .Branch }}-{{ epoch }}
        paths:
          - go/bin
          - go/pkg

      - type: shell
        name: check kite configuration
        command: ./run exec scripts/gotests.sh kites koding/kites/config

      - type: shell
        name: check generated JSON files
        command: ./run exec scripts/check-generated-files.sh

      - type: shell
        name: test kites
        command: ./run exec go/src/koding/kites/e2etest/e2etest.sh

      - type: shell
        name: test klient
        command: ./run exec scripts/test-klient.sh

      - type: shell
        name: test kd
        command: ./run exec scripts/test-kd.sh

      - type: shell
        name: test kontrol
        command: ./run exec scripts/gotests.sh koding/kites/kontrol/kontrol

      - type: shell
        name: test kloud
        command: ./run exec scripts/gotests.sh kites \
          koding/kites/kloud/provider/... koding/kites/kloud/credential/... \
          koding/kites/kloud/stack/... koding/kites/kloud/kloud/...

      - type: shell
        name: test mongo models
        command: ./run exec go test koding/db/mongodb/modelhelper

      - type: shell
        name: run database migration
        command: ./run migrations up

      - type: shell
        name: run
        command: |
          ./run exec supervisord -c supervisord.conf
          nginx -c $(pwd)/nginx.conf
          ./run health-check 30 600
{'fraction_non_alphanumeric': 0.11797480620155039, 'fraction_numerical': 0.014050387596899225, 'mean_word_length': 1.6346522016592215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4568477', 'n_tokens_mistral': 2656, 'n_tokens_neox': 2496, 'n_words': 621}