From e3ed595248888a61f6e91ac16093e8cdf3cada67 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Mon, 30 Aug 2021 14:29:14 +0200 Subject: [PATCH] Add Github actions --- .github/workflows/build.yml | 214 ++++++++++++++++++++++++++++++++++++ bqplot_gl/__init__.py | 6 +- test-environment.yml | 23 ++++ 3 files changed, 240 insertions(+), 3 deletions(-) create mode 100644 test-environment.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e69de29..7cdb05d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/bqplot_gl/__init__.py b/bqplot_gl/__init__.py index e62fef9..a982643 100644 --- a/bqplot_gl/__init__.py +++ b/bqplot_gl/__init__.py @@ -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(): diff --git a/test-environment.yml b/test-environment.yml new file mode 100644 index 0000000..fb02c44 --- /dev/null +++ b/test-environment.yml @@ -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