-
Notifications
You must be signed in to change notification settings - Fork 3
162 lines (141 loc) · 4.69 KB
/
nbdev.yaml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: CI
on:
workflow_dispatch:
push:
branches: ["main", "master"]
pull_request:
jobs:
nbdev-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: settings.ini
- name: Test ibrary Sync
shell: bash
run: |
set -ux
python -m pip install --upgrade pip
pip install -U nbdev
echo "Check we are starting with clean git checkout"
if [[ `git status --porcelain -uno` ]]; then
git diff
echo "git status is not clean"
false
fi
echo "Trying to strip out notebooks"
nbdev_clean
echo "Check that strip out was unnecessary"
git status -s # display the status to see which nbs need cleaning up
if [[ `git status --porcelain -uno` ]]; then
git status -uno
echo -e "!!! Detected unstripped out notebooks\n!!!Remember to run nbdev_install_hooks"
echo -e "This error can also happen if you are using an older version of nbdev relative to what is in CI. Please try to upgrade nbdev with the command `pip install -U nbdev`"
false
fi
nbdev_export
if [[ `git status --porcelain -uno` ]]; then
echo "::error::Notebooks and library are not in sync. Please run nbdev_export."
git status -uno
git diff
exit 1;
fi
integration-tests:
needs: nbdev-sync
runs-on: ubuntu-latest
strategy:
matrix:
backend: [jax, torch, tf, hf]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: settings.ini
- name: Install Base Dependencies
run: |
pip install --upgrade pip
pip install -e .
pip install pytest
- name: Test JAX backend
if: ${{ matrix.backend == 'jax'}}
run: |
pytest integration_tests/jax_test.py
- name: Test Pytorch Dependencies
if: ${{ matrix.backend == 'torch'}}
run: |
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pytest integration_tests/torch_test.py
- name: Test Tensorflow Dependencies
if: ${{ matrix.backend == 'tf'}}
run: |
pip install -e .[tensorflow]
pytest integration_tests/tf_test.py
- name: Test Huggingface Dependencies
if: ${{ matrix.backend == 'hf'}}
run: |
pip install -e .[huggingface]
pytest integration_tests/hf_test.py
nbdev-tests:
needs: nbdev-sync
runs-on: ubuntu-latest
strategy:
matrix:
py: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
cache: "pip"
cache-dependency-path: settings.ini
- name: Install Library
run: |
pip install --upgrade pip
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install -e .[dev]
- name: Run Tests
run: nbdev_test
- name: test docs build
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && matrix.version == '3.9' && matrix.os == 'ubuntu' }}
run: |
set -ux
wget -q $(curl https://latest.fast.ai/pre/quarto-dev/quarto-cli/linux-amd64.deb)
sudo dpkg -i quarto*.deb
nbdev_mkdocs docs
if [ -f "_docs/index.html" ]; then
echo "docs built successfully."
else
echo "index page not found in rendered docs."
ls -la
ls -la _docs
exit 1
fi
# - name: Run Docs
# run: nbdev_mkdocs prepare
# - name: Install and Test Everything
# run: |
# pip install -e .[all]
# nbdev_test --flags "torch hf tf"
# - name: Install and Test Torch
# run: |
# pip install -e .[torch]
# nbdev_test --flags torch
# - name: Install and Test Huggingface
# run: |
# pip install -e .[huggingface]
# nbdev_test --flags hf
# - name: Install and Test Tensorflow
# run: |
# pip install -e .[tensorflow]
# nbdev_test --flags tf