<commit_before>name: CI

on:
  push:
    branches:
    - master
    - devel
    tags:
    - '[0-9]+.[0-9]+.[0-9]+'
    - '[0-9]+.[0-9]+.[0-9]+a[0-9]+'
  pull_request:
    branches:
    - master
    - devel
  schedule:
  # https://crontab.guru/#0_8_1_*_*
  - cron: '0 8 1 * *'

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        # consider using these
        # os: [ubuntu-latest, macos-latest, windows-latest]
        os: [ubuntu-latest]
        python-version: [3.6, 3.7, 3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        sudo apt install openbabel
        python -m pip install --upgrade pip setuptools wheel
        python -m pip install tox tox-gh-actions
    - name: Install CPLEX (when supported)
      env:
        CPLEX_SECRET: ${{ secrets.CPLEX_SECRET }}
        PYTHON_VERSION: ${{ matrix.python-version }}
      shell: bash
      run: ./scripts/install_cplex.sh
    - name: Test with tox
      run:
        tox -- --cov-report=xml
    - name: Report coverage
      shell: bash
      run: bash <(curl -s https://codecov.io/bash)

  release:
    needs: test
    if: startsWith(github.ref, 'refs/tags')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Get tag
      id: tag
      run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip setuptools wheel
        python -m pip install twine
    - name: Build package
      run: python setup.py sdist bdist_wheel
    - name: Check the package
      run: twine check dist/*
    - name: Publish to PyPI
      env:
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
      run:
        twine upload --verbose -u TWINE_USERNAME -p TWINE_PASSWORD --skip-existing --non-interactive dist/*
    - name: Create GitHub release
      uses: actions/create-release@v1
      env:
        # This token is set by gh actions
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: ${{ github.ref }}
        body_path: "release-notes/${{ steps.tag.outputs.version }}.md"
        draft: false
        prerelease: false

  deploy-docs:
    needs: test
    if: startsWith(github.ref, 'refs/tags')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      # TODO: consider pip cache
      run: |
        sudo apt-get install pandoc swig
        python3 -m pip install ".[docs,jupyter]"
    - name: Build docs
      run: cd docs && make apidoc && make html && touch _build/html/.nojekyll
    - name: Deploy
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: docs/_build/html
        cname: cameo.bio
<commit_msg>chore: use official pypi GH action and pypi API token<commit_after>name: CI

on:
  push:
    branches:
    - master
    - devel
    tags:
    - '[0-9]+.[0-9]+.[0-9]+'
    - '[0-9]+.[0-9]+.[0-9]+a[0-9]+'
  pull_request:
    branches:
    - master
    - devel
  schedule:
  # https://crontab.guru/#0_8_1_*_*
  - cron: '0 8 1 * *'

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        # consider using these
        # os: [ubuntu-latest, macos-latest, windows-latest]
        os: [ubuntu-latest]
        python-version: [3.6, 3.7, 3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        sudo apt install openbabel
        python -m pip install --upgrade pip setuptools wheel
        python -m pip install tox tox-gh-actions
    - name: Install CPLEX (when supported)
      env:
        CPLEX_SECRET: ${{ secrets.CPLEX_SECRET }}
        PYTHON_VERSION: ${{ matrix.python-version }}
      shell: bash
      run: ./scripts/install_cplex.sh
    - name: Test with tox
      run:
        tox -- --cov-report=xml
    - name: Report coverage
      shell: bash
      run: bash <(curl -s https://codecov.io/bash)

  release:
    needs: test
    if: startsWith(github.ref, 'refs/tags')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.8]

    steps:
    - name: Publish package
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        user: __token__
        password: ${{ secrets.PYPI_API_TOKEN }}
    - name: Create GitHub release
      uses: actions/create-release@v1
      env:
        # This token is set by gh actions
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: ${{ github.ref }}
        body_path: "release-notes/${{ steps.tag.outputs.version }}.md"
        draft: false
        prerelease: false

  deploy-docs:
    needs: test
    if: startsWith(github.ref, 'refs/tags')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      # TODO: consider pip cache
      run: |
        sudo apt-get install pandoc swig
        python3 -m pip install ".[docs,jupyter]"
    - name: Build docs
      run: cd docs && make apidoc && make html && touch _build/html/.nojekyll
    - name: Deploy
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: docs/_build/html
        cname: cameo.bio

{'fraction_non_alphanumeric': 0.13070094888276707, 'fraction_numerical': 0.011784511784511785, 'mean_word_length': 2.0184757505773674, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '209247', 'n_tokens_mistral': 2256, 'n_tokens_neox': 2141, 'n_words': 532}