pyapp-org/pyapp.elasticsearch

View on GitHub
.github/workflows/python-app.yml

Summary

Maintainability
Test Coverage
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on: [push]

jobs:
  test:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8]

    name: Test Python ${{ matrix.python-version }}
    steps:
    - uses: actions/checkout@v2
    - name: Setup Python ${{ matrix.python-version }}
      uses: actions/setup-python@master
      with:
        python-version: ${{ matrix.python-version }}

    - name: Setup coverage reporter
      run: |
        curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
        chmod +x ./cc-test-reporter
        GIT_BRANCH=$GITHUB_REF GIT_COMMIT_SHA=$GITHUB_SHA ./cc-test-reporter before-build

    - name: Install dependencies
      run: |
        python -m pip install -U poetry coverage
        poetry install -E async

    - name: Test with pytest
      run: |
        poetry run pytest

    - name: Codecov
      uses: codecov/codecov-action@v1.0.12

    - name: Report coverage
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      run: |
        GIT_BRANCH=$GITHUB_REF GIT_COMMIT_SHA=$GITHUB_SHA ./cc-test-reporter after-build -t coverage.py --exit-code $?