Skip to content

Add python 3.12 testing #450

Add python 3.12 testing

Add python 3.12 testing #450

name: CI Example Notebooks
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- master
- release
pull_request:
branches:
- master
- release
- update-to-v*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
run_notebook:
runs-on: ubuntu-latest
strategy:
matrix:
notebook-file: [
"atari_deepRL_saliency.ipynb",
"DRISE.ipynb",
"MNIST_scikit_saliency.ipynb",
"OcclusionSaliency.ipynb",
"Radial_Image_Perturbation.ipynb",
"SimilarityScoring.ipynb",
"SuperPixelSaliency.ipynb",
"VIAME_OcclusionSaliency.ipynb",
"SerializedDetectionSaliency.ipynb",
# Model comparison example is excluded due to computational complexity
#"ModelComparisonWithSaliency.ipynb",
]
# We want all python versions tested even if one of them happens to fail
fail-fast: false
# Just one python version, using our base supported version.
container:
image: python:3.8
options: "--shm-size 2GB"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Cache local python environment artifacts for the current python version
# and poetry lockfile hash.
- uses: actions/cache@v2
id: env-cache
with:
# * Confirmed that the `.local` directory doesn't exist until the
# `pip install --user` is invoked below, so we can be confident
# that only our python stuff is being captured in this cache
# (intentional).
# * *Not* caching the actual virtualenv, just the cached packages for
# installation -- Some packages used in examples have very large
# installation sizes which does not compliment well our limited
# cache GB allowance.
path: |
~/.cache/pypoetry/artifacts/
~/.cache/pypoetry/cache/
~/.local
# Using a different key due to additional things the notebook
# examples ad-hoc install.
key: python-3.8-${{ hashFiles('poetry.lock') }}-Examples
restore-keys: |
python-3.8-${{ hashFiles('poetry.lock') }}
- name: Setup Environment
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-a-public-action-in-a-subdirectory
uses: Kitware/SMQTK-Core/.github/actions/python-poetry-setup@master
- name: Install additional example extras requirements
run: poetry install -E example_deps
- uses: actions/cache@v2
id: notebook-data-cache
with:
path: |
~/.cache/torch/
examples/data/
key: python-3.8-${{ hashFiles('poetry.lock') }}-ExampleData-${{ matrix.notebook-file }}
# pretty unique, no restore-keys.
- name: Run Notebook
env:
NOTEBOOK_FILENAME: ${{ matrix.notebook-file }}
run: |
cd examples
poetry run papermill \
--progress-bar \
-k python3 \
--stdout-file - --stderr-file - \
"${NOTEBOOK_FILENAME}" /dev/null