Skip to content

Commit

Permalink
Add dist test
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Jan 15, 2021
1 parent 94edd2f commit 6bfa3b7
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 11 deletions.
106 changes: 95 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- master

defaults:
run:
shell: bash -l {0}

jobs:
run:
runs-on: ${{ matrix.os }}
Expand All @@ -25,27 +29,23 @@ jobs:
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ipygany-dev
environment-file: dev_environment.yml
python-version: ${{ matrix.python-version }}
mamba-version: "*"
auto-activate-base: false
channels: conda-forge

- name: Mamba install dependencies
shell: bash -l {0}
run: mamba install python=${{ matrix.python-version }} pip yarn jupyterlab=3 ipywidgets>=7.6 vtk flake8 pytest ipydatawidgets

- name: Workaround pytest issue
shell: bash -l {0}
run: pip install pytest_tornasync

- name: Test flake8
shell: bash -l {0}
run: flake8 ipygany --ignore=E501

- name: Install ipygany
shell: bash -l {0}
run: pip install .

- name: Check installation files
shell: bash -l {0}
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/ipygany
test -f $CONDA_PREFIX/share/jupyter/nbextensions/ipygany/extension.js
Expand All @@ -54,20 +54,104 @@ jobs:
test -f $CONDA_PREFIX/share/jupyter/labextensions/ipygany/package.json
- name: Check nbextension and labextension
shell: bash -l {0}
run: |
jupyter nbextension list 2>&1 | grep -ie "ipygany/extension.*enabled" -
jupyter labextension list 2>&1 | grep -ie "ipygany.*enabled.*ok" -
- name: Run Python tests
shell: bash -l {0}
run: pytest tests

- name: Build docs (Only on MacOS for build speed)
shell: bash -l {0}
if: matrix.os == 'macos-latest'
run: |
mamba install sphinx sphinx_rtd_theme pygments==2.6.1 jupyter-sphinx meshpy pyvista
cd docs/source/
sphinx-build . _build/html
cd ../..
name: Build
build:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ipygany-dev
environment-file: dev_environment.yml
python-version: ${{ matrix.python-version }}
mamba-version: "*"
auto-activate-base: false
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

install:
runs-on: ${{ matrix.os }}-latest
needs: [build]

strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: ['3.6', '3.9']
include:
- python: '3.6'
dist: 'ipygany*.tar.gz'
- python: '3.9'
dist: 'ipygany*.whl'

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ipygany-dev
environment-file: dev_environment.yml
python-version: ${{ matrix.python-version }}
mamba-version: "*"
auto-activate-base: false
channels: conda-forge

- 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/ipygany
test -f $CONDA_PREFIX/share/jupyter/nbextensions/ipygany/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/ipygany/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/ipygany
test -f $CONDA_PREFIX/share/jupyter/labextensions/ipygany/package.json
test -d $CONDA_PREFIX/share/jupyter/labextensions/ipygany/static
- name: Validate the nbextension
run: jupyter nbextension list 2>&1 | grep "ipygany/extension"

- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep ipygany
12 changes: 12 additions & 0 deletions dev_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: ipygany-dev
channels:
- conda-forge
dependencies:
- pip
- yarn
- jupyterlab=3
- ipywidgets>=7.6
- vtk
- flake8
- pytest
- ipydatawidgets

0 comments on commit 6bfa3b7

Please # to comment.