Skip to content

Tests

Tests #619

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 12 * * 1" # monday at noon UTC
defaults:
run:
shell: bash -l {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: dev-environment.yml
- name: Build packages
run: |
python -m build
cd dist
sha256sum * | tee SHA256SUMS
- name: Upload builds
uses: actions/upload-artifact@v3
with:
name: dist ${{ github.run_number }}
path: ./dist
Test:
runs-on: ${{ matrix.os }}-latest
needs: [build]
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
python: ['3.9', '3.12']
mpl-version: ['latest']
dist: ['ipympl*.whl']
include:
# Earliest supported Matplotlib, needs python <= 3.10
- os: ubuntu
python: '3.9'
mpl-version: '3.5'
dist: 'ipympl*.whl'
# Install from sdist not wheel
- os: ubuntu
python: '3.11'
mpl-version: 'latest'
dist: 'ipympl*.tar.gz'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: dev-environment.yml
create-args: >-
python=${{ matrix.python }}
- if: matrix.mpl-version == 'latest'
name: Install latest Matplotlib
run: pip install --upgrade --pre --index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple --extra-index-url https://pypi.org/simple matplotlib
- if: matrix.mpl-version != 'latest'
name: Install matplotlib pinned
run: micromamba install matplotlib=${{ matrix.mpl-version}}.*
- uses: actions/download-artifact@v3
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Install the package
run: |
cd dist
pip install -vv ${{ matrix.dist }}
- name: Test installation files
run: |
ls -l $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib
test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/index.js
ls -l $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib
test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib/package.json
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib/static
- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib
- name: Run pytest
run: pytest -v .
- name: Install Galata test dependencies
if: matrix.os == 'ubuntu'
run: |
jlpm install
jlpm playwright install chromium
working-directory: ui-tests
- name: Run UI Tests
if: matrix.os == 'ubuntu'
run: jlpm playwright test
working-directory: ui-tests
- name: Upload UI Test artifacts
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@v3
with:
name: ui-test-output
path: |
ui-tests/playwright-report
ui-tests/test-results
# If something goes wrong for the latests test cron job
# then open an issue in the repo
# This setup based on:
# https://github.com/pymmcore-plus/pymmcore-widgets/blob/5e233384e223ca00101ef4b741d3c525a5cff9c9/.github/workflows/cron.yml#L49
- name: Report Failures
if: failure() && github.event_name == 'schedule'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
MATPLOTLIB: ${{ matrix.mpl-version }}
RUN_ID: ${{ github.run_id }}
TITLE: '[test-bot] Scheduled Tests are failing'
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true