<commit_before>stages:
- frontend-check
- backend27-safety
- backend27-style
- backend27-tests
- backend36-tests
- master-deploy
- master-test-e2e
- production-deploy

deploy_production:
  stage: production-deploy
  environment:
    name: production
    url: http://mistic2.leloir.org.ar:5001
  variables:
    GIT_STRATEGY: none
  script:
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - echo $SSHPASS > sshkey.txt
  - mkdir -p ~/.ssh
  - sshpass -f sshkey.txt $SSH_PROD_TUNNEL "nohup /home/mistic/stage/mistic/deploy_production.sh &"
  only:
  - production
  tags:
  - production

deploy_master:
  stage: master-deploy
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - pip-cache/
    - node_modules/
    - .cache/
  environment:
    name: staging
    url: https://pfamserver.herokuapp.comn
  variables:
    PIP_CACHE_DIR: "pip-cache"
    NODE_TLS_REJECT_UNAUTHORIZED: 0
  before_script:
    - export SQLALCHEMY_DATABASE_URI=$HEROKU_STAGE_SQLALCHEMY_DATABASE_URI
  script:
  - git remote set-url heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/pfamserver.git
  - git fetch origin master:master
  - git checkout master
  - rm -f .git/hooks/pre-push
  - git push -q heroku master
  - mkdir ~/.pip
  - echo '{"assets":{},"publicPath":""}' > mistic/static/manifest.json
  - echo "[global]\nindex-url = http://192.168.101.105:3141/root/pypi/+simple/\ntrusted-host = 192.168.101.105" > ~/.pip/pip.conf
  - pip install -r requirements_development.txt
  - git push -f heroku master
  - flask db upgrade
  - flask data algorithms load
  only:
  - master
  tags:
  - master

protractor_test:
  stage: master-test-e2e
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - pip-cache/
    - node_modules/
    - .cache/
  environment:
    name: staging
    url: https://pfamserver.herokuapp.com
  variables:
    PIP_CACHE_DIR: "pip-cache"
    NODE_TLS_REJECT_UNAUTHORIZED: 0
  script:
  - npm --proxy http://192.168.101.105:8080 --https-proxy http://192.168.101.105:8080 --strict-ssl false install v8-profiler@5.7.0
  - npm --proxy http://192.168.101.105:8080 --https-proxy http://192.168.101.105:8080 --strict-ssl false install .
  - ./node_modules/protractor/bin/webdriver-manager update && xvfb-run -a npm run test-e2e --headless"
  allow_failure: true
  only:
  - master
  tags:
  - master

services:
  - mysql:8.0.12

frontend:
  stage: frontend-check
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - node_modules/
  environment:
    name: review/$CI_COMMIT_REF_NAME
  script:
  - npm --proxy http://192.168.101.105:8080 --https-proxy http://192.168.101.105:8080 --strict-ssl false install v8-profiler@5.7.0
  - npm --proxy http://192.168.101.105:8080 --https-proxy http://192.168.101.105:8080 --strict-ssl false install .
  - npm run lint
  - npm run build
  except:
  - production
  - master
  tags:
  - integration

backend27_safety:
  stage: backend27-safety
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - pip-cache/
  environment:
    name: review/$CI_COMMIT_REF_NAME
  variables:
    PIP_CACHE_DIR: "pip-cache"
  script:
  - mkdir ~/.pip
  - echo "[global]\nindex-url = http://192.168.101.105:3141/root/pypi/+simple/\ntrusted-host = 192.168.101.105" > ~/.pip/pip.conf
  - pip install -r requirements_development.txt<commit_msg>Remove profiler installation.<commit_after>stages:
- frontend-check
- backend27-safety
- backend27-style
- backend27-tests
- backend36-tests
- master-deploy
- master-test-e2e
- production-deploy

deploy_production:
  stage: production-deploy
  environment:
    name: production
    url: http://mistic2.leloir.org.ar:5001
  variables:
    GIT_STRATEGY: none
  script:
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - echo $SSHPASS > sshkey.txt
  - mkdir -p ~/.ssh
  - sshpass -f sshkey.txt $SSH_PROD_TUNNEL "nohup /home/mistic/stage/mistic/deploy_production.sh &"
  only:
  - production
  tags:
  - production

deploy_master:
  stage: master-deploy
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - pip-cache/
    - node_modules/
    - .cache/
  environment:
    name: staging
    url: https://pfamserver.herokuapp.comn
  variables:
    PIP_CACHE_DIR: "pip-cache"
    NODE_TLS_REJECT_UNAUTHORIZED: 0
  before_script:
    - export SQLALCHEMY_DATABASE_URI=$HEROKU_STAGE_SQLALCHEMY_DATABASE_URI
  script:
  - git remote set-url heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/pfamserver.git
  - git fetch origin master:master
  - git checkout master
  - rm -f .git/hooks/pre-push
  - git push -q heroku master
  - mkdir ~/.pip
  - echo '{"assets":{},"publicPath":""}' > mistic/static/manifest.json
  - echo "[global]\nindex-url = http://192.168.101.105:3141/root/pypi/+simple/\ntrusted-host = 192.168.101.105" > ~/.pip/pip.conf
  - pip install -r requirements_development.txt
  - git push -f heroku master
  - flask db upgrade
  - flask data algorithms load
  only:
  - master
  tags:
  - master

protractor_test:
  stage: master-test-e2e
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - pip-cache/
    - node_modules/
    - .cache/
  environment:
    name: staging
    url: https://pfamserver.herokuapp.com
  variables:
    PIP_CACHE_DIR: "pip-cache"
    NODE_TLS_REJECT_UNAUTHORIZED: 0
  script:
  - npm --proxy http://192.168.101.105:8080 --https-proxy http://192.168.101.105:8080 --strict-ssl false install .
  - ./node_modules/protractor/bin/webdriver-manager update && xvfb-run -a npm run test-e2e --headless"
  allow_failure: true
  only:
  - master
  tags:
  - master

services:
  - mysql:8.0.12

frontend:
  stage: frontend-check
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - node_modules/
  environment:
    name: review/$CI_COMMIT_REF_NAME
  script:
  - npm --proxy http://192.168.101.105:8080 --https-proxy http://192.168.101.105:8080 --strict-ssl false install .
  - npm run lint
  - npm run build
  except:
  - production
  - master
  tags:
  - integration

backend27_safety:
  stage: backend27-safety
  image: ecolell/mistic-flask-test-server:python2.7.14
  cache:
    paths:
    - pip-cache/
  environment:
    name: review/$CI_COMMIT_REF_NAME
  variables:
    PIP_CACHE_DIR: "pip-cache"
  script:
  - mkdir ~/.pip
  - echo "[global]\nindex-url = http://192.168.101.105:3141/root/pypi/+simple/\ntrusted-host = 192.168.101.105" > ~/.pip/pip.conf
  - pip install -r requirements_development.txt
{'fraction_non_alphanumeric': 0.13434903047091412, 'fraction_numerical': 0.060941828254847646, 'mean_word_length': 2.91978287092883, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 22, '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': '1917369', 'n_tokens_mistral': 2782, 'n_tokens_neox': 2451, 'n_words': 457}