<commit_before>machine:
  services:
    - postgresql
    - docker

dependencies:
  cache_directories:
    - "~/cache/"
  override:
    - docker info
    # use circleci's docker cache workaround
    - |
      mkdir -p ~/cache/
      if [ -e ~/cache/docker/image.tar ]; then
        echo "Loading image.tar"
        docker load -i ~/cache/docker/image.tar || rm ~/cache/docker/image.tar
      fi
    # build image
    - docker build -t normandy:build .
    # pull other docker images used below
    - docker pull giorgos/takis
    # write the sha256 sum to an artifact to make image verification easier
    - docker inspect -f '{{.Config.Image}}' normandy:build | tee $CIRCLE_ARTIFACTS/docker-image-shasum256.txt
    # get MaxMind GeoIP database
    - cd ~/cache/ && ~/normandy/bin/download_geolite2.sh
    # clean up old cached Docker image and save the new one
    - |
      mkdir -p ~/cache/docker
      rm -f ~/cache/docker/image.tar
      docker save normandy:build > ~/cache/docker/image.tar
      ls -l ~/cache/docker

test:
  pre:
    - chmod -R 777 $CIRCLE_TEST_REPORTS
  override:
    # Run lint checks
    - bin/ci/docker-run.sh therapist run --use-tracked-files
    # Run Python tests
    - bin/ci/docker-run.sh py.test --junitxml=/test_artifacts/pytest.xml normandy/
    # Start Karma test server, and run them in Firefox
    - |
      (
        echo Waiting for Karma server to start
        docker run --net host -e CHECK_PORT=9876 -e CHECK_HOST=localhost giorgos/takis
        echo Starting Firefox
        firefox localhost:9876
      ) &
      bin/ci/docker-run.sh -e NODE_ENV=production -p 9876:9876 node bin/ci/karma-ci.js
    # Start the app, and run acceptance tests
    - bin/ci/contract-tests.sh

# appropriately tag and push the container to dockerhub<commit_msg>Remove ineffective Docker caching in CI<commit_after>machine:
  services:
    - postgresql
    - docker

dependencies:
  override:
    - docker info
    # build image
    - docker build -t normandy:build .
    # pull other docker images used below
    - docker pull giorgos/takis
    # write the sha256 sum to an artifact to make image verification easier
    - docker inspect -f '{{.Config.Image}}' normandy:build | tee $CIRCLE_ARTIFACTS/docker-image-shasum256.txt
    # get MaxMind GeoIP database
    - ~/normandy/bin/download_geolite2.sh

test:
  pre:
    - chmod -R 777 $CIRCLE_TEST_REPORTS
  override:
    # Run lint checks
    - bin/ci/docker-run.sh therapist run --use-tracked-files
    # Run Python tests
    - bin/ci/docker-run.sh py.test --junitxml=/test_artifacts/pytest.xml normandy/
    # Start Karma test server, and run them in Firefox
    - |
      (
        echo Waiting for Karma server to start
        docker run --net host -e CHECK_PORT=9876 -e CHECK_HOST=localhost giorgos/takis
        echo Starting Firefox
        firefox localhost:9876
      ) &
      bin/ci/docker-run.sh -e NODE_ENV=production -p 9876:9876 node bin/ci/karma-ci.js
    # Start the app, and run acceptance tests
    - bin/ci/contract-tests.sh

# appropriately tag and push the container to dockerhub
{'fraction_non_alphanumeric': 0.09259259259259259, 'fraction_numerical': 0.016894087069525665, 'mean_word_length': 2.4440715883668904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2033143', 'n_tokens_mistral': 1081, 'n_tokens_neox': 975, 'n_words': 296}