<commit_before>workspace:
  base: /go
  path: src/code.gitea.io/gitea

clone:
  git:
    image: plugins/git:next
    depth: 50
    tags: true

pipeline:
  download_translations:
    image: jonasfranz/crowdin
    pull: true
    secrets: [ crowdin_key ]
    project_identifier: gitea
    ignore_branch: true
    download: true
    export_dir: options/locale/
    when:
      event: [ push ]
      branch: [ master ]

  update-translations:
    image: alpine:3.7
    commands:
      - mv ./options/locale/locale_en-US.ini ./options/
      - sed -i -e 's/="/=/g' -e 's/"$$//g' ./options/locale/*.ini
      - sed -i -e 's/\\\\"/"/g' ./options/locale/*.ini
      - mv ./options/locale_en-US.ini ./options/locale/
    when:
      event: [ push ]
      branch: [ master ]

  git_push:
    image: appleboy/drone-git-push
    pull: true
    secrets: [ git_push_ssh_key ]
    remote: <EMAIL>@github.com:go-gitea/gitea.git
    force: false
    commit: true
    commit_message: "[skip ci] Updated translations via Crowdin"
    author_name: GiteaBot
    author_email: <EMAIL>
    when:
      event: [ push ]
      branch: [ master ]

  pre-build:
    image: webhippie/nodejs:latest
    pull: true
    commands:
      - npm install
      - make stylesheets-check
    when:
      event: [ push, tag, pull_request ]

  build-without-gcc:
    image: golang:1.9
    pull: true
    commands:
      - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
    when:
      event: [ push, tag, pull_request ]

  build:
    image: golang:1.11
    pull: true
    environment:
      TAGS: bindata sqlite sqlite_unlock_notify
    commands:
      - make clean
      - make generate
      - make vet
      - make lint
      - make fmt-check
      - make swagger-check
      - make swagger-validate
      - make misspell-check
      - make test-vendor
      - make build
    when:
      event: [ push, tag, pull_request ]

  test:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata sqlite sqlite_unlock_notify
    commands:
      - make unit-test-coverage
    when:
      event: [ push, pull_request ]
      branch: [ master ]

  test:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata sqlite sqlite_unlock_notify
    commands:
      - make test
    when:
      event: [ push, pull_request ]
      branch: [ release/* ]

  test:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
    commands:
      - make test
    when:
      event: [ tag ]

      #  test-sqlite:
      #    image: golang:1.11
      #    pull: true
      #    group: test
      #    environment:
      #      TAGS: bindata
      #    commands:
      #      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      #      - apt-get install -y git-lfs
      #      - make test-sqlite
      #    when:
      #      event: [ push, tag, pull_request ]

  test-mysql:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
      TEST_LDAP: "1"
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - make integration-test-coverage
    when:
      event: [ push, pull_request ]
      branch: [ master ]

  test-mysql:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
      TEST_LDAP: "1"
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - make test-mysql
    when:
      event: [ tag ]

  test-pgsql:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
      TEST_LDAP: "1"
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - make test-pgsql
    when:
      event: [ push, tag, pull_request ]

  generate-coverage:
    image: golang:1.11
    pull: true
    environment:
      TAGS: bindata
    commands:
      - make coverage
    when:<commit_msg>Kill testing processes if the test takes too long (#5174)<commit_after>workspace:
  base: /go
  path: src/code.gitea.io/gitea

clone:
  git:
    image: plugins/git:next
    depth: 50
    tags: true

pipeline:
  download_translations:
    image: jonasfranz/crowdin
    pull: true
    secrets: [ crowdin_key ]
    project_identifier: gitea
    ignore_branch: true
    download: true
    export_dir: options/locale/
    when:
      event: [ push ]
      branch: [ master ]

  update-translations:
    image: alpine:3.7
    commands:
      - mv ./options/locale/locale_en-US.ini ./options/
      - sed -i -e 's/="/=/g' -e 's/"$$//g' ./options/locale/*.ini
      - sed -i -e 's/\\\\"/"/g' ./options/locale/*.ini
      - mv ./options/locale_en-US.ini ./options/locale/
    when:
      event: [ push ]
      branch: [ master ]

  git_push:
    image: appleboy/drone-git-push
    pull: true
    secrets: [ git_push_ssh_key ]
    remote: <EMAIL>:go-gitea/gitea.git
    force: false
    commit: true
    commit_message: "[skip ci] Updated translations via Crowdin"
    author_name: GiteaBot
    author_email: <EMAIL>
    when:
      event: [ push ]
      branch: [ master ]

  pre-build:
    image: webhippie/nodejs:latest
    pull: true
    commands:
      - npm install
      - make stylesheets-check
    when:
      event: [ push, tag, pull_request ]

  build-without-gcc:
    image: golang:1.9
    pull: true
    commands:
      - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
    when:
      event: [ push, tag, pull_request ]

  build:
    image: golang:1.11
    pull: true
    environment:
      TAGS: bindata sqlite sqlite_unlock_notify
    commands:
      - make clean
      - make generate
      - make vet
      - make lint
      - make fmt-check
      - make swagger-check
      - make swagger-validate
      - make misspell-check
      - make test-vendor
      - make build
    when:
      event: [ push, tag, pull_request ]

  test:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata sqlite sqlite_unlock_notify
    commands:
      - make unit-test-coverage
    when:
      event: [ push, pull_request ]
      branch: [ master ]

  test:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata sqlite sqlite_unlock_notify
    commands:
      - make test
    when:
      event: [ push, pull_request ]
      branch: [ release/* ]

  test:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
    commands:
      - make test
    when:
      event: [ tag ]

  test-sqlite:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.sqlite.test)' | sh)) &
      - make test-sqlite
    when:
      event: [ push, tag, pull_request ]

  test-mysql:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
      TEST_LDAP: "1"
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - make integration-test-coverage
    when:
      event: [ push, pull_request ]
      branch: [ master ]

  test-mysql:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
      TEST_LDAP: "1"
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
      - make test-mysql
    when:
      event: [ tag ]

  test-pgsql:
    image: golang:1.11
    pull: true
    group: test
    environment:
      TAGS: bindata
      TEST_LDAP: "1"
    commands:
      - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
      - apt-get install -y git-lfs
      - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
      - make test-pgsql
    when:
      event: [ push, tag, pull_request ]

  generate-coverage:
    image: golang:1.11
    pull: true
    environment:
      TAGS: bindata
    commands:
      - make coverage
    when:
{'fraction_non_alphanumeric': 0.11046443952974043, 'fraction_numerical': 0.010243277848911651, 'mean_word_length': 1.9475128644939965, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6011635', 'n_tokens_mistral': 3043, 'n_tokens_neox': 2902, 'n_words': 724}