-
Notifications
You must be signed in to change notification settings - Fork 3
146 lines (142 loc) · 4.72 KB
/
pyleco_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
135
136
137
138
139
140
141
142
143
144
145
146
name: PyLECO CI
on:
push:
branches:
- main
pull_request:
jobs:
docs_lint:
name: Docs and Linting
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python and Mamba version
run: |
python --version
micromamba info
- name: Lint with ruff
uses: chartboost/ruff-action@v1
with:
args: --extend-select=E9,F63,F7,F82 --show-source
- uses: ammaraskar/sphinx-problem-matcher@master
- name: Generate docs
if: always() # run even if the previous step failed
working-directory: ./docs
run: |
echo "::add-matcher::.github/sphinx.json"
make html SPHINXOPTS="-W --keep-going"
- name: Run doctests
if: always() # run even if the previous step failed
working-directory: ./docs
run: |
echo "::add-matcher::.github/sphinx.json"
make doctest SPHINXOPTS="-W --keep-going"
type_checking:
name: Static Type Checking
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install mypy
run: pip install mypy
- name: Run mypy
run: mypy .
test_coverage:
name: Code Coverage on codecov
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pyleco
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install -e .[dev] # editable for covtest
- name: Test for Coverage
run: pytest --cov=pyleco --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.xml,!./cache
flags: unittests
name: codecov-umbrella
verbose: true
test:
name: Python ${{ matrix.python-version }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: python=${{ matrix.python-version }}
cache-environment-key: py${{ matrix.python-version }}-${{ matrix.os }}-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pyleco
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install .[dev]
- name: Pyleco version
run: python -c "import pyleco;print(pyleco.__version__)"
- name: Run pytest under Linux with xvfb
if: runner.os == 'Linux'
run: |
echo "::add-matcher::.github/pytest.json"
xvfb-run -a pytest
- name: Run pytest under Windows
if: runner.os == 'Windows'
run: |
echo "::add-matcher::.github/pytest.json"
pytest
- name: Run pytest under Mac without acceptance tests
if: runner.os == 'macOS'
run: |
echo "::add-matcher::.github/pytest.json"
pytest --ignore=tests/acceptance_tests