<commit_before>language: java
sudo: false
install: true

if: branch IN (develop, snapshots, releases)

env:
  global:
    secure: DsqkVoW3qoxmaTA/XZQKLRezTe/iCNnxsjqvYRWsmsnqhj8rMsAsbXCh/lnch2pCcQEoJ7hI8O0RjSeaiJEWLPx1nEHAVEuDsh4pOw2orklvtr9eVat2kaUqKz6OZ99TbWvILFewPO6KhWbkVN8f72/oXLOb9ouDg6SgpM1TnMq9cbMkkqY5JUupiEZpnzTr44E9BfdUTjsLJA/0njm8ngfMxd3Pn8YaDCXJSkZhrO8GMvWMDUsmSwugrLsfEZJe9t32fK/M9LPdsI2sLMJleMjbI9IqlFS9rXmeuB9LQ0DhIisubU129R41okr/vEUPeotNWWo4HRCSnSg0LwwtW7tIXZawCCZa3iYkwCQ5Qdgtnr/8bD8O8wjQOzRayzs5+U2m6z6QWZl80w6d/BqhGMr+4yeaCJ5Y1jG15+6Xrmt5q6h0OVjFGEWF6UIPh79PYvL8t79jT5XYYYhhVNjdlHVc115OXHqVEpHv3ZMg/TtrNPIZIqf6sB0ItvJQlosy2IgfiFcdSN6H3NUz2h8SaIEXxIi3uMVGHEUSHjX/SI+HQbRL30a+EtpOtKinbPMpOzW7gw5S0FSWMaw9EMhutBt64R2ccTaio1PcXbZ3N4IcRPQtSc6fZ8ndfALYNx8hRxcBp6WTA7LZ/xqDmClr/QtaeCr6qN57aa7JOCn8lLE=

jdk:
  - oraclejdk8

addons:
  sonarcloud: true

stages:
  - build
  - name: artifacts
    if: type = push


jobs:
  include:
    - stage: build
      name: "Build library"
      script: ./gradlew clean build 
      name: "Unit tests"
      script: ./gradlew tests
      name: "Code quality checks"
      script: ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN
    - stage: artifacts
      name: "Publish artifacts to GitHub repository"
      before_script:
        - echo $deploy_rsa_password | gpg --passphrase-fd 0 deploy_rsa.gpg
        - eval "$(ssh-agent)"
        - chmod 600 ./deploy_rsa
        - ssh-add ./deploy_rsa
      script: ./gradlew uploadArchives -DpublishUsername=SpinyOwlCI -DpublishPassword=$<PASSWORD> -DpublishUrl=git:$TRAVIS_BRANCH://git@github.com:SpinyOwl/repo.git
  
cache:
  directories:
    - '$HOME/.m2/repository'
    - '$HOME/.sonar/cache'
    - '$HOME/.gradle'
    - '.gradle'

after_success:<commit_msg>Updated travis yaml to work wll with pull requests<commit_after>language: java
sudo: false
install: true

if: branch IN (develop, snapshots, releases)

env:
  global:
    secure: <KEY>

jdk:
  - oraclejdk8

addons:
  sonarcloud: true

stages:
  - name: build_develop
    if: type = push
  - name: build_pull_request
    if: type = pull_request AND branch = develop


jobs:
  include:
    - stage: build_and_publish_artifacts
      name: "Build library"
      script: ./gradlew clean build
      name: "Unit tests"
      script: ./gradlew tests
      name: "Code quality checks"
      script: ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN
      name: "Publish artifacts to GitHub repository"
      before_script:
        - echo $deploy_rsa_password | gpg --passphrase-fd 0 deploy_rsa.gpg
        - eval "$(ssh-agent)"
        - chmod 600 ./deploy_rsa
        - ssh-add ./deploy_rsa
      script: ./gradlew uploadArchives -DpublishUsername=SpinyOwlCI -DpublishPassword=$<PASSWORD> -DpublishUrl=git:$TRAVIS_BRANCH://git@github.com:SpinyOwl/repo.git
    - stage: build_pull_request
      name: "Build library"
      script: ./gradlew clean build
      name: "Unit tests"
      script: ./gradlew tests
      name: "Code quality checks"
      script: ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN -Dsonar.pullrequest.base=$TRAVIS_BRANCH -Dsonar.pullrequest.branch=$TRAVIS_PULL_REQUEST_BRANCH -Dsonar.pullrequest.key=$TRAVIS_PULL_REQUEST -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=SpinyOwl/legui
cache:
  directories:
    - '$HOME/.m2/repository'
    - '$HOME/.sonar/cache'
    - '$HOME/.gradle'
    - '.gradle'

after_success:
{'fraction_non_alphanumeric': 0.09512624779800352, 'fraction_numerical': 0.0358191426893717, 'mean_word_length': 3.7985915492957747, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4569338', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1426, 'n_words': 216}