Skip to content

Commit

Permalink
Add Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Aug 30, 2021
1 parent 6a11e4c commit e3ed595
Show file tree
Hide file tree
Showing 3 changed files with 240 additions and 3 deletions.
214 changes: 214 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: '*'

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

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

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Checkout
uses: actions/checkout@v2
with:
repository: 'martinRenou/bqplot'
ref: 'get_rid_webgl'
path: 'bqplot'

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

- name: Install bqplot
run: pip install .
working-directory: bqplot

- name: Yarn build bqplot
run: |
yarn install
yarn run build
working-directory: bqplot/js

- name: Yarn install bqplot-gl
run: yarn install

- name: Patch node_modules/bqplot
run: |
rm -rf bqplot
ln -s $GITHUB_WORKSPACE/bqplot/js bqplot
ls bqplot
working-directory: node_modules

- name: Yarn build
run: yarn run build

- name: Install bqplot-gl
run: pip install .

- name: Test installation files
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl
test -f $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl
test -f $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl/package.json
test -d $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl/static
- name: Validate the nbextension
run: jupyter nbextension list 2>&1 | grep "bqplot-gl/extension"

- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep bqplot-gl

- name: Python PEP8 check
run: flake8 bqplot_gl --ignore=E501,W504,W503

- name: JavaScript prettyfier
run: yarn run prettier:check

# - name: JavaScript tests
# run: yarn run test
# working-directory: js

- name: Build Python package
run: |
python setup.py sdist bdist_wheel
cd dist
sha256sum * | tee SHA256SUMS
- name: Pack JavaScript package
run: |
yarn pack
mv bqplot*.tgz ../dist
- name: Upload builds
uses: actions/upload-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist

# visual-regression-tests:
# runs-on: ubuntu-latest
# needs: [build]

# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Setup conda
# uses: conda-incubator/setup-miniconda@v2
# with:
# activate-environment: bqplot-test
# environment-file: test-environment.yml
# python-version: 3.9
# 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: pip install -vv bqplot*.whl
# working-directory: dist

# - name: Install Galata
# run: yarn install
# working-directory: ui-tests

# - name: Launch JupyterLab
# run: yarn run start-jlab:detached
# working-directory: ui-tests

# - name: Wait for JupyterLab
# uses: ifaxity/wait-on-action@v1
# with:
# resource: http-get://localhost:8888/api
# timeout: 20000

# - name: Run UI Tests
# run: yarn run test
# working-directory: ui-tests

# - name: Upload UI Test artifacts
# if: always()
# uses: actions/upload-artifact@v2
# with:
# name: ui-test-output
# path: ui-tests/test-output

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: 'bqplot*.tar.gz'
- python: '3.9'
dist: 'bqplot*.whl'

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: bqplot-gl-test
environment-file: test-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/bqplot-gl
test -f $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl
test -f $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl/package.json
test -d $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl/static
- name: Validate the nbextension
run: jupyter nbextension list 2>&1 | grep "bqplot-gl/extension"

- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep bqplot-gl
6 changes: 3 additions & 3 deletions bqplot_gl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# Copyright (c) The bqplot Development Team.
# Distributed under the terms of the Modified BSD License.

from .figure import FigureGL
from .marks import *
from ._version import __version__, version_info
from .figure import FigureGL # noqa
from .marks import * # noqa
from ._version import __version__, version_info # noqa


def _jupyter_labextension_paths():
Expand Down
23 changes: 23 additions & 0 deletions test-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: bqplot-gl-test
channels:
- conda-forge
dependencies:
- pip
- python
- yarn
- ipywidgets >=5.2.2
- traitlets >=4.3.0
- traittypes >=0.0.6
- numpy >=1.10.4,<2.0.0
- pandas >=1.0.0,<2.0.0
- bqscales >=0.2.2,<0.3
- scipy
- jupyter
- jupyterlab=3.0.11 # to build the lab federated bundle
- jupyter-packaging # to build the wheel
- pytest
- nbval
- pytest-cov
- selenium
- flake8
- nose

0 comments on commit e3ed595

Please sign in to comment.