|
| 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 | + |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Base Setup |
| 18 | + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 19 | + |
| 20 | + - name: Install dependencies |
| 21 | + run: python -m pip install -U "jupyterlab>=4.0.0,<5" |
| 22 | + |
| 23 | + - name: Lint the extension |
| 24 | + run: | |
| 25 | + set -eux |
| 26 | + jlpm |
| 27 | + jlpm run lint:check |
| 28 | +
|
| 29 | + - name: Test the extension |
| 30 | + run: | |
| 31 | + set -eux |
| 32 | + jlpm run test |
| 33 | +
|
| 34 | + - name: Build the extension |
| 35 | + run: | |
| 36 | + set -eux |
| 37 | + python -m pip install .[test] |
| 38 | +
|
| 39 | + jupyter labextension list |
| 40 | + jupyter labextension list 2>&1 | grep -ie "jupyterlab_hide_code.*OK" |
| 41 | + python -m jupyterlab.browser_check |
| 42 | +
|
| 43 | + - name: Package the extension |
| 44 | + run: | |
| 45 | + set -eux |
| 46 | +
|
| 47 | + pip install build |
| 48 | + python -m build |
| 49 | + pip uninstall -y "jupyterlab_hide_code" jupyterlab |
| 50 | +
|
| 51 | + - name: Upload extension packages |
| 52 | + uses: actions/upload-artifact@v3 |
| 53 | + with: |
| 54 | + name: extension-artifacts |
| 55 | + path: dist/jupyterlab_hide_code* |
| 56 | + if-no-files-found: error |
| 57 | + |
| 58 | + test_isolated: |
| 59 | + needs: build |
| 60 | + runs-on: ubuntu-latest |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Install Python |
| 64 | + uses: actions/setup-python@v4 |
| 65 | + with: |
| 66 | + python-version: '3.9' |
| 67 | + architecture: 'x64' |
| 68 | + - uses: actions/download-artifact@v3 |
| 69 | + with: |
| 70 | + name: extension-artifacts |
| 71 | + - name: Install and Test |
| 72 | + run: | |
| 73 | + set -eux |
| 74 | + # Remove NodeJS, twice to take care of system and locally installed node versions. |
| 75 | + sudo rm -rf $(which node) |
| 76 | + sudo rm -rf $(which node) |
| 77 | +
|
| 78 | + pip install "jupyterlab>=4.0.0,<5" jupyterlab_hide_code*.whl |
| 79 | +
|
| 80 | +
|
| 81 | + jupyter labextension list |
| 82 | + jupyter labextension list 2>&1 | grep -ie "jupyterlab_hide_code.*OK" |
| 83 | + python -m jupyterlab.browser_check --no-browser-test |
| 84 | +
|
| 85 | + integration-tests: |
| 86 | + name: Integration tests |
| 87 | + needs: build |
| 88 | + runs-on: ubuntu-latest |
| 89 | + |
| 90 | + env: |
| 91 | + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers |
| 92 | + |
| 93 | + steps: |
| 94 | + - name: Checkout |
| 95 | + uses: actions/checkout@v3 |
| 96 | + |
| 97 | + - name: Base Setup |
| 98 | + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 99 | + |
| 100 | + - name: Download extension package |
| 101 | + uses: actions/download-artifact@v3 |
| 102 | + with: |
| 103 | + name: extension-artifacts |
| 104 | + |
| 105 | + - name: Install the extension |
| 106 | + run: | |
| 107 | + set -eux |
| 108 | + python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_hide_code*.whl |
| 109 | +
|
| 110 | + - name: Install dependencies |
| 111 | + working-directory: ui-tests |
| 112 | + env: |
| 113 | + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 |
| 114 | + run: jlpm install |
| 115 | + |
| 116 | + - name: Set up browser cache |
| 117 | + uses: actions/cache@v3 |
| 118 | + with: |
| 119 | + path: | |
| 120 | + ${{ github.workspace }}/pw-browsers |
| 121 | + key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} |
| 122 | + |
| 123 | + - name: Install browser |
| 124 | + run: jlpm playwright install chromium |
| 125 | + working-directory: ui-tests |
| 126 | + |
| 127 | + - name: Execute integration tests |
| 128 | + working-directory: ui-tests |
| 129 | + run: | |
| 130 | + jlpm playwright test |
| 131 | +
|
| 132 | + - name: Upload Playwright Test report |
| 133 | + if: always() |
| 134 | + uses: actions/upload-artifact@v3 |
| 135 | + with: |
| 136 | + name: jupyterlab_hide_code-playwright-tests |
| 137 | + path: | |
| 138 | + ui-tests/test-results |
| 139 | + ui-tests/playwright-report |
| 140 | +
|
| 141 | + check_links: |
| 142 | + name: Check Links |
| 143 | + runs-on: ubuntu-latest |
| 144 | + timeout-minutes: 15 |
| 145 | + steps: |
| 146 | + - uses: actions/checkout@v3 |
| 147 | + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 148 | + - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 |
0 commit comments