-
-
Notifications
You must be signed in to change notification settings - Fork 50
134 lines (133 loc) · 3.87 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Continuous Integration
on:
schedule:
- cron: '0 0 * * 3'
push:
branches:
- main
pull_request:
branches:
- main
paths:
- .github/workflows/ci.yml
- "atom/**"
- "tests/**"
- "examples/**"
- setup.py
- pyproject.toml
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'lint_requirements.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install project
run: |
pip install -e .
- name: Install dependencies
run: |
pip install -U -r lint_requirements.txt
- name: Formatting
if: always()
run: |
ruff format atom examples tests --check
- name: Linting
if: always()
run: |
ruff check atom examples tests
- name: Typing
if: always()
run: |
mypy atom examples
types:
name: Type checking
runs-on: ubuntu-latest
needs:
- lint
if: needs.lint.result == 'success'
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install project
run: |
pip install .
- name: Run Mypy
run: |
pip install mypy pytest
mypy atom
- name: Test with pytest
run: |
pip install pytest-mypy-plugins regex
python -X dev -m pytest tests/type_checking -v
tests:
name: Unit tests
runs-on: ${{ matrix.os }}
needs:
- lint
if: needs.lint.result == 'success'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools-scm[toml]
pip install git+https://github.com/nucleic/cppy@main
- name: Install project
env:
CPPFLAGS: --coverage
# Build extensions manually to allow getting C coverage data
run: |
pip install -e .
- name: Test with pytest
run: |
pip install -r test_requirements.txt
python -X dev -m pytest tests --ignore=tests/type_checking --cov --cov-report xml -v -W error
- name: Generate C++ coverage reports
if: (github.event_name != 'schedule' && matrix.os != 'windows-latest')
run: |
bash -c "find . -type f -name '*.gcno' -exec gcov -pb --all-blocks {} +" || true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
verbose: true