diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8983a1f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,84 @@ +name: Build + +on: + push: + branches: master + pull_request: + branches: '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install node + uses: actions/setup-node@v2 + with: + node-version: '12.x' + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + architecture: 'x64' + + - name: Setup pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: pip-3.7-${{ hashFiles('package.json') }} + restore-keys: | + pip-3.7- + pip- + + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: | + python -m pip install -U pip setuptools cookiecutter + + - name: Test the extension + # env: + # CHROME_BIN: chromium-browser + run: | + cookiecutter . --config-file tests/testconfig.yaml --no-input + pushd jupyter-widget-testwidgets + python -m pip install --upgrade -v -e ".[test, examples, docs]" + npm run lint:check + + # TODO: re-enable tests + # pytest + # npm run test:ci + + # - name: Check docs can be build + links + # run: | + # pushd jupyter-widget-testwidgets/docs + # make html + # make linkcheck + # popd + + - name: Make a non-local install so the data_files get populated + run: | + pip uninstall -y jupyter_widget_testwidgets + cd jupyter-widget-testwidgets + pip install . + jupyter nbextension enable --py --sys-prefix jupyter_widget_testwidgets + # Validate nbextension (enable does not use exit code): + python -c "from notebook.nbextensions import validate_nbextension; import sys; sys.exit(validate_nbextension('jupyter_widget_testwidgets/extension') or 0)" + pip install jupyterlab + # Make sure our lab extension was installed. + jupyter labextension list 2>&1 | grep -ie "jupyter-widget-testwidgets.*OK" + # Make sure our lab extension can be linked. + jupyter labextension link diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 12b1f62..0000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -language: python -dist: xenial -services: - - xvfb -python: - - 3.7 -sudo: false -addons: - apt_packages: - - pandoc -cache: - pip: true - directories: - - $HOME/.npm -before_install: - - pip install -U pip setuptools - - nvm install 12 - - pip install cookiecutter -install: - - pushd $(mktemp -d) - - cookiecutter $TRAVIS_BUILD_DIR --config-file $TRAVIS_BUILD_DIR/tests/testconfig.yaml --no-input - - pushd jupyter-widget-testwidgets - - pip install --upgrade -v -e ".[test, examples, docs]" -before_script: - - | - export CHROME_BIN=chromium-browser -script: - - py.test - - npm test - - npm run lint:check - # Check docs can be build + links - - pushd docs - - make html - - make linkcheck - - popd - # Make a non-local install so the data_files get populated - - pip uninstall -y jupyter_widget_testwidgets - - pip install . - - jupyter nbextension enable --py --sys-prefix jupyter_widget_testwidgets - # Validate nbextension (enable does not use exit code): - - python -c "from notebook.nbextensions import validate_nbextension; import sys; sys.exit(validate_nbextension('jupyter_widget_testwidgets/extension') or 0)" - - pip install jupyterlab - # Make sure our lab extension was installed. - - jupyter labextension list - - jupyter labextension list 2>&1 | grep -q jupyter-widget-testwidgets - # Make sure our lab extension can be linked. - - jupyter labextension link - - popd - - popd diff --git a/cookiecutter.json b/cookiecutter.json index 2abbb4d..60e6490 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -6,5 +6,8 @@ "python_package_name": "{{ cookiecutter.github_project_name | replace('-', '_') }}", "npm_package_name": "{{ cookiecutter.github_project_name }}", "npm_package_version": "0.1.0", - "project_short_description": "A Custom Jupyter Widget Library" + "project_short_description": "A Custom Jupyter Widget Library", + "_copy_without_render": [ + ".github/workflows/*" + ] } diff --git a/{{cookiecutter.github_project_name}}/.github/workflows/build.yml b/{{cookiecutter.github_project_name}}/.github/workflows/build.yml new file mode 100644 index 0000000..da220bd --- /dev/null +++ b/{{cookiecutter.github_project_name}}/.github/workflows/build.yml @@ -0,0 +1,62 @@ +name: Build + +on: + push: + branches: main + pull_request: + branches: '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + architecture: 'x64' + + - name: Setup pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: pip-3.7-${{ hashFiles('package.json') }} + restore-keys: | + pip-3.7- + pip- + + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: | + python -m pip install -U pip setuptools codecov + npm install -g codecov + - name: Test the extension + run: | + python -m pip install --upgrade -v -e ".[test, examples, docs]" + npm run lint:check + pytest + npm run test:ci + - name: Check docs can be build + links + run: | + pushd docs + make html + make linkcheck + popd + python -m pytest_check_links --links-ext=.md -o testpaths=. -o addopts= + \ No newline at end of file diff --git a/{{cookiecutter.github_project_name}}/.travis.yml b/{{cookiecutter.github_project_name}}/.travis.yml deleted file mode 100644 index a6fd7fd..0000000 --- a/{{cookiecutter.github_project_name}}/.travis.yml +++ /dev/null @@ -1,74 +0,0 @@ -language: python -python: - - 3.7 - - 3.6 - - 3.5 -sudo: false -dist: xenial -services: - - xvfb -addons: - apt_packages: - - pandoc -env: - matrix: - - GROUP=python -matrix: - include: - - python: 3.5 - env: GROUP=js - include: - - python: 3.6 - env: GROUP=docs -cache: - pip: true - directories: - - node_modules # NPM packages - - $HOME/.npm -before_install: - - pip install -U pip setuptools - - nvm install 12 - - | - if [[ $GROUP == python ]]; then - pip install codecov - elif [[ $GROUP == js ]]; then - npm install -g codecov - fi -install: - - | - if [[ $GROUP == python ]]; then - pip install --upgrade ".[test]" -v - elif [[ $GROUP == js ]]; then - pip install --upgrade -e ".[test]" -v - elif [[ $GROUP == docs ]]; then - pip install --upgrade ".[test, examples, docs]" -v - fi -before_script: - # Set up a virtual screen for Firefox browser testing: - - | - if [[ $GROUP == js ]]; then - export CHROME_BIN=chromium-browser - fi - git config --global user.email travis@fake.com - git config --global user.name "Travis CI" -script: - - | - if [[ $GROUP == python ]]; then - EXIT_STATUS=0 - pushd $(mktemp -d) - py.test -l --cov-report xml:$TRAVIS_BUILD_DIR/coverage.xml --cov={{ cookiecutter.python_package_name }} --pyargs {{ cookiecutter.python_package_name }} || EXIT_STATUS=$? - popd - (exit $EXIT_STATUS) - elif [[ $GROUP == js ]]; then - npm test - elif [[ $GROUP == docs ]]; then - EXIT_STATUS=0 - cd docs - make html || EXIT_STATUS=$? - make linkcheck || EXIT_STATUS=$? - cd .. - python -m pytest_check_links --links-ext=.md -o testpaths=. -o addopts= || EXIT_STATUS=$? - (exit $EXIT_STATUS) - fi -after_success: - - codecov diff --git a/{{cookiecutter.github_project_name}}/appveyor.yml b/{{cookiecutter.github_project_name}}/appveyor.yml deleted file mode 100644 index f39291f..0000000 --- a/{{cookiecutter.github_project_name}}/appveyor.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Do not build feature branch with open Pull Requests -skip_branch_with_pr: true - -# environment variables -environment: - nodejs_version: "8" - matrix: - - PYTHON: "C:\\Miniconda3-x64" - PYTHON_VERSION: "3.7" - PYTHON_MAJOR: 3 - PYTHON_ARCH: "64" - - PYTHON: "C:\\Miniconda3" - PYTHON_VERSION: "3.4" - PYTHON_MAJOR: 3 - PYTHON_ARCH: "32" - -# build cache to preserve files/folders between builds -cache: - - '%AppData%/npm-cache' - - '%PYTHON%/pkgs' - - '%LOCALAPPDATA%\pip\Cache' - -# scripts that run after cloning repository -install: - # Install node: - - ps: Install-Product node $env:nodejs_version - # Ensure python scripts are from right version: - - 'SET "PATH=%PYTHON%\Scripts;%PYTHON%;%PATH%"' - # Setup conda: - - 'conda list' - - 'conda update conda -y' - # If 32 bit, force conda to use it: - - 'IF %PYTHON_ARCH% EQU 32 SET CONDA_FORCE_32BIT=1' - - 'conda create -n test_env python=%PYTHON_VERSION% -y' - - 'activate test_env' - # Update install tools: - - 'conda install setuptools pip -y' - - 'python -m pip install --upgrade pip' - - 'python -m easy_install --upgrade setuptools' - # Install coverage utilities: - - 'pip install codecov' - # Install our package: - - 'pip install --upgrade ".[test]" -v' - -build: off - -# scripts to run before tests -before_test: - - git config --global user.email appveyor@fake.com - - git config --global user.name "AppVeyor CI" - - set "tmptestdir=%tmp%\{{ cookiecutter.python_package_name }}-%RANDOM%" - - mkdir "%tmptestdir%" - - cd "%tmptestdir%" - - -# to run your custom scripts instead of automatic tests -test_script: - - 'py.test -l --cov-report xml:"%APPVEYOR_BUILD_FOLDER%\coverage.xml" --cov={{ cookiecutter.python_package_name }} --pyargs {{ cookiecutter.python_package_name }}' - -on_success: - - cd "%APPVEYOR_BUILD_FOLDER%" - - codecov -X gcov --file "%APPVEYOR_BUILD_FOLDER%\coverage.xml"