<commit_before>sudo: required
dist: xenial
cache:
  timeout: 1000
  directories:
    - $HOME/.cache/pip
    - $HOME/miniconda
addons:
  hosts:
    - iemdb2.local
    - iemdb-hads.local
    - iemdb-iemre.local
    - iemdb-mos.local
    - iem.local
    - iem-memcached
    - iemdb-talltowers.local
    - iem-web-services.local
    - iemdb-postgis.local
    - iemdb-mesosite.local
    - iemdb-afos.local
    - iemdb-asos.local
    - iemdb-snet.local
    - iemdb-mos.local
    - iemdb-rwis.local
    - iemdb-squaw.local
    - iemdb-awos.local
    - iemdb-iem.local
    - iemdb-other.local
    - iemdb-scan.local
    - iemdb-wepp.local
    - iemdb-coop.local
    - iemdb-isuag.local
    - iemdb-portfolio.local
    - iemdb-smos.local
language: python
env:
  global:
    # Prevent extraneous log messages
    - DEBIAN_FRONTEND=noninteractive
  matrix:
    - PYTHON_VERSION=3.6
    - PYTHON_VERSION=3.7
    - PYTHON_VERSION=3.8
before_install:
  - git clone --depth 1 https://github.com/akrherz/ci_tooling.git .ci_tooling
  - . .ci_tooling/postgres.sh
  - sudo mkdir -p /mesonet/www/logs
  - sudo ln -s `pwd` /opt/iem
  - sudo ln -s $HOME/miniconda /opt/miniconda3
  - echo `pwd`
  - chmod 755 $HOME
  - sudo apt-get install librrd-dev
  # need apache2-dev for mod-wsgi to build
  - sudo apt-get install apache2 apache2-dev memcached
  - sudo service memcached start
  - sudo a2enmod headers rewrite proxy cgi expires authz_groupfile
  # we do things the old fashioned way, we earn it
  - sudo a2dissite 000-default.conf
  - sudo cp deployment/apache_configs/mod_wsgi.conf /etc/apache2/sites-enabled/
  - echo '<VirtualHost *:80>' | sudo tee /etc/apache2/sites-enabled/iem.conf > /dev/null
  - cat config/mesonet.inc | sudo tee -a /etc/apache2/sites-enabled/iem.conf > /dev/null
  - echo '</VirtualHost>' | sudo tee -a /etc/apache2/sites-enabled/iem.conf > /dev/null
  # Setup PATH so that miniconda gets in the front
  - echo "export PATH=/home/travis/miniconda/envs/prod/bin:$PATH" | sudo tee -a /etc/apache2/envvars > /dev/null
  - echo "export LD_PRELOAD=/home/travis/miniconda/envs/prod/lib/libz.so" | sudo tee -a /etc/apache2/envvars > /dev/null
install:
  - . .ci_tooling/miniconda.sh

before_script:
  # https://travis-ci.community/t/t/712/12
  - export PATH="/usr/lib/postgresql/11/bin:$PATH"
  - psql -c 'CREATE ROLE travis SUPERUSER LOGIN CREATEDB;' -U postgres || true
  - cd database; sh bootstrap.sh
  - python schema_manager.py
  - cd ..
script:
  - MOD_WSGI_SO=$(find $HOME/miniconda/envs/prod -type f -name 'mod_wsgi*.so')
  - echo $MOD_WSGI_SO
  - echo "LoadModule wsgi_module $MOD_WSGI_SO" | sudo tee -a /etc/apache2/mods-enabled/wsgi.load > /dev/null;
  - echo "WSGIApplicationGroup %{GLOBAL}" | sudo tee -a /etc/apache2/mods-enabled/wsgi.load > /dev/null;
  # restart apache
  - sudo service apache2 stop
  - sudo service apache2 start
  - sudo cat /var/log/apache2/error.log
  - sudo systemctl status apache2.service -l
  - ls -l /opt/iem/deployment/mod_wsgi_startup.py
  # Run autoplot tests with basically no data in database
  - python test/run_autoplots.py
  - sudo cat /var/log/apache2/error.log<commit_msg>finetune Travis-CI config to see about staleouts<commit_after>sudo: required
