|
1 |
| -name: Tests |
2 |
| - |
| 1 | +name: Testing |
3 | 2 | on:
|
4 | 3 | push:
|
5 | 4 | branches: [master]
|
6 | 5 | pull_request:
|
7 | 6 | branches: [master]
|
8 |
| - paths: |
9 |
| - - "flake8_isort.py" |
10 |
| - - "test_flake8_isort.py" |
11 |
| - - "setup.py" |
12 |
| - - ".github/workflows/tests.yml" |
13 |
| - |
| 7 | +env: |
| 8 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
14 | 9 | jobs:
|
15 |
| - tests: |
16 |
| - runs-on: ubuntu-latest |
| 10 | + test: |
17 | 11 | name: Python ${{ matrix.python-version }} x isort ${{ matrix.isort }} x flake8 ${{ matrix.flake8 }}
|
18 |
| - |
| 12 | + runs-on: ubuntu-latest |
19 | 13 | strategy:
|
20 | 14 | matrix:
|
21 |
| - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy3'] |
| 15 | + python-version: ["3.10", 3.9, 3.8, 3.7, pypy-3.9] |
22 | 16 | isort: [4.3.21, 5.10.1]
|
23 | 17 | flake8: [3.9.2, 4.0.1, 5.0.4]
|
24 |
| - |
25 | 18 | steps:
|
26 |
| - - uses: actions/checkout@v2 |
27 |
| - - uses: actions/setup-python@v2 |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - name: Set up Python |
| 21 | + uses: actions/setup-python@v4 |
28 | 22 | with:
|
29 | 23 | python-version: ${{ matrix.python-version }}
|
30 |
| - architecture: x64 |
31 |
| - - name: Install matrix dependencies |
32 |
| - run: pip install 'isort==${{ matrix.isort }}' 'flake8==${{ matrix.flake8 }}' |
| 24 | + - name: Cache packages |
| 25 | + uses: actions/cache@v3 |
| 26 | + with: |
| 27 | + path: ~/.cache/pip |
| 28 | + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} |
| 29 | + restore-keys: | |
| 30 | + ${{ runner.os }}-pip-${{ matrix.python-version }}- |
| 31 | + - name: pip version |
| 32 | + run: pip --version |
| 33 | + - name: Install dependencies |
| 34 | + run: | |
| 35 | + python -m pip install -r requirements.txt |
| 36 | + pip install 'isort==${{ matrix.isort }}' 'flake8==${{ matrix.flake8 }}' |
33 | 37 | # isort 4.x requires `toml` to be able to read pyproject.toml, so install it...
|
34 | 38 | - name: Install toml if required
|
35 | 39 | run: pip install toml
|
36 | 40 | if: matrix.isort == '4.3.21'
|
37 |
| - - name: Install dependencies |
38 |
| - run: pip install .[test] |
39 |
| - - name: flake8 |
40 |
| - run: flake8 *.py |
41 |
| - - name: pytest |
42 |
| - run: pytest -v --cov flake8_isort --cov-report term-missing |
43 |
| - - name: Upload coverage |
| 41 | + # formatters |
| 42 | + - name: Run pyupgrade |
| 43 | + if: matrix.python-version == '3.9' |
| 44 | + run: pyupgrade --py37-plus *.py |
| 45 | + - name: Run isort |
| 46 | + if: matrix.python-version == '3.9' |
| 47 | + run: isort --check-only *.py |
| 48 | + - name: Run black |
| 49 | + if: matrix.python-version == '3.9' |
| 50 | + run: black --check --skip-string-normalization *.py |
| 51 | + # linters |
| 52 | + - name: Lint with bandit |
| 53 | + if: matrix.python-version == '3.9' |
| 54 | + run: bandit --skip B101 *.py # B101 is assert statements |
| 55 | + - name: Lint with codespell |
| 56 | + if: matrix.python-version == '3.9' |
| 57 | + run: codespell *.rst *.py |
| 58 | + - name: Lint with flake8 |
| 59 | + if: matrix.python-version == '3.9' |
| 60 | + run: flake8 *.py --count --max-complexity=18 --max-line-length=88 --show-source --statistics |
| 61 | + - name: Lint with mypy |
| 62 | + if: matrix.python-version == '3.9' |
44 | 63 | run: |
|
45 |
| - python -m pip install coveralls |
46 |
| - coveralls --service=github |
47 |
| - env: |
48 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + mkdir --parents --verbose .mypy_cache |
| 65 | + mypy --ignore-missing-imports --install-types --non-interactive *.py || true |
| 66 | + - name: Lint with safety |
| 67 | + if: matrix.python-version == '3.9' |
| 68 | + run: safety check || true |
| 69 | + # tests and coverage |
| 70 | + - name: Test |
| 71 | + run: pytest run_tests.py --cov --cov-report term-missing |
| 72 | + - name: Coverage |
| 73 | + run: coveralls --service=github |
0 commit comments