<commit_before>---
## from https://github.com/geerlingguy/ansible-role-apache/blob/master/.travis.yml
sudo: required

env:
  - distribution: ubuntu
    version: 18.04
    init: /lib/systemd/systemd
    run_opts: "'--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'"
    suite: default
  - distribution: ubuntu
    version: 16.04
    init: /lib/systemd/systemd
    run_opts: "'--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'"
    suite: default
#  - distribution: ubuntu
#    version: 14.04
#    init: /sbin/init
#    run_opts: ""
  - distribution: ubuntu
    version: 18.04
    init: /lib/systemd/systemd
    run_opts: "'--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'"
    suite: default-HEAD

services:
  - docker

before_install:
  # - sudo apt-get update
  # Pull container
  - 'sudo docker pull ${distribution}:${version}'
  - env
  - pwd
  - find -ls
  - "[ -f get-dependencies.sh ] && sh -x get-dependencies.sh"
  - cp test/travis/initctl_faker test/
  # Customize container
  - 'sudo docker build --rm=true --file=test/travis/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible test'

script:
  - container_id=$(mktemp)
    # Run container in detached state
  - 'sudo docker run --detach --volume="${PWD%/*}":/etc/ansible/roles:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'

  - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible --version'

  # Ansible syntax check.
  - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml --syntax-check'

  # Test role.
  - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm TRAVIS=true ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml -vvvv'
#  - 'travis_wait 30 sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml'

  # Test role idempotence.
## known fail + disable (too long for travis, else)
#  - >
#    sudo docker exec "$(cat ${container_id})" env TERM=xterm TRAVIS=true ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml
#    | tee /tmp/idempotency.log
#    | grep -q 'changed=0.*failed=0'
#    && (echo 'Idempotence test: pass' && exit 0)
#    || (echo 'Idempotence test: fail' && cat /tmp/idempotency.log && exit 0)

  # serverspec tests
## travis/docker: Errno::EROFS: Read-only file system @ dir_s_mkdir - /etc/ansible/roles/juju4.sift/test/integration/${suite}/serverspec/.bundle
#  - 'sudo docker exec --tty "$(cat ${container_id})" /etc/ansible/roles/juju4.sift/test/integration/${suite}/serverspec/run-local-tests.sh'

  # Clean up
  - 'sudo docker stop "$(cat ${container_id})"'

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/
<commit_msg>travis: add after_failure/after_script, show few packages state<commit_after>---
## from https://github.com/geerlingguy/ansible-role-apache/blob/master/.travis.yml
sudo: required

env:
  - distribution: ubuntu
    version: 18.04
    init: /lib/systemd/systemd
    run_opts: "'--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'"
    suite: default
  - distribution: ubuntu
    version: 16.04
    init: /lib/systemd/systemd
    run_opts: "'--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'"
    suite: default
#  - distribution: ubuntu
#    version: 14.04
#    init: /sbin/init
#    run_opts: ""
  - distribution: ubuntu
    version: 18.04
    init: /lib/systemd/systemd
    run_opts: "'--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'"
    suite: default-HEAD

services:
  - docker

before_install:
  # - sudo apt-get update
  # Pull container
  - 'sudo docker pull ${distribution}:${version}'
  - env
  - pwd
  - find -ls
  - "[ -f get-dependencies.sh ] && sh -x get-dependencies.sh"
  - cp test/travis/initctl_faker test/
  # Customize container
  - 'sudo docker build --rm=true --file=test/travis/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible test'

script:
  - container_id=$(mktemp)
    # Run container in detached state
  - 'sudo docker run --detach --volume="${PWD%/*}":/etc/ansible/roles:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'

  - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible --version'

  # Ansible syntax check.
  - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml --syntax-check'

  # Test role.
  - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm TRAVIS=true ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml -vvvv'
#  - 'travis_wait 30 sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml'

  # Test role idempotence.
## known fail + disable (too long for travis, else)
#  - >
#    sudo docker exec "$(cat ${container_id})" env TERM=xterm TRAVIS=true ansible-playbook /etc/ansible/roles/juju4.sift/test/integration/${suite}/default.yml
#    | tee /tmp/idempotency.log
#    | grep -q 'changed=0.*failed=0'
#    && (echo 'Idempotence test: pass' && exit 0)
#    || (echo 'Idempotence test: fail' && cat /tmp/idempotency.log && exit 0)

  # serverspec tests
## travis/docker: Errno::EROFS: Read-only file system @ dir_s_mkdir - /etc/ansible/roles/juju4.sift/test/integration/${suite}/serverspec/.bundle
#  - 'sudo docker exec --tty "$(cat ${container_id})" /etc/ansible/roles/juju4.sift/test/integration/${suite}/serverspec/run-local-tests.sh'

after_failure:
  # Check what happened on systems.
  - 'sudo docker exec --tty "$(cat ${container_id})" tail -100 /var/log/syslog'

after_script:
  # check state of some packages between sift/gift/ubuntu
  - 'sudo docker exec --tty "$(cat ${container_id})" apt show libtsk-dev -a'
  - 'sudo docker exec --tty "$(cat ${container_id})" apt show libewf -a'
  - 'sudo docker exec --tty "$(cat ${container_id})" apt show libewf2 -a'
  # Clean up
  - 'sudo docker stop "$(cat ${container_id})"'

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/

{'fraction_non_alphanumeric': 0.17026683608640406, 'fraction_numerical': 0.009847522236340533, 'mean_word_length': 3.5796363636363635, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '5138996', 'n_tokens_mistral': 2420, 'n_tokens_neox': 2215, 'n_words': 481}