|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["master"] |
| 6 | + pull_request: |
| 7 | + branches: ["master"] |
| 8 | + workflow_dispatch: # to allow manual re-runs |
| 9 | + |
| 10 | + |
| 11 | +jobs: |
| 12 | + linting: |
| 13 | + name: "Perform linting checks" |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + python-version: ["3.9"] |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: "actions/checkout@v2" |
| 22 | + - uses: "actions/setup-python@v2" |
| 23 | + with: |
| 24 | + python-version: "${{ matrix.python-version }}" |
| 25 | + - name: "Install dependencies" |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip poetry |
| 28 | + - name: "Code formating (black)" |
| 29 | + run: | |
| 30 | + poetry run pre-commit run black --all-files |
| 31 | + - name: "Code formating (flake8)" |
| 32 | + run: | |
| 33 | + poetry run pre-commit run flake8 --all-files |
| 34 | + - name: "Order of imports (isort)" |
| 35 | + run: | |
| 36 | + poetry run pre-commit run isort --all-files |
| 37 | + - name: "Typing checks (mypy)" |
| 38 | + run: | |
| 39 | + poetry run pre-commit run mypy --all-files |
| 40 | + - name: "Run trailing-whitespace" |
| 41 | + run: | |
| 42 | + poetry run pre-commit run trailing-whitespace --all-files |
| 43 | + - name: "Run end-of-file-fixer" |
| 44 | + run: | |
| 45 | + poetry run pre-commit run end-of-file-fixer --all-files |
| 46 | + - name: "Run check-docstring-first" |
| 47 | + run: | |
| 48 | + poetry run pre-commit run check-docstring-first --all-files |
| 49 | + - name: "Run debug-statements" |
| 50 | + run: | |
| 51 | + poetry run pre-commit run debug-statements --all-files |
| 52 | + - name: "Run check-ast" |
| 53 | + run: | |
| 54 | + poetry run pre-commit run check-ast --all-files |
| 55 | + - name: "Potential security issues (bandit)" |
| 56 | + run: | |
| 57 | + poetry run pre-commit run bandit --all-files |
| 58 | +
|
| 59 | +
|
| 60 | + tests: |
| 61 | + name: "Python ${{ matrix.python-version}} on ${{ matrix.os }}" |
| 62 | + needs: linting |
| 63 | + runs-on: ${{ matrix.os }} |
| 64 | + |
| 65 | + strategy: |
| 66 | + matrix: |
| 67 | + python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"] |
| 68 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 69 | + |
| 70 | + steps: |
| 71 | + - uses: "actions/checkout@v2" |
| 72 | + - uses: "actions/setup-python@v2" |
| 73 | + with: |
| 74 | + python-version: "${{ matrix.python-version }}" |
| 75 | + - name: "Install dependencies" |
| 76 | + run: | |
| 77 | + python -m pip install --upgrade pip poetry |
| 78 | + - name: "Run tests" |
| 79 | + run: | |
| 80 | + poetry run pytest --cov kasa --cov-report xml |
| 81 | + - name: "Upload coverage to Codecov" |
| 82 | + uses: "codecov/codecov-action@v1" |
| 83 | + with: |
| 84 | + fail_ci_if_error: true |
0 commit comments