|
| 1 | +name: Python tests and coverage |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - develop |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - develop |
| 12 | + |
| 13 | +jobs: |
| 14 | + unit-tests: |
| 15 | + |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + python-version: [3.6, 3.7, 3.8, 3.9] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - name: Set up Python ${{ matrix.python-version }} |
| 24 | + uses: actions/setup-python@v2 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + - name: Install the package and dependencies |
| 28 | + run: python setup.py install |
| 29 | + - name: Lint with flake8 |
| 30 | + run: | |
| 31 | + pip install flake8 |
| 32 | + # stop the build if there are Python syntax errors or undefined names |
| 33 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 34 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 35 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 36 | + - name: Install testing dependencies |
| 37 | + run: pip install pytest --upgrade |
| 38 | + - name: Test with pytest and run coverage |
| 39 | + run: pytest -s -vv --color=yes |
| 40 | + |
| 41 | + coverage: |
| 42 | + |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v2 |
| 47 | + - name: Set up Python 3.8 |
| 48 | + uses: actions/setup-python@v1 |
| 49 | + with: |
| 50 | + python-version: '3.8' |
| 51 | + - name: Install the package and dependencies |
| 52 | + run: python setup.py install |
| 53 | + - name: Lint with flake8 |
| 54 | + run: | |
| 55 | + pip install flake8 |
| 56 | + # stop the build if there are Python syntax errors or undefined names |
| 57 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 58 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 59 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 60 | + - name: Install testing and coverage dependencies |
| 61 | + run: | |
| 62 | + pip install coveralls coverage |
| 63 | + pip install -U setuptools |
| 64 | + pip install pytest --upgrade |
| 65 | + - name: Test with pytest with coverage |
| 66 | + run: coverage run --source flask_combo_jsonapi -m pytest |
| 67 | + - name: Trigger Coveralls |
| 68 | + run: coveralls --service=github |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + |
| 73 | +# TODO later: add support for parallel builds |
| 74 | +# (not needed right now, now python-version-specific code yet) |
| 75 | +# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support |
0 commit comments