-
Notifications
You must be signed in to change notification settings - Fork 78
80 lines (71 loc) · 2.37 KB
/
ci.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
---
on:
push:
branches:
- master
pull_request:
name: CI
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- '3.12'
- '3.11'
- '3.10'
- '3.9'
- '3.8'
name: Python ${{ matrix.python }}
steps:
# Python
- name: Setup python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
# Check out code
- uses: actions/checkout@v2
# Cached dependencies
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-py${{ matrix.python }}-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python }}-
- name: Install dev dependencies
# There's no virtual env in CI environment, just bypass it with a dummy
# env var value
run: VIRTUAL_ENV=none make install
# Tests
- name: Run tests
run: pytest --ignore=tests/test_pattern_matching.py --ignore=tests/type_checking/test_result.yml
- name: Run tests (type checking)
if: matrix.python != '3.8' && matrix.python != '3.9'
# These started breaking for <= 3.9, due to the type checker using a
# '|' for unions rather than 'Union[...]', so it's not possible to run
# the tests without maintaining two duplicate files (one for <= 3.9 and
# one for > 3.9)
run: pytest tests/type_checking/test_result.yml
- name: Run tests (pattern matching)
if: matrix.python == '3.10' || matrix.python == '3.11' || matrix.python == '3.12'
run: pytest tests/test_pattern_matching.py
# Linters
- name: Run flake8 (Python >= 3.10)
run: make lint-flake
if: matrix.python != '3.9' && matrix.python != '3.8'
- name: Run flake8 (Python < 3.10)
run: make lint-flake-pre310
if: matrix.python == '3.9' || matrix.python == '3.8'
- name: Run mypy
run: make lint-mypy
# Packaging
- name: Build packages
run: |
pip install --upgrade build pip setuptools wheel
python -m build
# Coverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v1
if: matrix.python == '3.9'
with:
token: ${{ secrets.CODECOV_TOKEN }}