<commit_before>name: CI

on:
  pull_request:
  push:
    branches:
      - master
  release:
    types:
      - created
  schedule:
    - cron: '0 2 * * *'

jobs:
  lint:
    runs-on: ubuntu-18.04

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: 3.6  # check pylint with minimal supported python version

      - name: Install flake8
        run: |
          python -m pip install flake8 -U

      - name: Lint with flake8
        run: |
          flake8 mapentity test_project test_app


  doc_build:
    name: Sphinx doc is building
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python 3.6
        uses: actions/setup-python@v2
        with:
          python-version: 3.6

      - name: Install dependencies
        run: |
          pip install -r docs/requirements.txt -U

      - name: Build html docs
        run: |
          cd docs
          make html


  test:
    runs-on: ubuntu-18.04
    continue-on-error: true
    strategy:
      matrix:
        python-version: [ 3.6, 3.9 ]
        django-version: [ 2.2.*, 3.2.* ]

    steps:
    - uses: actions/checkout@v2

    - name: Install system dependencies
      run: |
        sudo apt-get update
        sudo apt-get -y install gettext libproj-dev binutils gdal-bin libgdal-dev libsqlite3-mod-spatialite libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install python dependencies
      run: |
        python -m pip install --upgrade pip setuptools wheel
        pip install .[dev]
        pip install Django==${{ matrix.django-version }} -U

    - name: Check pending migrations
      run: |
        ./manage.py makemigrations --check

    - name: Test with coverage
      run: |
        coverage run ./manage.py test -v3
        coverage report -m

    - name: Coverage upload
      run: |
        pip install codecov
        codecov

  publish:
    needs: [lint, doc_build, test]
    runs-on: ubuntu-18-04
    if: ${{ github.event_name == 'release' && github.event.action == 'created' }}

    steps:
      - uses: actions/checkout@v2
      - name: Prepare package
        run: |
          python setup.py sdist
      - name: Publish package
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}<commit_msg>fix publish python<commit_after>name: CI

on:
  pull_request:
  push:
    branches:
      - master
  release:
    types:
      - created
  schedule:
    - cron: '0 2 * * *'

jobs:
  lint:
    runs-on: ubuntu-18.04

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: 3.6  # check pylint with minimal supported python version

      - name: Install flake8
        run: |
          python -m pip install flake8 -U

      - name: Lint with flake8
        run: |
          flake8 mapentity test_project test_app


  doc_build:
    name: Sphinx doc is building
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python 3.6
        uses: actions/setup-python@v2
        with:
          python-version: 3.6

      - name: Install dependencies
        run: |
          pip install -r docs/requirements.txt -U

      - name: Build html docs
        run: |
          cd docs
          make html


  test:
    runs-on: ubuntu-18.04
    continue-on-error: true
    strategy:
      matrix:
        python-version: [ 3.6, 3.9 ]
        django-version: [ 2.2.*, 3.2.* ]

    steps:
    - uses: actions/checkout@v2

    - name: Install system dependencies
      run: |
        sudo apt-get update
        sudo apt-get -y install gettext libproj-dev binutils gdal-bin libgdal-dev libsqlite3-mod-spatialite libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install python dependencies
      run: |
        python -m pip install --upgrade pip setuptools wheel
        pip install .[dev]
        pip install Django==${{ matrix.django-version }} -U

    - name: Check pending migrations
      run: |
        ./manage.py makemigrations --check

    - name: Test with coverage
      run: |
        coverage run ./manage.py test -v3
        coverage report -m

    - name: Coverage upload
      run: |
        pip install codecov
        codecov

  publish:
    needs: [lint, doc_build, test]
    runs-on: ubuntu-18.04
    if: ${{ github.event_name == 'release' && github.event.action == 'created' }}

    steps:
      - uses: actions/checkout@v2
      - name: Prepare package
        run: |
          python setup.py sdist
      - name: Publish package
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}
{'fraction_non_alphanumeric': 0.10305838739573679, 'fraction_numerical': 0.02298424467099166, 'mean_word_length': 1.8236525379382522, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '497063', 'n_tokens_mistral': 1839, 'n_tokens_neox': 1716, 'n_words': 464}