-
Notifications
You must be signed in to change notification settings - Fork 5
72 lines (63 loc) · 2.03 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
---
on:
push:
branches:
- master
pull_request:
name: CI
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- version: '3.12'
- version: '3.11'
- version: '3.10'
- version: '3.9'
exclude-pattern-matching: true
- version: '3.8'
exclude-pattern-matching: true
name: Python ${{ matrix.python.version }}
steps:
# Check out code
- uses: actions/checkout@v4
# Python
- name: Setup python ${{ matrix.python.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
cache: pip
cache-dependency-path: requirements-dev.txt
- name: Install dev dependencies
run: pip install --root-user-action=ignore --upgrade pip --requirement requirements-dev.txt
# Install library
- name: Install maybe
run: pip install --root-user-action=ignore --editable .[result]
# Tests
- name: Run tests (excluding pattern matching)
if: ${{ matrix.python.exclude-pattern-matching }}
run: pytest --ignore=tests/test_pattern_matching.py
- name: Run tests (including pattern matching)
if: ${{ ! matrix.python.exclude-pattern-matching }}
run: pytest
# Linters
- name: Run flake8 (excluding pattern matching)
if: ${{ matrix.python.exclude-pattern-matching }}
run: flake8 --extend-exclude tests/test_pattern_matching.py
- name: Run flake8 (including pattern matching)
if: ${{ ! matrix.python.exclude-pattern-matching }}
run: flake8
- name: Run mypy
run: mypy
# Packaging
- name: Build packages
run: |
pip install --root-user-action=ignore --upgrade build pip setuptools wheel
python -m build
# Coverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
if: matrix.python == '3.9'
with:
token: ${{ secrets.CODECOV_TOKEN }}