-
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (146 loc) · 6.28 KB
/
open_in_cloud.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
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
name: "Update notebooks for cloud environments"
on:
push:
branches:
- "**"
- "!gh-pages"
- "!open-in-colab"
- "!open-in-kaggle"
pull_request:
branches:
- main
schedule:
- cron: "0 4 * * MON"
workflow_dispatch:
inputs:
branch:
description: "Branch on viskex repository"
type: string
jobs:
open_in_colab:
strategy:
matrix:
include:
- backend: dolfinx
fem_on_colab_packages: |
gmsh@current%dolfinx.io
fenicsx==real@current$dolfinx
notebook_pattern: |
"**/tutorial_*_dolfinx.ipynb"
- backend: firedrake
fem_on_colab_packages: |
ngsolve==real@current%netgen
firedrake==real@current
notebook_pattern: |
"**/tutorial_*_firedrake*.ipynb"
fail-fast: false
uses: fem-on-colab/open-in-colab-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_colab
notebook_pattern: ${{ matrix.notebook_pattern }}
notebook_preparation: |
BRANCH="${{ (inputs || github.event.inputs).branch }}"
if [ -z "${BRANCH}" ]; then
BRANCH=main
fi
BACKEND="${{ matrix.backend }}"
NOTEBOOK_PATTERN="${{ matrix.notebook_pattern }}"
python3 -m pip install --no-dependencies nbvalx simpleeval
git clone https://github.com/viskex/viskex.git
cd viskex
git checkout ${BRANCH}
NO_TESTS_COLLECTED=5
python3 -m pytest --ipynb-action=create-notebooks --tag-collapse --work-dir=.ipynb_colab tutorials || (($?==$NO_TESTS_COLLECTED))
find tutorials -type d -name .ipynb_colab -exec rsync -avz --remove-source-files --include="*.ipynb" --exclude="*" {}/ {}/.. \;
NOTEBOOKS_TO_PATCH=""
while read -r PATTERN; do
NOTEBOOKS_TO_PATCH="${NOTEBOOKS_TO_PATCH} $(find tutorials -wholename $(echo ${PATTERN} | sed 's|\"||g'))"
done <<< $(printf "%s" "${NOTEBOOK_PATTERN}")
python3 ../share/open_in_cloud/replace_common.py ${BRANCH} ${NOTEBOOKS_TO_PATCH}
NOTEBOOKS_TO_INCLUDE=""
while read -r PATTERN; do
NOTEBOOKS_TO_INCLUDE="${NOTEBOOKS_TO_INCLUDE} --include=$(echo ${PATTERN} | sed 's|\"||g')"
done <<< $(printf "%s" "${NOTEBOOK_PATTERN}")
rsync -avz --delete --include "*/" ${NOTEBOOKS_TO_INCLUDE} --exclude="*" tutorials ../open_in_colab/
fem_on_colab_packages: ${{ matrix.fem_on_colab_packages }}
pip_packages: |
viskex@https://github.com/viskex/viskex.git@current
test_script: |
apt install -y -qq xvfb
export DISPLAY=":99"
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
NOTEBOOKS_TO_TEST=""
while read -r PATTERN; do
NOTEBOOKS_TO_TEST="${NOTEBOOKS_TO_TEST} $(find open_in_colab -wholename $(echo ${PATTERN} | sed 's|\"||g'))"
done <<< $(printf "%s" "${{ matrix.notebook_pattern }}")
python3 -m pytest --nbval ${NOTEBOOKS_TO_TEST}
publish_on: github@viskex/viskex.github.io@open-in-colab
publish_if_repository: viskex/viskex.github.io
open_in_kaggle:
strategy:
matrix:
include:
- backend: dolfinx
fem_on_kaggle_packages: |
gmsh@current%dolfinx.io
fenicsx==real@current$dolfinx
notebook_pattern: |
"**/tutorial_*_dolfinx.ipynb"
- backend: firedrake
fem_on_kaggle_packages: |
ngsolve==real@current%netgen
firedrake==real@current
notebook_pattern: |
"**/tutorial_*_firedrake*.ipynb"
fail-fast: false
uses: fem-on-kaggle/open-in-kaggle-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_kaggle
notebook_pattern: ${{ matrix.notebook_pattern }}
notebook_preparation: |
BRANCH="${{ (inputs || github.event.inputs).branch }}"
if [ -z "${BRANCH}" ]; then
BRANCH=main
fi
BACKEND="${{ matrix.backend }}"
NOTEBOOK_PATTERN="${{ matrix.notebook_pattern }}"
python3 -m pip install --no-dependencies nbvalx simpleeval
git clone https://github.com/viskex/viskex.git
cd viskex
git checkout ${BRANCH}
NO_TESTS_COLLECTED=5
python3 -m pytest --ipynb-action=create-notebooks --tag-collapse --work-dir=.ipynb_kaggle tutorials || (($?==$NO_TESTS_COLLECTED))
find tutorials -type d -name .ipynb_kaggle -exec rsync -avz --remove-source-files --include="*.ipynb" --exclude="*" {}/ {}/.. \;
NOTEBOOKS_TO_PATCH=""
while read -r PATTERN; do
NOTEBOOKS_TO_PATCH="${NOTEBOOKS_TO_PATCH} $(find tutorials -wholename $(echo ${PATTERN} | sed 's|\"||g'))"
done <<< $(printf "%s" "${NOTEBOOK_PATTERN}")
python3 ../share/open_in_cloud/replace_common.py ${BRANCH} ${NOTEBOOKS_TO_PATCH}
NOTEBOOKS_TO_INCLUDE=""
while read -r PATTERN; do
NOTEBOOKS_TO_INCLUDE="${NOTEBOOKS_TO_INCLUDE} --include=$(echo ${PATTERN} | sed 's|\"||g')"
done <<< $(printf "%s" "${NOTEBOOK_PATTERN}")
rsync -avz --delete --include "*/" ${NOTEBOOKS_TO_INCLUDE} --exclude="*" tutorials ../open_in_kaggle/
fem_on_kaggle_packages: ${{ matrix.fem_on_kaggle_packages }}
pip_packages: |
viskex@https://github.com/viskex/viskex.git@current
test_script: |
apt install -y -qq xvfb
export DISPLAY=":99"
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
NOTEBOOKS_TO_TEST=""
while read -r PATTERN; do
NOTEBOOKS_TO_TEST="${NOTEBOOKS_TO_TEST} $(find open_in_kaggle -wholename $(echo ${PATTERN} | sed 's|\"||g'))"
done <<< $(printf "%s" "${{ matrix.notebook_pattern }}")
python3 -m pytest --nbval ${NOTEBOOKS_TO_TEST}
publish_on: github@viskex/viskex.github.io@open-in-kaggle
publish_if_repository: viskex/viskex.github.io
warn:
runs-on: ubuntu-latest
if: github.repository == 'viskex/viskex.github.io' && github.ref == 'refs/heads/main' && github.event_name == 'schedule'
steps:
- name: Warn if scheduled workflow is about to be disabled
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main
with:
workflow-filename: open_in_cloud.yml
days-elapsed: 50