Skip to content

Jupyter notebook support #675

Jupyter notebook support

Jupyter notebook support #675

Workflow file for this run

name: Build neoscore
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
defaults:
run:
shell: bash
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
timeout-minutes: 30
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.7'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
# Poetry seems to have dropped official support for Python 3.7
# but we need it for PyQt build artifacts. Pin poetry version.
# See https://github.com/snok/install-poetry/issues/131
# and https://github.com/python-poetry/poetry/pull/7674
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install python dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install non-python dependencies, specific to OS
#----------------------------------------------
- name: Install non-python dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install graphviz
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install graphviz
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install graphviz --no-progress
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
#----------------------------------------------
# install root project
#----------------------------------------------
- name: Install neoscore
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
pytest -n auto
shell: bash
env:
NEOSCORE_HEADLESS: True
- name: Check formatting conforms to Black
uses: psf/black@23.3.0
if: matrix.platform == 'ubuntu-latest'
- name: Check import sorting with isort
if: matrix.platform == 'ubuntu-latest'
run: |
source .venv/bin/activate
pip install isort
isort .
- name: Check for unused imports with unimport
if: matrix.platform == 'ubuntu-latest'
run: |
source .venv/bin/activate
pip install unimport
unimport --check --exclude "neoscore/common.py|.venv"
- name: Build docs site
working-directory: doc
env:
NEOSCORE_HEADLESS: True
SPHINXOPTS: -T # Log traceback on sphinx errors
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
source ../.venv/Scripts/activate
./make.bat html
else
source ../.venv/bin/activate
make html
fi
shell: bash