Skip to content

Commit 017b20c

Browse files
authored
Merge pull request #7 from itepifanio/clean-nb
Clean nb
2 parents a83ff73 + cbd8fd5 commit 017b20c

File tree

5 files changed

+24
-39
lines changed

5 files changed

+24
-39
lines changed

.github/workflows/lint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
run: |
2222
pip install -e .[dev]
2323
24+
- name: Check nbs are clean
25+
run: ./scripts/check_nbs_clean.sh
26+
shell: bash
27+
2428
- name: Run flake8
2529
run: nbqa flake8 nbs/*.ipynb
2630

.github/workflows/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Publish package to TestPypi
22

33
on:
4-
push:
5-
branches: ["main"]
4+
release:
5+
types: [published]
66
jobs:
77
publish:
88
runs-on: ubuntu-latest

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Tests
22
on: [workflow_dispatch, pull_request, push]
33

44
jobs:

nbs/06_hand.ipynb

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,7 @@
137137
"execution_count": null,
138138
"id": "8cabce32",
139139
"metadata": {},
140-
"outputs": [
141-
{
142-
"data": {
143-
"text/plain": [
144-
"Card(rank=1, suit='spades')"
145-
]
146-
},
147-
"execution_count": null,
148-
"metadata": {},
149-
"output_type": "execute_result"
150-
}
151-
],
140+
"outputs": [],
152141
"source": [
153142
"#| exec_doc\n",
154143
"#| code-fold: false\n",
@@ -171,18 +160,7 @@
171160
"execution_count": null,
172161
"id": "45aa3d73",
173162
"metadata": {},
174-
"outputs": [
175-
{
176-
"data": {
177-
"text/plain": [
178-
"[Card(rank=1, suit='spades')]"
179-
]
180-
},
181-
"execution_count": null,
182-
"metadata": {},
183-
"output_type": "execute_result"
184-
}
185-
],
163+
"outputs": [],
186164
"source": [
187165
"#| exec_doc\n",
188166
"[card for card in hand]"
@@ -193,18 +171,7 @@
193171
"execution_count": null,
194172
"id": "1b8584bd",
195173
"metadata": {},
196-
"outputs": [
197-
{
198-
"data": {
199-
"text/plain": [
200-
"0"
201-
]
202-
},
203-
"execution_count": null,
204-
"metadata": {},
205-
"output_type": "execute_result"
206-
}
207-
],
174+
"outputs": [],
208175
"source": [
209176
"#| exec_doc\n",
210177
"hand.discard() # type: ignore\n",

scripts/check_nbs_clean.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
#set -x
4+
5+
nbdev_clean --clear_all
6+
7+
GIT_STATUS_FAILED(){
8+
git status -uno -s |grep '.*\.ipynb'
9+
}
10+
11+
if GIT_STATUS_FAILED; then
12+
echo "!! ::error:: Detected notebooks that are not cleaned."
13+
false;
14+
fi

0 commit comments

Comments
 (0)