Repository navigation
108 lines (94 loc) · 3.42 KB
/
Copy pathtests.yml
File metadata and controls
108 lines (94 loc) · 3.42 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
name: Run fairgraph tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=119 --statistics
- name: Test with pytest
env:
# measure coverage with sys.monitoring, which is much faster than coverage's default tracer
COVERAGE_CORE: sysmon
run: |
# coverage is measured only with the Python version whose results are uploaded to Coveralls
pytest ${{ matrix.python-version == '3.14' && '--cov=fairgraph --cov-report=lcov' || '' }}
- name: Upload coverage to Coveralls
if: matrix.python-version == '3.14'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install black
run: |
python -m pip install --upgrade pip
pip install "black~=26.0"
- name: Check formatting with black
run: |
black --check --diff .
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
# same version as the ReadTheDocs build (.readthedocs.yaml)
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"
- name: Build documentation, treating warnings as errors
run: |
sphinx-build -W --keep-going -b html doc doc/_build/html
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build wheel
run: |
python -m pip install --upgrade pip build
python -m build --wheel --outdir dist .
- name: Install wheel in a clean environment
run: |
python -m venv "$RUNNER_TEMP/wheelenv"
"$RUNNER_TEMP/wheelenv/bin/pip" install dist/*.whl
- name: Import every module from the installed wheel
# run outside the checkout, in isolated mode, so that the source tree cannot be imported
working-directory: ${{ runner.temp }}
run: |
"$RUNNER_TEMP/wheelenv/bin/python" -I -c '
import importlib, pkgutil, fairgraph
print(fairgraph.__file__, fairgraph.__version__)
for m in pkgutil.walk_packages(fairgraph.__path__, "fairgraph."):
importlib.import_module(m.name)
'