<commit_before>workspace:
  base: /srv/app
clone:
  git:
    image: plugins/git:1
    depth: 1
    tags: false

pipeline:
###############################################################################
# All Branches
# Push || Pull request -> Test -> Notify || Shame
  Test:
      image: webhippie/nodejs:latest
      pull: true
      commands:
          - npm install
          - npm test
      when:
          event: pull_request

  Test:
      image: webhippie/nodejs:latest
      pull: true
      commands:
          - npm install
          - npm test
      when:
          event: push
          branch: development

  Notify:
      image: appleboy/drone-discord
      pull: true
      secrets: [ discord_webhook_id, discord_webhook_token ]
      message: >
       5etools test of {{ build.number }} to {{ build.branch }} by
       {{ build.author }} finished with {{ build.status }}.
       ({{ build.link }})
      when:
        status: success
        event: [ push, pull_request ]

  Shame:
    image: appleboy/drone-ssh
    pull: true
    host: ianthe.rem.uz
    port: 22
    user: root
    secrets: [ ssh_key ]
    script:
      - python /scripts/shame.py
    when:
       status: failure
       event: [ push, pull_request ]

###############################################################################
# Master Branch
# ... -> Merge -> Version Check -> Deploy
  Version:
    image: appleboy/drone-ssh
    pull: true
    host: ianthe.rem.uz
    port: 22
    user: root
    secrets: [ ssh_key ]
    script:
      - cd /scripts/ && python /scripts/chk-version.py
    when:
      branch: master
      event: push

  Deploy-prod:
    image: appleboy/drone-ssh
    pull: true
    host: ianthe.rem.uz
    port: 22
    user: root
    secrets: [ ssh_key ]
    command_timeout: 300
    script:
      - bash /scripts/prod-deploy.sh
    when:
      branch: master
      event: push

###############################################################################
# Development Branch
# ... -> Deploy
  Deploy-dev:
    image: appleboy/drone-ssh
    pull: true
    host: ianthe.rem.uz
    port: 22
    user: root
    secrets: [ ssh_key ]
    command_timeout: 300
    script:
      - bash /scripts/dev-deploy.sh
    when:
      branch: development
      event: push

###############################################################################
# All Branches
# ... -> Notify
  Notify:
      image: appleboy/drone-discord
      pull: true
      secrets: [ discord_webhook_id, discord_webhook_token ]
      message: >
       5etools deployment of {{ build.number }} from {{ build.branch }} by
       {{ build.author }} finished with {{ build.status }}.
       ({{ build.link }})
      when:
        status:  [ failure, success ]
        event: push<commit_msg>ci: reduce duplication in drone config<commit_after>buildstep-ssh: &buildstep-ssh
  image: appleboy/drone-ssh
  pull: true
  host: ianthe.rem.uz
  port: 22
  user: root
  secrets: [ ssh_key ]

buildstep-discord: &buildstep-discord
  image: appleboy/drone-discord
  pull: true
  secrets: [ discord_webhook_id, discord_webhook_token ]

buildstep-node: &buildstep-node
  image: webhippie/nodejs:latest
  pull: true


workspace:
  base: /srv/app
clone:
  git:
    image: plugins/git:1
    depth: 1
    tags: false

pipeline:
###############################################################################
# All Branches
# Push || Pull request -> Test -> Notify || Shame
  Test:
      <<: *buildstep-node
      commands:
          - npm install
          - npm test
      when:
          event: pull_request

  Test:
      <<: *buildstep-node
      commands:
          - npm install
          - npm test
      when:
          event: push
          branch: development

  Notify:
      <<: *buildstep-discord
      message: >
       5etools test of {{ build.number }} to {{ build.branch }} by
       {{ build.author }} finished with {{ build.status }}.
       ({{ build.link }})
      when:
        status: success
        event: [ push, pull_request ]

  Shame:
    <<: *buildstep-ssh
    script:
      - python /scripts/shame.py
    when:
       status: failure
       event: [ push, pull_request ]

###############################################################################
# Master Branch
# ... -> Merge -> Version Check -> Deploy
  Version:
    <<: *buildstep-ssh
    script:
      - cd /scripts/ && python /scripts/chk-version.py
    when:
      branch: master
      event: push

  Deploy-prod:
    <<: *buildstep-ssh
    command_timeout: 300
    script:
      - bash /scripts/prod-deploy.sh
    when:
      branch: master
      event: push

###############################################################################
# Development Branch
# ... -> Deploy
  Deploy-dev:
    <<: *buildstep-ssh
    command_timeout: 300
    script:
      - bash /scripts/dev-deploy.sh
    when:
      branch: development
      event: push

###############################################################################
# All Branches
# ... -> Notify
  Notify:
      <<: *buildstep-discord
      message: >
       5etools deployment of {{ build.number }} from {{ build.branch }} by
       {{ build.author }} finished with {{ build.status }}.
       ({{ build.link }})
      when:
        status:  [ failure, success ]
        event: push
{'fraction_non_alphanumeric': 0.21846037450349914, 'fraction_numerical': 0.005674295441649328, 'mean_word_length': 2.3008739076154807, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6553849', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1530, 'n_words': 381}