This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 234
103 lines (88 loc) · 2.66 KB
/
main.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
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
name: CI
on:
workflow_dispatch: #allows repo admins to trigger this workflow from the Actions tab
pull_request:
push:
branches:
- master
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: see payload
run: |
echo "$PAYLOAD"
env:
PAYLOAD: ${{ toJSON(github.event) }}
- name: store payload
uses: actions/upload-artifact@v2
with:
name: payload.json
path: ${{ github.event_path }}
test-nbdev-sync:
runs-on: ubuntu-latest
container: fastdotai/fastai2 #this is defined here: https://github.com/fastai/docker-containers/blob/master/fastai2-build/Dockerfile
steps:
- name: checkout contents of PR
uses: actions/checkout@v2
- name: Install libraries
run: |
pip install -U nbdev
pip install -Ue .
- name: Attempt to read notebooks
run: |
nbdev_read_nbs
- name: Check if notebooks are clean
id: clean
run: |
nbdev_clean_nbs
if [ -n "$(git status -uno -s)" ]; then
echo "::error::Detected notebooks that are not cleaned."
echo "\n\nList of notebooks that are not clean:"
git status -s
exit 1;
fi
- name: Check that library syncs with notebooks
id: lib
run: |
nbdev_diff_nbs > _nbdev_diff_logs.txt
if [ -n "$(cat _nbdev_diff_logs.txt)" ]; then
echo "::error::Detected notebooks that are not in sync with the library."
cat _nbdev_diff_logs.txt
if [[ $auto_fix == 'true' ]]; then
nbdev_build_lib
fi
exit 1;
fi
test-notebooks:
container: fastdotai/fastai2
runs-on: ubuntu-latest
env:
download: "true"
caching: "true"
strategy:
matrix:
nb: ['[0-2]','[3-5]','[6-9]']
steps:
- name: checkout contents of PR
uses: actions/checkout@v2
- name: Install libraries
run: |
pip install -U nbdev
pip install -Ue .
- name: check for cache hit
uses: actions/cache@v2
if: env.caching == 'true'
id: cache
with:
path: ~/.fastai/data
key: 'fastai-test-data-v1'
- name: download data
if: env.download == 'true' && steps.cache.outputs.cache-hit != 'true'
run: |
python /workspace/download_testdata.py
mkdir -p $HOME/.fastai/data
find $HOME/.fastai/archive/ -name "*.tgz" -exec tar -xzvf {} -C $HOME/.fastai/data \;
- name: Test notebooks batch ${{matrix.nb}}
run: |
nbdev_test_nbs --flags '' --n_workers 4 --timing True --pause 0.5 --fname "nbs/[0-9]${{matrix.nb}}*.ipynb"