|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +name: pytest |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ dev ] |
| 9 | + pull_request: |
| 10 | + branches: [ dev ] |
| 11 | + release: |
| 12 | + types: [created] |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: [3.8, 3.9] |
| 21 | + requirements-cmd: |
| 22 | + - -r testing-requirements.txt -r requirements.txt |
| 23 | + pytest-run-cmd: |
| 24 | + - pytest |
| 25 | + exclude: |
| 26 | + - python-version: 3.9 |
| 27 | + requirements-cmd: -r testing-requirements.txt -r requirements.txt |
| 28 | + pytest-run-cmd: pytest |
| 29 | + include: |
| 30 | + - python-version: 3.8 |
| 31 | + requirements-cmd: -r testing-requirements.txt -r oldest |
| 32 | + - python-version: 3.9 |
| 33 | + requirements-cmd: -r testing-requirements.txt -r coverage-requirements.txt -r requirements.txt |
| 34 | + pytest-run-cmd: | |
| 35 | + pytest --cov=generalizedtrees --cov-report xml |
| 36 | + codecov |
| 37 | +
|
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + - name: Set up Python ${{ matrix.python-version }} |
| 41 | + uses: actions/setup-python@v2 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + - name: Install dependencies |
| 45 | + run: | |
| 46 | + python -m pip install --upgrade pip |
| 47 | + python -m pip install flake8 pytest |
| 48 | + python -m pip install ${{ matrix.requirements-cmd }} |
| 49 | + - name: Lint with flake8 |
| 50 | + run: | |
| 51 | + # stop the build if there are Python syntax errors or undefined names |
| 52 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 53 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 54 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 55 | + - name: Test with pytest |
| 56 | + run: | |
| 57 | + ${{ matrix.pytest-run-cmd }} |
0 commit comments