-
Notifications
You must be signed in to change notification settings - Fork 5
64 lines (53 loc) · 1.7 KB
/
Copy pathtests.yml
File metadata and controls
64 lines (53 loc) · 1.7 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
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev,plot]" pytest-cov coverage-badge mypy types-requests
- name: Verify plotting libraries
run: |
python - <<'PY'
import sys, matplotlib
from PIL import __version__ as PILVER
print("Python", sys.version.split()[0])
print("Pillow", PILVER)
print("matplotlib", matplotlib.__version__)
PY
- name: Run linting with ruff
run: |
ruff check src/ tests/
ruff format --check src/ tests/
- name: Run type checking with mypy
run: mypy src/ChemInformant --ignore-missing-imports --allow-untyped-defs --allow-incomplete-defs --no-strict-optional
- name: Run tests with coverage
env:
PYTHONPATH: ${{ github.workspace }}/src
run: pytest --cov=src/ChemInformant --cov-report=xml -v tests/
- name: Generate coverage badge
run: coverage-badge -o coverage.svg -f
- name: Deploy badge to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
publish_branch: gh-pages
keep_files: true
allow_empty_commit: false
commit_message: "Update coverage badge [skip ci]"