|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: main |
| 6 | + pull_request: |
| 7 | + branches: '*' |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v2 |
| 15 | + - name: Install node |
| 16 | + uses: actions/setup-node@v1 |
| 17 | + with: |
| 18 | + node-version: '14.x' |
| 19 | + - name: Install Python |
| 20 | + uses: actions/setup-python@v2 |
| 21 | + with: |
| 22 | + python-version: '3.8' |
| 23 | + architecture: 'x64' |
| 24 | + |
| 25 | + - name: Setup pip cache |
| 26 | + uses: actions/cache@v2 |
| 27 | + with: |
| 28 | + path: ~/.cache/pip |
| 29 | + key: pip-3.8-${{ hashFiles('package.json') }} |
| 30 | + restore-keys: | |
| 31 | + pip-3.8- |
| 32 | + pip- |
| 33 | +
|
| 34 | + - name: Get yarn cache directory path |
| 35 | + id: yarn-cache-dir-path |
| 36 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 37 | + - name: Setup yarn cache |
| 38 | + uses: actions/cache@v2 |
| 39 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 40 | + with: |
| 41 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 42 | + key: yarn-${{ hashFiles('**/yarn.lock') }} |
| 43 | + restore-keys: | |
| 44 | + yarn- |
| 45 | +
|
| 46 | + - name: Install dependencies |
| 47 | + run: python -m pip install -U jupyterlab~=3.1 check-manifest |
| 48 | + - name: Build the extension |
| 49 | + run: | |
| 50 | + set -eux |
| 51 | + jlpm |
| 52 | + # build separately for now |
| 53 | + jlpm run build:wasm |
| 54 | + jlpm run build |
| 55 | + jlpm run eslint:check |
| 56 | + python -m pip install . |
| 57 | +
|
| 58 | + jupyter labextension list 2>&1 | grep -ie "@jupyterlite/xeus-python-kernel.*OK" |
| 59 | +
|
| 60 | + # TODO: add JupyterLite browser check |
| 61 | + # python -m jupyterlab.browser_check |
| 62 | +
|
| 63 | + check-manifest -v |
| 64 | +
|
| 65 | + pip install build |
| 66 | + python -m build --sdist |
| 67 | + cp dist/*.tar.gz myextension.tar.gz |
| 68 | + pip uninstall -y myextension jupyterlab |
| 69 | + rm -rf myextension |
| 70 | +
|
| 71 | + - uses: actions/upload-artifact@v2 |
| 72 | + with: |
| 73 | + name: myextension-sdist |
| 74 | + path: myextension.tar.gz |
| 75 | + |
| 76 | + test_isolated: |
| 77 | + needs: build |
| 78 | + runs-on: ubuntu-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v2 |
| 83 | + - name: Install Python |
| 84 | + uses: actions/setup-python@v2 |
| 85 | + with: |
| 86 | + python-version: '3.8' |
| 87 | + architecture: 'x64' |
| 88 | + - uses: actions/download-artifact@v2 |
| 89 | + with: |
| 90 | + name: myextension-sdist |
| 91 | + - name: Install and Test |
| 92 | + run: | |
| 93 | + set -eux |
| 94 | + # Remove NodeJS, twice to take care of system and locally installed node versions. |
| 95 | + sudo rm -rf $(which node) |
| 96 | + sudo rm -rf $(which node) |
| 97 | + pip install myextension.tar.gz |
| 98 | + pip install jupyterlab |
| 99 | + jupyter labextension list 2>&1 | grep -ie "@jupyterlite/xeus-python-kernel.*OK" |
| 100 | +
|
| 101 | + # TODO: add JupyterLite browser check |
| 102 | + # python -m jupyterlab.browser_check --no-chrome-test |
0 commit comments