|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + branches: '*' |
| 8 | + |
| 9 | +env: |
| 10 | + PIP_DISABLE_PIP_VERSION_CHECK: 1 |
| 11 | + PYTHONUNBUFFERED: 1 |
| 12 | + PYTHONIOENCODING: utf-8 |
| 13 | + CACHE_EPOCH: 0 |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: bash -l {0} |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + name: build |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Check out |
| 25 | + uses: actions/checkout@v2 |
| 26 | + - name: Set up python |
| 27 | + uses: actions/setup-python@v2 |
| 28 | + with: |
| 29 | + python-version: 3.9 |
| 30 | + - name: Set up node |
| 31 | + uses: actions/setup-node@v2 |
| 32 | + with: |
| 33 | + node-version: 14.x |
| 34 | + - name: Cache pip packages |
| 35 | + uses: actions/cache@v1 |
| 36 | + with: |
| 37 | + path: ~/.cache/pip |
| 38 | + key: | |
| 39 | + ${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-build-${{ hashFiles('setup.py', 'pyproject.toml') }} |
| 40 | + restore-keys: | |
| 41 | + ${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-build- |
| 42 | + - name: Install installation dependencies |
| 43 | + run: | |
| 44 | + set -eux |
| 45 | + python -m pip install -vv -U --user pip wheel setuptools |
| 46 | + yarn --version || npm install -g yarn |
| 47 | + - name: Install packaging dependencies |
| 48 | + run: | |
| 49 | + set -eux |
| 50 | + python -m pip install -vv 'jupyterlab~=3.0' |
| 51 | + - name: Pre-install node dependencies |
| 52 | + run: | |
| 53 | + set -eux |
| 54 | + cd js |
| 55 | + yarn --ignore-optional |
| 56 | + - name: Build sdist |
| 57 | + run: python setup.py sdist |
| 58 | + - name: Build wheel |
| 59 | + run: python setup.py bdist_wheel |
| 60 | + - name: Collect and hash distributions |
| 61 | + run: | |
| 62 | + set -eux |
| 63 | + cp js/lab-dist/jupyter-threejs-*.tgz dist |
| 64 | + cd dist |
| 65 | + sha256sum * | tee SHA256SUMS |
| 66 | + - name: Upload distributions |
| 67 | + uses: actions/upload-artifact@v2 |
| 68 | + with: |
| 69 | + name: dist ${{ github.run_number }} |
| 70 | + path: ./dist |
| 71 | + |
| 72 | + docs: |
| 73 | + name: docs |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Check out |
| 77 | + uses: actions/checkout@v2 |
| 78 | + - name: Install apt dependencies |
| 79 | + run: | |
| 80 | + set -eux |
| 81 | + sudo apt install pandoc |
| 82 | + - name: Set up python |
| 83 | + uses: actions/setup-python@v2 |
| 84 | + with: |
| 85 | + python-version: 3.9 |
| 86 | + - name: Install installation dependencies |
| 87 | + run: | |
| 88 | + set -eux |
| 89 | + python -m pip install -vv -U --user pip wheel setuptools |
| 90 | + - name: Set up node |
| 91 | + uses: actions/setup-node@v2 |
| 92 | + with: |
| 93 | + node-version: 14.x |
| 94 | + - name: Install package and docs dependencies |
| 95 | + run: | |
| 96 | + set -eux |
| 97 | + pip install -vv -U -e .[docs,examples,test] requests_cache |
| 98 | + - name: Validate docs environment |
| 99 | + run: | |
| 100 | + set -eux |
| 101 | + pip freeze |
| 102 | + pip check |
| 103 | + - name: Build docs |
| 104 | + run: | |
| 105 | + set -eux |
| 106 | + cd docs |
| 107 | + make html |
| 108 | + - name: Upload docs |
| 109 | + uses: actions/upload-artifact@v2 |
| 110 | + with: |
| 111 | + name: docs ${{ github.run_number }} |
| 112 | + path: ./docs/build |
| 113 | + - name: Get current date |
| 114 | + id: date |
| 115 | + run: | |
| 116 | + echo "::set-output name=year::$(date +'%Y')" |
| 117 | + echo "::set-output name=week::$(date +'%U')" |
| 118 | + - name: Cache links |
| 119 | + uses: actions/cache@v1 |
| 120 | + with: |
| 121 | + path: ./build/links |
| 122 | + key: | |
| 123 | + ${{ env.CACHE_EPOCH }}-${{ runner.os }}-links-${{ steps.date.outputs.year }}-${{ steps.date.outputs.week }} |
| 124 | + restore-keys: | |
| 125 | + ${{ env.CACHE_EPOCH }}-${{ runner.os }}-links-${{ steps.date.outputs.year }}- |
| 126 | + ${{ env.CACHE_EPOCH }}-${{ runner.os }}-links- |
| 127 | + - name: Check links |
| 128 | + run: | |
| 129 | + set -eux |
| 130 | + mkdir -p build/links/cache |
| 131 | + pytest-check-links --check-links-cache --check-links-cache-name ./build/links/cache |
| 132 | +
|
| 133 | + test: |
| 134 | + name: test ${{ matrix.os }}${{ matrix.python }} ${{ matrix.node }} ${{ matrix.lab }} |
| 135 | + needs: [build] |
| 136 | + runs-on: ${{ matrix.os }}-latest |
| 137 | + strategy: |
| 138 | + fail-fast: false |
| 139 | + matrix: |
| 140 | + os: [ubuntu, macos, windows] |
| 141 | + python: [3.6, 3.7, 3.8, 3.9] |
| 142 | + include: |
| 143 | + - python: 3.6 |
| 144 | + dist: 'pythreejs*.tar.gz' |
| 145 | + - python: 3.7 |
| 146 | + dist: 'pythreejs*.whl' |
| 147 | + lab: 1 |
| 148 | + node: 10 |
| 149 | + - python: 3.8 |
| 150 | + dist: 'pythreejs*.whl' |
| 151 | + lab: 2 |
| 152 | + node: 14 |
| 153 | + - python: 3.9 |
| 154 | + dist: 'pythreejs*.whl' |
| 155 | + lab: 3 |
| 156 | + - os: windows |
| 157 | + py_cmd: python |
| 158 | + - os: macos |
| 159 | + py_cmd: python3 |
| 160 | + - os: ubuntu |
| 161 | + py_cmd: python |
| 162 | + steps: |
| 163 | + - name: Check out |
| 164 | + uses: actions/checkout@v2 |
| 165 | + - name: Set up python |
| 166 | + uses: actions/setup-python@v2 |
| 167 | + with: |
| 168 | + python-version: 3.8 |
| 169 | + - if: ${{ matrix.node }} |
| 170 | + name: Set up node |
| 171 | + uses: actions/setup-node@v2 |
| 172 | + with: |
| 173 | + node-version: ${{ matrix.node }} |
| 174 | + - name: Download distributions |
| 175 | + uses: actions/download-artifact@v2 |
| 176 | + with: |
| 177 | + name: dist ${{ github.run_number }} |
| 178 | + path: ./dist |
| 179 | + - name: Install installation dependencies |
| 180 | + run: | |
| 181 | + set -eux |
| 182 | + ${{ matrix.py_cmd }} -m pip install -vv --user -U pip wheel setuptools |
| 183 | + - name: Install package |
| 184 | + run: | |
| 185 | + set -eux |
| 186 | + cd dist |
| 187 | + ${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }} |
| 188 | + - name: Validate environment |
| 189 | + run: | |
| 190 | + set -eux |
| 191 | + ${{ matrix.py_cmd }} -m pip freeze |
| 192 | + ${{ matrix.py_cmd }} -m pip check |
| 193 | + - if: ${{ matrix.lab }} |
| 194 | + name: Install JupyterLab |
| 195 | + run: | |
| 196 | + set -eux |
| 197 | + ${{ matrix.py_cmd }} -m pip install -vv 'jupyterlab==${{ matrix.lab }}.*' |
| 198 | + - name: Install test dependencies |
| 199 | + # explicit file installs don't support extras, skimage brings most along |
| 200 | + run: | |
| 201 | + set -eux |
| 202 | + ${{ matrix.py_cmd }} -m pip install -vv nbval scikit-image ipywebrtc pytest-cov codecov |
| 203 | + - name: Run python tests |
| 204 | + # remove the source directory to avoid surprises |
| 205 | + run: | |
| 206 | + set -eux |
| 207 | + rm -rf pythreejs |
| 208 | + ${{ matrix.py_cmd }} -m pytest -vv -l --nbval-lax --current-env . --cov pythreejs --cov-report term-missing:skip-covered --no-cov-on-fail |
| 209 | + - name: Upload coverage |
| 210 | + run: | |
| 211 | + set -eux |
| 212 | + codecov |
| 213 | + - name: Check notebook extension |
| 214 | + run: | |
| 215 | + set -eux |
| 216 | + jupyter nbextension list |
| 217 | + jupyter nbextension list 2>&1 | grep -ie "jupyter-threejs/extension.*enabled" - |
| 218 | + - if: ${{ matrix.node }} |
| 219 | + name: Install lab extension |
| 220 | + run: | |
| 221 | + set -eux |
| 222 | + jupyter labextension install --no-build --debug ./dist/*.tgz @jupyter-widgets/jupyterlab-manager |
| 223 | + - if: ${{ matrix.node }} |
| 224 | + name: Build lab |
| 225 | + run: | |
| 226 | + set -eux |
| 227 | + jupyter lab build --debug |
| 228 | + - if: ${{ matrix.lab }} |
| 229 | + name: Check lab extension |
| 230 | + run: | |
| 231 | + set -eux |
| 232 | + jupyter labextension list |
| 233 | + jupyter labextension list 2>&1 | grep -ie "jupyter-threejs.*enabled.*ok" - |
0 commit comments