xkumiyu/case-style-changer

View on GitHub
.github/workflows/pythonpackage.yml

Summary

Maintainability
Test Coverage
name: Python package

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]
    env:
      POETRY_VIRTUALENVS_IN_PROJECT: true

    steps:
    - uses: actions/checkout@v1

    - name: Cache python packages
      uses: actions/cache@v1
      with:
        path: ~/work/case-style-changer/case-style-changer/.venv
        key: python-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

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

    - name: Install poetry
      run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

    - name: Install dependencies
      run: ~/.poetry/bin/poetry install

    - name: Lint with flake8
      run: ~/.poetry/bin/poetry run flake8

    - name: Test with pytest
      run: ~/.poetry/bin/poetry run pytest --cov=case_style_changer --cov-report=xml

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v1
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        file: ./coverage.xml
        fail_ci_if_error: true