Skip to content

Tests

Tests #561

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@v2
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-name: ipympl-dev
environment-file: dev-environment.yml
channels: conda-forge
- name: Build packages
run: |
python setup.py sdist bdist_wheel
cd dist
sha256sum * | tee SHA256SUMS
- name: Upload builds
uses: actions/upload-artifact@v2
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.10', '3.9']
mpl-version: ['3.5', 'latest']
include:
- python: '3.10'
dist: 'ipympl*.tar.gz'
- python: '3.9'
dist: 'ipympl*.whl'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-name: ipympl-dev
environment-file: dev-environment.yml
channels: conda-forge
extra-specs: |
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@v2
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: |
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
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 nbextension
run: jupyter nbextension list 2>&1 | grep "jupyter-matplotlib/extension"
- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib
- name: Run pytest
run: pytest .
- name: Install Galata test dependencies
if: matrix.os == 'ubuntu'
run: |
yarn install
yarn playwright install chromium
working-directory: ui-tests
- name: Launch JupyterLab
if: matrix.os == 'ubuntu'
run: yarn run start:detached
working-directory: ui-tests
- name: Wait for JupyterLab
if: matrix.os == 'ubuntu'
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8888/api
timeout: 20000
- name: Run UI Tests
if: matrix.os == 'ubuntu'
run: yarn run test
working-directory: ui-tests
- name: Upload UI Test artifacts
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@v2
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 }}
MATPLOLIBT: ${{ 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