name: Tests

on:
  push:
    paths-ignore:
      - 'docs/**'
      - '**.md'
      - 'third_party/**'
  pull_request:
    paths-ignore:
      - 'docs/**'
      - '**.md'
      - 'third_party/**'

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        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 dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install tox tox-gh-actions
    - name: Test with tox
      run: tox
      env:
        TEST_EMAIL_USERNAME: ${{ secrets.TEST_EMAIL_USERNAME }}
        TEST_EMAIL_PASSWORD: ${{ secrets.TEST_EMAIL_PASSWORD }}
        TEST_EMAIL_IMAP_SERVER: ${{ secrets.TEST_EMAIL_IMAP_SERVER }}
    - name: Upload coverage
      uses: codecov/codecov-action@v2
