forked from zulip/zulip-terminal
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (89 loc) · 3.1 KB
/
lint-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Linting & tests
on: [push, pull_request]
jobs:
mypy:
runs-on: ubuntu-latest
name: Lint - Type consistency (mypy)
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install with linting tools
run: pip install .[linting]
- name: Run mypy
run: ./tools/run-mypy
flake8:
runs-on: ubuntu-latest
name: Lint - PEP8 & more (flake8)
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install with linting tools
run: pip install .[linting]
- name: Run flake8
run: flake8
isort:
runs-on: ubuntu-latest
name: Lint - Import order (isort)
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install with linting tools
# NOTE: Install pytest so that isort recognizes it as a known library
run: pip install .[linting] && pip install pytest
- name: Run isort
run: ./tools/run-isort-check
black:
runs-on: ubuntu-latest
name: Lint - Code formatting (black)
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install with linting tools
run: pip install .[linting]
- name: Check code & tests meet black standards
run: black --check zulipterminal/ tests/
pytest:
strategy:
# Not failing fast allows all matrix jobs to try & finish even if one fails early
fail-fast: false
matrix:
env:
- {PYTHON: 3.6, OS: ubuntu-latest, NAME: "CPython 3.6 (ubuntu)"}
- {PYTHON: 3.7, OS: ubuntu-latest, NAME: "CPython 3.7 (ubuntu)"}
- {PYTHON: 3.8, OS: ubuntu-latest, NAME: "CPython 3.8 (ubuntu)"}
- {PYTHON: 3.9, OS: ubuntu-latest, NAME: "CPython 3.9 (ubuntu)", CODECOV: true}
- {PYTHON: 'pypy3', OS: ubuntu-latest, NAME: "PyPy 3 (ubuntu)"}
- {PYTHON: 3.9, OS: macos-latest, NAME: "CPython 3.9 (macos)"}
runs-on: ${{ matrix.env.OS }}
name: Install & test - ${{ matrix.env.NAME}}
steps:
- uses: actions/checkout@v2
- name: Install Python version ${{ matrix.env.PYTHON }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.env.PYTHON }}
- name: Output Python version
run: python --version
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Ensure libxml-related libraries are installed (pypy3 only)
if: matrix.env.PYTHON == 'pypy3'
run: sudo apt install libxml2-dev libxslt1-dev
- name: Ensure regular package installs from checkout
run: pip install .
- name: Install test dependencies
run: pip install .[testing]
- name: Run tests with pytest
run: pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
# We avoid extra work by just running codecov on one python version
if: matrix.env.CODECOV