name: PyTests
on: push

jobs:
  test:
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        python-version:
          - 3.7
          - 3.8
          - 3.9
          - '3.10'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - run: pip install -r requirements.txt
      - run: pip install -r requirements-dev.txt
      - uses: lpenz/ghaction-pytest-cov@v1
        env:
          GHOST_SITE: ${{ secrets.GHOST_SITE }}
          GHOST_ADMIN_KEY: ${{ secrets.GHOST_ADMIN_KEY }}
          GHOST_CONTENT_KEY: ${{ secrets.GHOST_CONTENT_KEY }}
      - uses: AndreMiras/coveralls-python-action@v20201129
        with:
          parallel: true
          flag-name: python-${{ matrix.python-version }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
  coverage-finish:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: AndreMiras/coveralls-python-action@v20201129
        with:
          parallel-finished: true