|
| 1 | +name: Linting & tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + mypy: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + name: Lint - Type consistency (mypy) |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v2 |
| 11 | + - uses: actions/setup-python@v1 |
| 12 | + with: |
| 13 | + python-version: 3.7 |
| 14 | + - name: Install with linting tools |
| 15 | + run: pip install .[linting] |
| 16 | + - name: Run mypy |
| 17 | + run: ./tools/run-mypy |
| 18 | + |
| 19 | + flake8: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + name: Lint - PEP8 & more (flake8) |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - uses: actions/setup-python@v1 |
| 25 | + with: |
| 26 | + python-version: 3.7 |
| 27 | + - name: Install with linting tools |
| 28 | + run: pip install .[linting] |
| 29 | + - name: Run flake8 |
| 30 | + run: flake8 |
| 31 | + |
| 32 | + isort: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + name: Lint - Import order (isort) |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v2 |
| 37 | + - uses: actions/setup-python@v1 |
| 38 | + with: |
| 39 | + python-version: 3.5 |
| 40 | + - name: Install with linting tools |
| 41 | + # NOTE: Install pytest so that isort recognizes it as a known library |
| 42 | + run: pip install .[linting] && pip install pytest |
| 43 | + - name: Run isort |
| 44 | + run: ./tools/run-isort-check |
| 45 | + |
| 46 | + pytest: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + strategy: |
| 49 | + # Not failing fast allows all matrix jobs to try & finish even if one fails early |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + test-python-version: [3.5, 3.6, 3.7, 3.8, 3.9] |
| 53 | + name: Install & pytest - CPython ${{ matrix.test-python-version }} |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v2 |
| 56 | + - name: Install Python 3 |
| 57 | + uses: actions/setup-python@v1 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.test-python-version }} |
| 60 | + - name: Upgrade pip |
| 61 | + run: python -m pip install --upgrade pip |
| 62 | + - name: Ensure regular package installs from checkout |
| 63 | + run: pip install . |
| 64 | + - name: Install test dependencies |
| 65 | + run: pip install .[testing] |
| 66 | + - name: Run tests with pytest |
| 67 | + run: pytest |
| 68 | + - name: Run codecov |
| 69 | + run: pip3 install codecov && codecov |
0 commit comments