name: Tests
on: [push, pull_request]

jobs:
  tests:
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]

    steps:
      - uses: actions/checkout@v2

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

      - name: install requirements
        run: |
          python -m pip install --upgrade pip
          pip install -e .[test]
      - name: Run tests
        run: |
          pytest scrapyd --cov=./ --cov-report=xml

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          directory: ./coverage/reports/
          env_vars: OS,PYTHON
          fail_ci_if_error: false
          files: ./coverage.xml
          flags: unittests
          name: codecov-umbrella
          # https://github.com/codecov/codecov-action/issues/476
          # path_to_write_report: ./coverage/codecov_report.txt
          verbose: true

name: Tests
on: [push, pull_request]

jobs:
  tests:
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]

    steps:
      - uses: actions/checkout@v2

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

      - name: install requirements
        run: |
          python -m pip install --upgrade pip
          pip install -e .[test]
      - name: Run tests
        run: |
          pytest scrapyd --cov=./ --cov-report=xml

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          directory: ./coverage/reports/
          env_vars: OS,PYTHON
          fail_ci_if_error: false
          files: ./coverage.xml
          flags: unittests
          name: codecov-umbrella
          # https://github.com/codecov/codecov-action/issues/476
          # path_to_write_report: ./coverage/codecov_report.txt
          verbose: true

Use latest version of Ubuntu
chore(ci): Use latest version of Ubuntu