name: CI
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]


jobs:
  ci:
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Install Poetry
        run: pipx install poetry
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'poetry'
      - name: Setup environment
        run: poetry install
      - name: Style
        if: ${{ matrix.python-version == '3.11' }}  # to run only once
        run: make style
      - name: Test
        run: make test
      - name: Codecov
        uses: codecov/codecov-action@v2
        with:
          flags: ${{ matrix.python-version }}
