-
Notifications
You must be signed in to change notification settings - Fork 6
143 lines (116 loc) · 3.91 KB
/
ci.yml
File metadata and controls
143 lines (116 loc) · 3.91 KB
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
135
136
137
138
139
140
141
142
143
name: CI
on:
push:
branches: [main, devito]
pull_request:
branches: [main]
jobs:
# Run tests for mathematical derivations and operators with coverage
test-derivations:
name: Test Mathematical Derivations
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov numpy sympy matplotlib ipython
- name: Run tests with coverage
run: |
pytest tests/test_operators.py tests/test_derivations.py -v --cov=src --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: derivations
name: derivations-coverage
fail_ci_if_error: false
# Run explicit Devito solver tests with coverage
test-devito-explicit:
name: Test Devito Explicit Solvers
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov numpy sympy matplotlib
pip install devito
- name: Run Devito tests with coverage
run: |
pytest tests/ -v -m "devito" --cov=src --cov-report=xml --cov-report=term-missing --tb=short
continue-on-error: true # Allow to continue even if Devito tests fail initially
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: devito
name: devito-coverage
fail_ci_if_error: false
# Lint and style checks
lint:
name: Lint and Style
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff isort
- name: Run ruff check
run: |
# Check only new Devito code (skip legacy code with many pre-existing issues)
ruff check src/wave/*_devito.py src/diffu/*_devito.py src/advec/*_devito.py src/nonlin/ src/symbols.py src/operators.py src/display.py src/verification.py src/plotting.py tests/ --select=E,W,F --ignore=F403,F405,E501,E741,E743,E731,E402,F841,E722
- name: Check import ordering
run: |
isort --check-only src/ tests/ --skip __init__.py
continue-on-error: true
# Build Quarto book
build-book:
name: Build Quarto Book
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install numpy sympy matplotlib jupyter
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: '1.4.554'
- name: Install TinyTeX
run: |
quarto install tinytex
- name: Render book
run: |
quarto render --to pdf
continue-on-error: true # Book may not build initially
- name: Upload book artifact
uses: actions/upload-artifact@v4
with:
name: book-pdf
path: _book/*.pdf
if: success()