<commit_before>box: canopytax/python-base
build:
  services:
    - postgres

  steps:
    - script:
      name: pip install
      code: |
        mv "$WERCKER_CACHE_DIR/pip" /root/.local || echo "Nothing in cache"
        pip3 install -r requirements.txt --user -U
        cp -a /root/.local "$WERCKER_CACHE_DIR/pip" || "nothing to copy"

    - script:
      name: build UI
      code: |
        apk --no-cache add nodejs
        cd /app/tmeister/static
        npm run build
        apk del nodejs
        cd /app

    - script:
      name: lint
      code: |
        invoke lint

    - script:
      name: run tests
      code: |
        invoke test -x

    - script:
      name: clean and copy files
      code: |
        invoke clean
        mv /root/.local .pip

dockerhub:
  steps:
    - script:
      name: get tags
      code: |
        if [ $WERCKER_GIT_BRANCH == 'master' ]; then export DOCKER_BRANCH=latest; else export DOCKER_BRANCH="$(basename $WERCKER_GIT_BRANCH)"; fi;
        echo $DOCKER_BRANCH

    - script:
      name: prepare for dockerhub
      code: |
        # put pip files back in place
        mv .pip /root/.local

        # clean unneeded files
        rm -rf .git/
        rm .gitignore
        rm wercker.yml
        rm readme.md
        rm requirements.txt
        rm .pylintrc
        rm .coverage
        rm Dockerfile
        rm docker-compose.yml
        rm -rf tests/
        rm -rf tmeister/static/node_modules
        rm -rf tmeister/static/spec
        rm -rf tmeister/static/src
        rm -rf tmeister/static/bin

        # move files
        cp -a . /app

        # clean wercker files
        cd /app
        rm -rf /pipeline/

        # recreate output dir
        mkdir -p "$WERCKER_OUTPUT_DIR"
        #mkdir -p "$WERCKER_ROOT"
        touch "$WERCKER_OUTPUT_DIR/touch"

    - internal/docker-push:
        repository: $REPO
        tag: $WERCKER_GIT_COMMIT $DOCKER_BRANCH
        ports: "9191"
        username: $DOCKER_USERNAME
        password: <PASSWORD>
        cmd: 'dumb-init ./startup.sh'

deploy:
  box:
    id: canopytax/deployment
    username: $DOCKER_USERNAME
    password: <PASSWORD>
    tag: latest
  steps:
    - script:
      name: run migration
      code: |
        echo "placeholder"
    - script:
      name: deploy to rancher
      code: |
        /scripts/deploy-to-rancher.py --docker-tag "$WERCKER_GIT_COMMIT"


<commit_msg>fix wercker file<commit_after>box: canopytax/python-base
build:
  services:
    - postgres

  steps:
    - script:
      name: pip install
      code: |
        mv "$WERCKER_CACHE_DIR/pip" /root/.local || echo "Nothing in cache"
        pip3 install -r requirements.txt --user -U
        cp -a /root/.local "$WERCKER_CACHE_DIR/pip" || "nothing to copy"

    - script:
      name: build UI
      code: |
        apk --no-cache add nodejs
        cd tmeister/static
        npm run build
        apk del nodejs
        cd /app

    - script:
      name: lint
      code: |
        invoke lint

    - script:
      name: run tests
      code: |
        invoke test -x

    - script:
      name: clean and copy files
      code: |
        invoke clean
        mv /root/.local .pip

dockerhub:
  steps:
    - script:
      name: get tags
      code: |
        if [ $WERCKER_GIT_BRANCH == 'master' ]; then export DOCKER_BRANCH=latest; else export DOCKER_BRANCH="$(basename $WERCKER_GIT_BRANCH)"; fi;
        echo $DOCKER_BRANCH

    - script:
      name: prepare for dockerhub
      code: |
        # put pip files back in place
        mv .pip /root/.local

        # clean unneeded files
        rm -rf .git/
        rm .gitignore
        rm wercker.yml
        rm readme.md
        rm requirements.txt
        rm .pylintrc
        rm .coverage
        rm Dockerfile
        rm docker-compose.yml
        rm -rf tests/
        rm -rf tmeister/static/node_modules
        rm -rf tmeister/static/spec
        rm -rf tmeister/static/src
        rm -rf tmeister/static/bin

        # move files
        cp -a . /app

        # clean wercker files
        cd /app
        rm -rf /pipeline/

        # recreate output dir
        mkdir -p "$WERCKER_OUTPUT_DIR"
        #mkdir -p "$WERCKER_ROOT"
        touch "$WERCKER_OUTPUT_DIR/touch"

    - internal/docker-push:
        repository: $REPO
        tag: $WERCKER_GIT_COMMIT $DOCKER_BRANCH
        ports: "9191"
        username: $DOCKER_USERNAME
        password: <PASSWORD>
        cmd: 'dumb-init ./startup.sh'

deploy:
  box:
    id: canopytax/deployment
    username: $DOCKER_USERNAME
    password: <PASSWORD>
    tag: latest
  steps:
    - script:
      name: run migration
      code: |
        echo "placeholder"
    - script:
      name: deploy to rancher
      code: |
        /scripts/deploy-to-rancher.py --docker-tag "$WERCKER_GIT_COMMIT"



{'fraction_non_alphanumeric': 0.09102296450939457, 'fraction_numerical': 0.0020876826722338203, 'mean_word_length': 1.6166029492080831, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '2297712', 'n_tokens_mistral': 1631, 'n_tokens_neox': 1565, 'n_words': 430}