dist: xenial
cache:
  timeout: 1000
  directories:
    - $HOME/.cache/pip
    - $HOME/miniconda
addons:
  hosts:
    - iemdb2.local
    - iemdb-hads.local
    - iemdb-iemre.local
    - iemdb-mos.local
    - iem.local
    - iem-memcached
    - iemdb-talltowers.local
    - iem-web-services.local
    - iemdb-postgis.local
    - iemdb-mesosite.local
    - iemdb-afos.local
    - iemdb-asos.local
    - iemdb-snet.local
    - iemdb-mos.local
    - iemdb-rwis.local
    - iemdb-squaw.local
    - iemdb-awos.local
    - iemdb-iem.local
    - iemdb-other.local
    - iemdb-scan.local
    - iemdb-wepp.local
    - iemdb-coop.local
    - iemdb-isuag.local
    - iemdb-portfolio.local
    - iemdb-smos.local
language: python
env:
  global:
    # Prevent extraneous log messages
    - DEBIAN_FRONTEND=noninteractive
  matrix:
    - PYTHON_VERSION=3.6
    - PYTHON_VERSION=3.7
    - PYTHON_VERSION=3.8
before_install:
  - git clone --depth 1 https://github.com/akrherz/ci_tooling.git .ci_tooling
  - . .ci_tooling/postgres.sh
  - sudo mkdir -p /mesonet/www/logs
  - sudo ln -s `pwd` /opt/iem
  - sudo ln -s $HOME/miniconda /opt/miniconda3
  - echo `pwd`
  - chmod 755 $HOME
  - sudo apt-get install librrd-dev
  # need apache2-dev for mod-wsgi to build
  - sudo apt-get install apache2 apache2-dev memcached
  - sudo service memcached start
  - sudo a2enmod headers rewrite proxy cgi expires authz_groupfile
  # we do things the old fashioned way, we earn it
  - sudo a2dissite 000-default.conf
  # reduce resource usage of mod-wsgi processes
  - sed -i -E "s/ processes=([0-9]+) / processes=4 /" deployment/apache_configs/mod_wsgi.conf
  - sudo cp deployment/apache_configs/mod_wsgi.conf /etc/apache2/sites-enabled/
  - echo '<VirtualHost *:80>' | sudo tee /etc/apache2/sites-enabled/iem.conf > /dev/null
  - cat config/mesonet.inc | sudo tee -a /etc/apache2/sites-enabled/iem.conf > /dev/null
  - echo '</VirtualHost>' | sudo tee -a /etc/apache2/sites-enabled/iem.conf > /dev/null
install:
  - . .ci_tooling/miniconda.sh

before_script:
  # https://travis-ci.community/t/t/712/12
  - export PATH="/usr/lib/postgresql/11/bin:$PATH"
  - psql -c 'CREATE ROLE travis SUPERUSER LOGIN CREATEDB;' -U postgres || true
  - cd database; sh bootstrap.sh
  - python schema_manager.py
  - cd ..
script:
  - MOD_WSGI_SO=$(find $HOME/miniconda/envs/prod -type f -name 'mod_wsgi*.so')
  - echo $MOD_WSGI_SO
  - echo "LoadModule wsgi_module $MOD_WSGI_SO" | sudo tee -a /etc/apache2/mods-enabled/wsgi.load > /dev/null;
  - echo "WSGIApplicationGroup %{GLOBAL}" | sudo tee -a /etc/apache2/mods-enabled/wsgi.load > /dev/null;
  # restart apache
  - sudo service apache2 stop
  - sudo service apache2 start
  - sudo cat /var/log/apache2/error.log
  - sudo systemctl status apache2.service -l
  # Run autoplot tests with basically no data in database
  - python test/run_autoplots.py
  - sudo cat /var/log/apache2/error.log
{'fraction_non_alphanumeric': 0.1220472440944882, 'fraction_numerical': 0.015255905511811024, 'mean_word_length': 2.683987915407855, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '3245559', 'n_tokens_mistral': 2515, 'n_tokens_neox': 2344, 'n_words': 496}