ralphg6/david

View on GitHub
.github/workflows/pythonapp.yml

Summary

Maintainability
Test Coverage
name: Python application

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.6
      uses: actions/setup-python@v1
      with:
        python-version: '3.6' # Semantic version range syntax or exact version of a Python version
        architecture: 'x64'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements-dev.txt
    - name: Lint
      run: |
        make lint
    - name: Checking types
      run: |
        make types    
    - name: Build docs
      run: |
        pip install -e .
        pip install -r requirements-docs.txt
        make docs
    - name: Test and publish code coverage
      uses: paambaati/codeclimate-action@v2.4.0
      # if: github.ref == 'refs/heads/develop'
      env:
        # Set CC_TEST_REPORTER_ID as secret of your repo
        CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
      with:
        # The report file must be there, otherwise Code Climate won't find it
        coverageCommand: make coverage
        debug: true
  build-n-publish:
    name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
    needs: test
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.6
      uses: actions/setup-python@v1
      with:
        python-version: 3.6
    - name: Install setuptools and wheel
      run: python -m pip install --user --upgrade setuptools wheel    
    - name: Build a binary wheel and a source tarball
      run: python setup.py sdist bdist_wheel
    - name: Install twine
      run: python -m pip install --user --upgrade twine
    - name: Publish distribution 📦 to Test PyPI
      if: github.ref == 'refs/heads/develop'
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
        TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
      run: python -m twine upload --skip-existing dist/*
    - name: Publish distribution 📦 to PyPI
      if: startsWith(github.event.ref, 'refs/tags')
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.pypi_password }}
        TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
      run: python -m twine upload dist/*