Skip to content

Commit 75d3476

Browse files
authored
Merge pull request #86 from fcollonval/fix/ci
Switch to jest
2 parents 8b11ae3 + dae2d71 commit 75d3476

File tree

20 files changed

+339
-378
lines changed

20 files changed

+339
-378
lines changed

.github/workflows/build.yml

Lines changed: 78 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,84 +4,86 @@ on:
44
push:
55
branches: master
66
pull_request:
7-
branches: '*'
7+
branches: "*"
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v2
15-
16-
- name: Install node
17-
uses: actions/setup-node@v2
18-
with:
19-
node-version: '12.x'
20-
21-
- name: Install Python
22-
uses: actions/setup-python@v2
23-
with:
24-
python-version: '3.7'
25-
architecture: 'x64'
26-
27-
- name: Setup pip cache
28-
uses: actions/cache@v2
29-
with:
30-
path: ~/.cache/pip
31-
key: pip-3.7-${{ hashFiles('package.json') }}
32-
restore-keys: |
33-
pip-3.7-
34-
pip-
35-
36-
- name: Get npm cache directory
37-
id: npm-cache
38-
run: |
39-
echo "::set-output name=dir::$(npm config get cache)"
40-
41-
- uses: actions/cache@v2
42-
with:
43-
path: ${{ steps.npm-cache.outputs.dir }}
44-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
45-
restore-keys: |
46-
${{ runner.os }}-node-
47-
48-
- name: Install dependencies
49-
run: |
50-
python -m pip install -U pip setuptools cookiecutter
51-
52-
- name: Test the extension
53-
# env:
54-
# CHROME_BIN: chromium-browser
55-
run: |
56-
cookiecutter . --config-file tests/testconfig.yaml --no-input
57-
pushd jupyter-widget-testwidgets
58-
python -m pip install --upgrade -v -e ".[test, examples, docs]"
59-
yarn run lint:check
60-
61-
# TODO: re-enable tests
62-
# pytest
63-
# npm run test:ci
64-
65-
# - name: Check docs can be build + links
66-
# run: |
67-
# pushd jupyter-widget-testwidgets/docs
68-
# make html
69-
# make linkcheck
70-
# popd
71-
72-
- name: Make a non-local install so the data_files get populated
73-
run: |
74-
pip uninstall -y jupyter_widget_testwidgets
75-
cd jupyter-widget-testwidgets
76-
pip install .
77-
78-
# Validate nbextension (enable does not use exit code):
79-
jupyter nbextension enable --py --sys-prefix jupyter_widget_testwidgets
80-
python -c "from notebook.nbextensions import validate_nbextension; import sys; sys.exit(validate_nbextension('jupyter_widget_testwidgets/extension') or 0)"
81-
82-
# Validate labextension
83-
pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7
84-
# Make sure our lab extension was installed.
85-
jupyter labextension list 2>&1 | grep -ie "jupyter-widget-testwidgets.*OK"
86-
# Make sure our lab extension can be develop installed.
87-
jupyter labextension develop . --overwrite
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Install node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: "12.x"
20+
21+
- name: Install Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: "3.7"
25+
architecture: "x64"
26+
27+
- name: Setup pip cache
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.cache/pip
31+
key: pip-3.7-${{ hashFiles('package.json') }}
32+
restore-keys: |
33+
pip-3.7-
34+
pip-
35+
36+
- name: Get npm cache directory
37+
id: npm-cache
38+
run: |
39+
echo "::set-output name=dir::$(npm config get cache)"
40+
41+
- uses: actions/cache@v2
42+
with:
43+
path: ${{ steps.npm-cache.outputs.dir }}
44+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
45+
restore-keys: |
46+
${{ runner.os }}-node-
47+
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install -U pip setuptools cookiecutter
51+
52+
- name: Test the extension
53+
run: |
54+
cookiecutter . --config-file tests/testconfig.yaml --no-input
55+
pushd jupyter-widget-testwidgets
56+
python -m pip install --upgrade -v -e ".[test, examples, docs]"
57+
yarn run lint:check
58+
59+
pytest
60+
yarn run test
61+
popd
62+
63+
- name: Check docs can be build + links
64+
run: |
65+
sudo apt install -y pandoc
66+
pushd jupyter-widget-testwidgets/docs
67+
make html
68+
python -m pytest --check-links
69+
popd
70+
71+
- name: Make a non-local install so the data_files get populated
72+
run: |
73+
pip uninstall -y jupyter_widget_testwidgets
74+
pushd jupyter-widget-testwidgets
75+
76+
pip install .
77+
78+
# Validate nbextension (enable does not use exit code):
79+
jupyter nbextension enable --py --sys-prefix jupyter_widget_testwidgets
80+
python -c "from notebook.nbextensions import validate_nbextension; import sys; sys.exit(validate_nbextension('jupyter_widget_testwidgets/extension') or 0)"
81+
82+
# Validate labextension
83+
pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7
84+
# Make sure our lab extension was installed.
85+
jupyter labextension list 2>&1 | grep -ie "jupyter-widget-testwidgets.*OK"
86+
# Make sure our lab extension can be develop installed.
87+
jupyter labextension develop . --overwrite
88+
89+
popd

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
*.pyc
44
.cache
5+
.vscode

