forked from networkx/nx-guides
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (60 loc) · 2.03 KB
/
notebooks.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
name: Testing notebooks
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 5 * * 1'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
matrix:
os: [Ubuntu-22.04, macOS-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Before install
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update
sudo apt-get install graphviz graphviz-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install graphviz pkg-config
fi
python3 -m venv ~/venv
source ~/venv/bin/activate
- name: Install dependencies
run: |
pip install -U pip
pip install -r requirements.txt
if [ "$RUNNER_OS" == "macOS" ]; then
pip install --config-settings="--global-option=build_ext" \
--config-settings="--global-option=-I$(brew --prefix graphviz)/include/" \
--config-settings="--global-option=-L$(brew --prefix graphviz)/lib/" \
pygraphviz
elif [ "$RUNNER_OS" == "Linux" ]; then
pip install pygraphviz
fi
- name: Lint with precommit
run: |
pip install pre-commit
find content/ -name "*.md" -exec jupytext --to notebook {} \;
# pre-commit wants files to be staged
find content/ -name "*.ipynb" -exec git add {} \;
pre-commit run --all-files --show-diff-on-failure --color always
- name: Test with nbval
run: |
find content/algorithms content/generators -name "*.md" -exec jupytext --to notebook {} \;
find content/algorithms content/generators -name "*.ipynb" -print
pip install pytest
pytest --nbval-lax --durations=25 content/algorithms content/generators