Skip to content

Update notebooks for cloud environments #98

Update notebooks for cloud environments

Update notebooks for cloud environments #98

Workflow file for this run

name: "Update notebooks for cloud environments"
on:
push:
branches:
- "**"
- "!gh-pages"
- "!open-in-colab-rbnicsx"
- "!open-in-kaggle-rbnicsx"
pull_request:
branches:
- main
schedule:
- cron: "0 3 * * SUN"
workflow_dispatch:
inputs:
branch:
description: "Branch on RBniCSx repository"
type: string
jobs:
open_in_colab:
uses: fem-on-colab/open-in-colab-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_colab
notebook_pattern: "**/*.ipynb"
notebook_preparation: |
python3 -m pip install --no-dependencies git+https://github.com/multiphenics/nbvalx.git
git clone https://github.com/RBniCS/RBniCSx.git
cd RBniCSx
if [ -n "${{ (inputs || github.event.inputs).branch }}" ]; then
git checkout "${{ (inputs || github.event.inputs).branch }}"
fi
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="*" {}/ {}/.. \;
TUTORIAL_PREFIXES=($(find tutorials -type f -name "*.ipynb" -and -not -ipath "*[*" -exec basename {} ".ipynb" \;))
for TUTORIAL_PREFIX in "${TUTORIAL_PREFIXES[@]}"; do
TUTORIALS_WITH_PREFIX=($(find tutorials -type f -name "${TUTORIAL_PREFIX}*.ipynb"))
if [ "${#TUTORIALS_WITH_PREFIX[@]}" -gt "1" ]; then
rm tutorials/${TUTORIAL_PREFIX}.ipynb
fi
done
rsync -avz --delete --include "*/" --include="*.ipynb" --exclude="*" tutorials ../open_in_colab/
fem_on_colab_packages: |
gmsh@current
fenicsx==real@current$dolfinx
pip_packages: |
multiphenicsx@https://github.com/multiphenics/multiphenicsx.git@current%rbnicsx£--check-build-dependencies --no-build-isolation
ufl4rom@https://github.com/RBniCS/ufl4rom.git@current%rbnicsx
viskex@https://github.com/viskex/viskex.git@current%rbnicsx
rbnicsx@https://github.com/RBniCS/RBniCSx.git@current£--check-build-dependencies --no-build-isolation
test_script: |
apt install -y -qq libgl1-mesa-glx xvfb
export DISPLAY=":99"
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
python3 -m pytest --nbval open_in_colab/tutorials
publish_on: github@RBniCS/rbnicsproject.org@open-in-colab-rbnicsx
publish_if_repository: RBniCS/rbnicsproject.org
open_in_kaggle:
uses: fem-on-kaggle/open-in-kaggle-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_kaggle
notebook_pattern: "**/*.ipynb"
notebook_preparation: |
python3 -m pip install --no-dependencies git+https://github.com/multiphenics/nbvalx.git
git clone https://github.com/RBniCS/RBniCSx.git
cd RBniCSx
if [ -n "${{ (inputs || github.event.inputs).branch }}" ]; then
git checkout "${{ (inputs || github.event.inputs).branch }}"
fi
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="*" {}/ {}/.. \;
TUTORIAL_PREFIXES=($(find tutorials -type f -name "*.ipynb" -and -not -ipath "*[*" -exec basename {} ".ipynb" \;))
for TUTORIAL_PREFIX in "${TUTORIAL_PREFIXES[@]}"; do
TUTORIALS_WITH_PREFIX=($(find tutorials -type f -name "${TUTORIAL_PREFIX}*.ipynb"))
if [ "${#TUTORIALS_WITH_PREFIX[@]}" -gt "1" ]; then
rm tutorials/${TUTORIAL_PREFIX}.ipynb
fi
done
rsync -avz --delete --include "*/" --include="*.ipynb" --exclude="*" tutorials ../open_in_kaggle/
fem_on_kaggle_packages: |
gmsh@current
fenicsx==real@current$dolfinx
pip_packages: |
multiphenicsx@https://github.com/multiphenics/multiphenicsx.git@current%rbnicsx£--check-build-dependencies --no-build-isolation --config-settings=cmake.define.CMAKE_PREFIX_PATH=${INSTALL_PREFIX}€apt update -y -q && apt install -y -qq software-properties-common wget && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ focal main" && apt install --upgrade -y cmake
ufl4rom@https://github.com/RBniCS/ufl4rom.git@current%rbnicsx
viskex@https://github.com/viskex/viskex.git@current%rbnicsx
rbnicsx@https://github.com/RBniCS/RBniCSx.git@current£--check-build-dependencies --no-build-isolation€export PETSC_DIR=${INSTALL_PREFIX}
test_script: |
apt install -y -qq libgl1-mesa-glx xvfb
export DISPLAY=":99"
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
python3 -m pytest --nbval open_in_kaggle/tutorials
publish_on: github@RBniCS/rbnicsproject.org@open-in-kaggle-rbnicsx
publish_if_repository: RBniCS/rbnicsproject.org
warn:
runs-on: ubuntu-latest
if: github.repository == 'RBniCS/rbnicsproject.org' && 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