{{cookiecutter.github_project_name}}/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
],
88
parser: '@typescript-eslint/parser',
99
parserOptions: {
10-
project: 'tsconfig.json',
10+
project: 'tsconfig.eslint.json',
1111
sourceType: 'module'
1212
},
1313
plugins: ['@typescript-eslint'],

{{cookiecutter.github_project_name}}/.github/workflows/build.yml

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,60 @@ on:
44
push:
55
branches: main
66
pull_request:
7-
branches: '*'
7+
branches: "*"
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v2
15-
- name: Install node
16-
uses: actions/setup-node@v1
17-
with:
18-
node-version: '12.x'
19-
- name: Install Python
20-
uses: actions/setup-python@v2
21-
with:
22-
python-version: '3.7'
23-
architecture: 'x64'
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: "12.x"
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.7"
23+
architecture: "x64"
2424

25-
- name: Setup pip cache
26-
uses: actions/cache@v2
27-
with:
28-
path: ~/.cache/pip
29-
key: pip-3.7-${{ hashFiles('package.json') }}
30-
restore-keys: |
31-
pip-3.7-
32-
pip-
25+
- name: Setup pip cache
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.cache/pip
29+
key: pip-3.7-${{ hashFiles('package.json') }}
30+
restore-keys: |
31+
pip-3.7-
32+
pip-
3333
34-
- name: Get npm cache directory
35-
id: npm-cache
36-
run: |
37-
echo "::set-output name=dir::$(npm config get cache)"
38-
- uses: actions/cache@v2
39-
with:
40-
path: ${{ steps.npm-cache.outputs.dir }}
41-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
42-
restore-keys: |
43-
${{ runner.os }}-node-
34+
- name: Get npm cache directory
35+
id: npm-cache
36+
run: |
37+
echo "::set-output name=dir::$(npm config get cache)"
38+
- uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.npm-cache.outputs.dir }}
41+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
42+
restore-keys: |
43+
${{ runner.os }}-node-
4444
45-
- name: Install dependencies
46-
run: |
47-
python -m pip install -U pip setuptools codecov
48-
npm install -g codecov
49-
- name: Test the extension
50-
run: |
51-
python -m pip install --upgrade -v -e ".[test, examples, docs]"
52-
yarn run lint:check
53-
pytest
54-
yarn run test:ci
55-
- name: Check docs can be build + links
56-
run: |
57-
pushd docs
58-
make html
59-
make linkcheck
60-
popd
61-
python -m pytest_check_links --links-ext=.md -o testpaths=. -o addopts=
62-
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install -U pip setuptools codecov
48+
npm install -g codecov
49+
- name: Test the extension
50+
run: |
51+
python -m pip install --upgrade -v -e ".[test, examples, docs]"
52+
yarn run lint:check
53+
54+
pytest
55+
yarn run test
56+
57+
- name: Check docs can be build + links
58+
run: |
59+
sudo apt install -y pandoc
60+
pushd docs
61+
make html
62+
python -m pytest --check-links
63+
popd
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
sourceMap: 'inline',
3+
presets: [
4+
[
5+
'@babel/preset-env',
6+
{
7+
targets: {
8+
node: 'current',
9+
},
10+
},
11+
],
12+
],
13+
};

{{cookiecutter.github_project_name}}/docs/environment.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: {{cookiecutter.python_package_name}}_docs
33
channels:
44
- conda-forge
55
dependencies:
6-
- python=3.5
7-
- nodejs
8-
- numpy
9-
- sphinx
10-
- nbsphinx
11-
- jupyter_sphinx
6+
- python=3.*
7+
- nodejs
8+
- jupyter_sphinx
9+
- sphinx
10+
- sphinx_rtd_theme
11+
- nbsphinx
12+
- nbsphinx-link

{{cookiecutter.github_project_name}}/docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
'sphinx.ext.napoleon',
3030
'sphinx.ext.todo',
3131
'nbsphinx',
32-
'jupyter_sphinx.execute',
32+
'jupyter_sphinx',
3333
'nbsphinx_link',
3434
]
3535

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
automock: false,
3+
moduleNameMapper: {
4+
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
5+
},
6+
preset: 'ts-jest/presets/js-with-babel',
7+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8+
testPathIgnorePatterns: ['/lib/', '/node_modules/'],
9+
testRegex: '/__tests__/.*.spec.ts[x]?$',
10+
transformIgnorePatterns: ['/node_modules/(?!(@jupyter(lab|-widgets)/.*)/)'],
11+
globals: {
12+
'ts-jest': {
13+
tsconfig: '<rootDir>/tsconfig.json',
14+
},
15+
},
16+
};

0 commit comments

Comments
 (0)