|
6 | 6 | pull_request:
|
7 | 7 | branches: '*'
|
8 | 8 |
|
| 9 | +# Define reusable example list |
| 10 | +x-examples: &examples |
| 11 | + - clap-button-message |
| 12 | + - cell-toolbar |
| 13 | + - codemirror-extension |
| 14 | + - command-palette |
| 15 | + - commands |
| 16 | + - completer |
| 17 | + - contentheader |
| 18 | + - context-menu |
| 19 | + - custom-log-console |
| 20 | + - datagrid |
| 21 | + - documents |
| 22 | + - hello-world |
| 23 | + - launcher |
| 24 | + - kernel-messaging |
| 25 | + - kernel-output |
| 26 | + - log-messages |
| 27 | + - main-menu |
| 28 | + - metadata-form |
| 29 | + - mimerenderer |
| 30 | + - notifications |
| 31 | + - react-widget |
| 32 | + - server-extension |
| 33 | + - settings |
| 34 | + - shout-button-message |
| 35 | + - signals |
| 36 | + - state |
| 37 | + - toolbar-button |
| 38 | + - toparea-text-widget |
| 39 | + - widgets |
| 40 | + |
9 | 41 | jobs:
|
10 |
| - build_extensions: |
11 |
| - runs-on: ${{ matrix.os }} |
| 42 | + build_extensions_linux: |
| 43 | + runs-on: ubuntu-latest |
12 | 44 |
|
13 | 45 | strategy:
|
14 | 46 | fail-fast: false
|
15 | 47 | matrix:
|
16 |
| - example: |
17 |
| - - clap-button-message |
18 |
| - - cell-toolbar |
19 |
| - - codemirror-extension |
20 |
| - - command-palette |
21 |
| - - commands |
22 |
| - - completer |
23 |
| - - contentheader |
24 |
| - - context-menu |
25 |
| - - custom-log-console |
26 |
| - - datagrid |
27 |
| - - documents |
28 |
| - - hello-world |
29 |
| - - launcher |
30 |
| - - kernel-messaging |
31 |
| - - kernel-output |
32 |
| - - log-messages |
33 |
| - - main-menu |
34 |
| - - metadata-form |
35 |
| - - mimerenderer |
36 |
| - - notifications |
37 |
| - - react-widget |
38 |
| - - server-extension |
39 |
| - - settings |
40 |
| - - shout-button-message |
41 |
| - - signals |
42 |
| - - state |
43 |
| - - toolbar-button |
44 |
| - - toparea-text-widget |
45 |
| - - widgets |
46 |
| - os: [ubuntu-latest, macos-latest, windows-latest] |
47 |
| - |
48 |
| - defaults: |
49 |
| - run: |
50 |
| - working-directory: ${{ matrix.example }} |
| 48 | + example: *examples |
51 | 49 |
|
52 | 50 | steps:
|
53 | 51 | - name: Checkout
|
54 | 52 | uses: actions/checkout@v4
|
55 |
| - - name: Path filter |
56 |
| - id: filter |
57 |
| - uses: dorny/paths-filter@v2 |
58 |
| - with: |
59 |
| - filters: | |
60 |
| - extension: |
61 |
| - - '${{ matrix.example }}/**' |
62 |
| - - name: Cache lerna |
63 |
| - if: steps.filter.outputs.extension == 'true' |
64 |
| - uses: actions/cache@v4 |
65 |
| - with: |
66 |
| - path: '**/node_modules' |
67 |
| - key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }} |
68 |
| - restore-keys: ${{ runner.os }}-lerna- |
69 |
| - - name: Check config files |
70 |
| - if: steps.filter.outputs.extension == 'true' |
71 |
| - run: | |
72 |
| - diff ../hello-world/setup.py setup.py |
73 |
| - diff ../hello-world/tsconfig.json tsconfig.json |
74 |
| - diff ../hello-world/.yarnrc.yml .yarnrc.yml |
75 |
| - diff ../hello-world/ui-tests/jupyter_server_test_config.py ./ui-tests/jupyter_server_test_config.py |
76 |
| - diff ../hello-world/ui-tests/playwright.config.js ./ui-tests/playwright.config.js |
77 |
| - shell: bash |
78 |
| - - name: Install node |
79 |
| - if: steps.filter.outputs.extension == 'true' |
80 |
| - uses: actions/setup-node@v4 |
| 53 | + - name: Build extension |
| 54 | + uses: ./.github/actions/build-extension |
81 | 55 | with:
|
82 |
| - node-version: '18.x' |
83 |
| - - name: Install Python |
84 |
| - if: steps.filter.outputs.extension == 'true' |
85 |
| - uses: actions/setup-python@v5 |
86 |
| - with: |
87 |
| - python-version: '3.11' |
88 |
| - architecture: 'x64' |
89 |
| - - name: Get pip cache dir |
90 |
| - if: steps.filter.outputs.extension == 'true' |
91 |
| - id: pip-cache |
92 |
| - run: | |
93 |
| - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT |
94 |
| - shell: bash |
95 |
| - - name: Cache pip |
96 |
| - if: steps.filter.outputs.extension == 'true' |
97 |
| - uses: actions/cache@v4 |
98 |
| - with: |
99 |
| - path: ${{ steps.pip-cache.outputs.dir }} |
100 |
| - key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }} |
101 |
| - restore-keys: | |
102 |
| - ${{ runner.os }}-pip- |
103 |
| - - name: Install the Python dependencies |
104 |
| - if: steps.filter.outputs.extension == 'true' |
105 |
| - run: | |
106 |
| - python -m pip install --upgrade pip "jupyterlab>=4.0.0" |
107 |
| - # This is challenging to test in collaboration; |
108 |
| - # got trouble with the file ID service and the uncontrolled auto-save |
109 |
| - # - if: steps.filter.outputs.extension == 'true' && matrix.example == 'clap-button-message' |
110 |
| - # run: | |
111 |
| - # python -m pip install jupyter-collaboration |
112 |
| - - name: Build the extension |
113 |
| - if: steps.filter.outputs.extension == 'true' |
114 |
| - run: | |
115 |
| - # Same commands as in TL;DR to ensure it works |
116 |
| - touch yarn.lock |
117 |
| - pip install -e . -v |
118 |
| - jupyter labextension develop . --overwrite |
119 |
| - shell: bash |
120 |
| - - name: Lint the files |
121 |
| - if: steps.filter.outputs.extension == 'true' |
122 |
| - run: jlpm run lint:check |
123 |
| - - name: Check extension installation |
124 |
| - if: steps.filter.outputs.extension == 'true' |
125 |
| - run: | |
126 |
| - jupyter labextension list 2>&1 | tee labextension.list |
127 |
| - cat labextension.list | grep -ie "@jupyterlab-examples/*.*OK" |
128 |
| - # clap-button-message example will have one plugin failing as it is requiring a |
129 |
| - # Jupyter Notebook specific token. This is expected. Hence we need to skip this |
130 |
| - # test for that example |
131 |
| - - if: steps.filter.outputs.extension == 'true' && matrix.example != 'clap-button-message' |
132 |
| - run: | |
133 |
| - python -m jupyterlab.browser_check |
| 56 | + example: ${{ matrix.example }} |
| 57 | + run-ui-tests: 'true' |
134 | 58 |
|
135 |
| - - name: Install galata |
136 |
| - if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') |
137 |
| - working-directory: ${{ matrix.example }}/ui-tests |
138 |
| - env: |
139 |
| - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 |
140 |
| - run: jlpm install |
141 |
| - - name: Set up browser cache |
142 |
| - if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') |
143 |
| - uses: actions/cache@v4 |
144 |
| - with: |
145 |
| - path: | |
146 |
| - ${{ github.workspace }}/pw-browsers |
147 |
| - key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} |
148 |
| - - name: Install browser |
149 |
| - if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') |
150 |
| - run: jlpm playwright install chromium |
151 |
| - working-directory: ${{ matrix.example }}/ui-tests |
152 |
| - - name: Install kernel-output dependencies |
153 |
| - if: steps.filter.outputs.extension == 'true' && matrix.example == 'kernel-output' |
154 |
| - run: pip install numpy pandas |
155 |
| - - name: Integration tests |
156 |
| - if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') |
157 |
| - working-directory: ${{ matrix.example }}/ui-tests |
158 |
| - run: jlpm playwright test |
159 |
| - - name: Upload UI Test artifacts |
160 |
| - if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') && always() |
161 |
| - uses: actions/upload-artifact@v4 |
| 59 | + build_extensions_cross_platform: |
| 60 | + needs: build_extensions_linux |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + example: *examples |
| 67 | + os: [macos-latest, windows-latest] |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + - name: Build extension |
| 73 | + uses: ./.github/actions/build-extension |
162 | 74 | with:
|
163 |
| - name: ${{ matrix.example }}-ui-test-output |
164 |
| - path: | |
165 |
| - ${{ matrix.example }}/ui-tests/test-results |
166 |
| - - name: Uninstall extension |
167 |
| - if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') ) |
168 |
| - run: | |
169 |
| - export NAME=`python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])"` |
170 |
| - pip uninstall -y ${NAME} |
| 75 | + example: ${{ matrix.example }} |
| 76 | + run-ui-tests: 'false' |
171 | 77 |
|
172 | 78 | build_serverextension:
|
173 | 79 | runs-on: ${{ matrix.os }}
|
|
0 commit comments