forked from PyDMD/PyDMD
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (73 loc) · 2.6 KB
/
export_tutorials.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
name: "Export tutorials"
on:
push:
branches:
- master
paths:
- 'tutorials/**/*.ipynb'
jobs:
export_tutorials:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install .[test]
python3 -m pip install .
# Dependencies for tutorials
python3 -m pip install jupyter pandas ezyrb opencv-python ffmpeg-python black[jupyter]
- uses: actions/cache@v2
id: cache-segtrackv2
with:
path: ./tutorials/tutorial12/SegTrackv2
key: SegTrackv2-key
# This is needed for tutorial12
- name: Download SegTrackv2
if: steps.cache-segtrackv2.outputs.cache-hit != 'true'
run: |
curl https://web.engr.oregonstate.edu/~lif/SegTrack2/SegTrackv2.zip --output SegTrackv2.zip
unzip -qq SegTrackv2.zip
mv SegTrackv2 tutorials/tutorial12
- name: Setup FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
- id: files
uses: jitterbit/get-changed-files@v1
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Convert tutorials
run: |
for file in ${{ steps.files.outputs.all }}; do
if [[ $file == *tutorial-5* ]]; then
echo "Skipped $file"
elif [[ $file == *.ipynb ]]; then
filename=$(basename $file)
pyfilename=$(echo ${filename%?????})py
jupyter nbconvert --execute $file --to python --output $pyfilename
htmlfilename=$(echo ${filename%?????} | sed -e 's/-//g')html
jupyter nbconvert --execute $file --to html --output $htmlfilename --output-dir=docs/source/_tutorials
fi
done
- name: Run formatter
run: black tutorials/
- uses: benjlevesque/[email protected]
id: short-sha
- name: Remove unwanted files
run: |
rm -rf build/
rm -rf tutorials/tutorial12/SegTrackv2/
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
labels: maintenance
title: Export tutorial changed in ${{ steps.short-sha.outputs.sha }}
branch: export-tutorial-${{ steps.short-sha.outputs.sha }}
commit-message: export tutorials changed in ${{ steps.short-sha.outputs.sha }}
delete-branch: true