Update notebooks for cloud environments #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 * * SUN" | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Branch on multiphenicsx 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 nbvalx simpleeval | |
git clone https://github.com/multiphenics/multiphenicsx.git | |
cd multiphenicsx | |
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="*" {}/ {}/.. \; | |
rsync -avz --delete --include "*/" --include="*.ipynb" --exclude="*" tutorials ../open_in_colab/ | |
fem_on_colab_packages: | | |
gmsh@current | |
fenicsx==real@current$dolfinx | |
pip_packages: | | |
viskex@https://github.com/viskex/viskex.git@current%multiphenicsx | |
multiphenicsx@https://github.com/multiphenics/multiphenicsx.git@current£--check-build-dependencies --no-build-isolation | |
test_script: | | |
apt install -y -qq xvfb | |
export DISPLAY=":99" | |
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 & | |
python3 -m pytest --nbval open_in_colab/tutorials | |
publish_on: github@multiphenics/multiphenics.github.io@open-in-colab | |
publish_if_repository: multiphenics/multiphenics.github.io | |
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 nbvalx simpleeval | |
git clone https://github.com/multiphenics/multiphenicsx.git | |
cd multiphenicsx | |
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="*" {}/ {}/.. \; | |
rsync -avz --delete --include "*/" --include="*.ipynb" --exclude="*" tutorials ../open_in_kaggle/ | |
fem_on_kaggle_packages: | | |
gmsh@current | |
fenicsx==real@current$dolfinx | |
pip_packages: | | |
viskex@https://github.com/viskex/viskex.git@current%multiphenicsx | |
multiphenicsx@https://github.com/multiphenics/multiphenicsx.git@current£--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 | |
test_script: | | |
apt install -y -qq xvfb | |
export DISPLAY=":99" | |
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 & | |
python3 -m pytest --nbval open_in_kaggle/tutorials | |
publish_on: github@multiphenics/multiphenics.github.io@open-in-kaggle | |
publish_if_repository: multiphenics/multiphenics.github.io | |
warn: | |
runs-on: ubuntu-latest | |
if: github.repository == 'multiphenics/multiphenics.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 |