Skip to content

Commit 9b64041

Browse files
authored
Merge pull request #3123 from jtpio/packaging
Add a workflow to test the packaging
2 parents 0e1a2c7 + 99c40fd commit 9b64041

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed

.github/workflows/packaging.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Packaging
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: '*'
8+
9+
env:
10+
PIP_DISABLE_PIP_VERSION_CHECK: 1
11+
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Install node
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: '14.x'
26+
- name: Install Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: '3.9'
30+
architecture: 'x64'
31+
32+
- uses: actions/cache@v2
33+
with:
34+
path: ~/.cache/pip
35+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
36+
restore-keys: |
37+
${{ runner.os }}-pip-
38+
39+
- name: Get yarn cache directory path
40+
id: yarn-cache-dir-path
41+
run: echo "::set-output name=dir::$(yarn cache dir)"
42+
- uses: actions/cache@v2
43+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
44+
with:
45+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
46+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
47+
restore-keys: |
48+
${{ runner.os }}-yarn-
49+
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip wheel
53+
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
54+
- name: Build PyPI distributions for ipywidgets
55+
run: |
56+
python setup.py sdist bdist_wheel
57+
- name: Build PyPI distributions for jupyterlab_widgets
58+
run: |
59+
jlpm
60+
jlpm run build
61+
cd jupyterlab_widgets
62+
python setup.py sdist bdist_wheel
63+
cp ./dist/* ../dist
64+
- name: Build PyPI distributions for widgetsnbextension
65+
run: |
66+
jlpm
67+
jlpm run build
68+
cd widgetsnbextension
69+
python setup.py sdist bdist_wheel
70+
cp ./dist/* ../dist
71+
- name: Build checksum file
72+
run: |
73+
cd dist
74+
sha256sum * | tee SHA256SUMS
75+
- name: Upload distributions
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: dist ${{ github.run_number }}
79+
path: ./dist
80+
81+
install:
82+
runs-on: ${{ matrix.os }}-latest
83+
needs: [build]
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
os: [ubuntu, windows]
88+
python: ['3.6', '3.9']
89+
dist: ['ipywidgets*.tar.gz']
90+
include:
91+
- python: '3.9'
92+
dist: 'jupyterlab_widgets*.tar.gz'
93+
os: 'ubuntu'
94+
- python: '3.9'
95+
dist: 'widgetsnbextension*.tar.gz'
96+
os: 'ubuntu'
97+
- python: '3.9'
98+
dist: 'ipywidgets*.whl'
99+
os: 'ubuntu'
100+
steps:
101+
- name: Install Python
102+
uses: actions/setup-python@v2
103+
with:
104+
python-version: ${{ matrix.python }}
105+
architecture: 'x64'
106+
- name: Checkout # For the cache keys
107+
uses: actions/checkout@v2
108+
109+
- name: Get pip cache dir
110+
id: pip-cache
111+
run: |
112+
echo "::set-output name=dir::$(pip cache dir)"
113+
- name: pip cache
114+
uses: actions/cache@v2
115+
with:
116+
path: ${{ steps.pip-cache.outputs.dir }}
117+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
118+
restore-keys: |
119+
${{ runner.os }}-pip-
120+
121+
- name: Install the prerequisites
122+
run: |
123+
python -m pip install pip wheel
124+
- uses: actions/download-artifact@v2
125+
with:
126+
name: dist ${{ github.run_number }}
127+
path: ./dist
128+
- name: Install the package
129+
run: |
130+
cd dist
131+
python -m pip install -vv ${{ matrix.dist }}
132+
- name: Validate environment
133+
run: |
134+
python -m pip freeze
135+
python -m pip check
136+
- name: Check the JupyterLab extension is installed
137+
if: matrix.dist != 'widgetsnbextension*.tar.gz'
138+
run: |
139+
python -m pip install jupyterlab~=3.0
140+
141+
jupyter labextension list
142+
jupyter labextension list 2>&1 | grep -ie "@jupyter-widgets/jupyterlab-manager.*enabled.*ok" -
143+
- name: Check the Classic Notebook extension is installed
144+
if: matrix.dist != 'jupyterlab_widgets*.tar.gz'
145+
run: |
146+
python -m pip install notebook~=6.0
147+
148+
jupyter nbextension list
149+
jupyter nbextension list 2>&1 | grep -ie "jupyter-js-widgets/extension.*enabled" -

0 commit comments

Comments
 (0)