@@ -136,10 +136,12 @@ jobs:
136136# run: pnpm install
137137
138138 - name : Prepare bundles
139+ if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'force all tests')
139140 working-directory : apps/demos
140141 run : pnpx nx prepare-bundles
141142
142143 - name : Demos - Run tsc
144+ if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'force all tests')
143145 working-directory : apps/demos
144146 run : tsc --noEmit
145147
@@ -153,6 +155,7 @@ jobs:
153155
154156 get-changes :
155157 runs-on : ubuntu-22.04
158+ if : github.event_name == 'pull_request'
156159 name : Get changed demos
157160 timeout-minutes : 5
158161
@@ -162,12 +165,22 @@ jobs:
162165
163166 - name : Get changed files
164167 uses : DevExpress/github-actions/get-changed-files@v1
165- if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
166168 with :
167169 gh-token : ${{ secrets.GITHUB_TOKEN }}
168170 paths : ' apps/demos/Demos/**/*'
169171 output : apps/demos/changed-files.json
170172
173+ - name : Display changed files
174+ run : |
175+ if [ -f "apps/demos/changed-files.json" ]; then
176+ echo "Found changed-files.json"
177+ echo "Content of changed-files.json:"
178+ cat apps/demos/changed-files.json
179+ echo "Number of changed files: $(jq length apps/demos/changed-files.json)"
180+ else
181+ echo "changed-files.json not found"
182+ fi
183+
171184 - name : Upload artifacts
172185 uses : actions/upload-artifact@v4
173186 with :
@@ -234,36 +247,20 @@ jobs:
234247 # run: pnpm run ts-check-react
235248
236249 lint :
237- name : ${{ matrix.name }}
250+ name : Lint code base
238251 needs :
239252 - build-devextreme
240253 - get-changes
241254
242255 runs-on : ubuntu-22.04
243256 timeout-minutes : 60
244257
245- strategy :
246- fail-fast : false
247- matrix :
248- include :
249- - name : Lint code base (excluding demos)
250- command : pnpx nx lint-non-demos
251- # NOTE: skipped due to enormous number of errors
252- # - name: Lint demos (1/4)
253- # command: CONSTEL=1/4 npm run lint-demos
254- # - name: Lint demos (2/4)
255- # command: CONSTEL=2/4 npm run lint-demos
256- # - name: Lint demos (3/4)
257- # command: CONSTEL=3/4 npm run lint-demos
258- # - name: Lint demos (4/4)
259- # command: CONSTEL=4/4 npm run lint-demos
260-
261258 steps :
262259 - name : Get sources
263260 uses : actions/checkout@v4
264261
265262 - name : Download artifacts
266- if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
263+ if : github.event_name == 'pull_request'
267264 uses : actions/download-artifact@v4
268265 with :
269266 name : changed-demos
@@ -305,47 +302,67 @@ jobs:
305302 - name : Install tgz
306303 run : pnpm add -w ./devextreme-installer.tgz ./devextreme-dist-installer.tgz ./devextreme-react-installer.tgz ./devextreme-vue-installer.tgz ./devextreme-angular-installer.tgz
307304
308- - uses : actions/setup-dotnet@v4
309- with :
310- dotnet-version : 5.0.408
311-
312- - name : Prepare dotnet
313- run : |
314- dotnet new globaljson --sdk-version 5.0.408
315- dotnet tool install -g dotnet-format --version 5.1.225507
316-
317- - name : Run lint
305+ - name : Run lint on all demos
306+ if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'force all tests')
318307 working-directory : apps/demos
319308 env :
320309 CHANGEDFILEINFOSPATH : changed-files.json
321310 DEBUG : ' eslint:cli-engine,stylelint:standalone'
322- run : ${{ matrix.command }}
311+ run : pnpx nx lint
312+
313+ - name : Run lint on changed demos
314+ if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
315+ working-directory : apps/demos
316+ env :
317+ DEBUG : ' eslint:cli-engine,stylelint:standalone'
318+ run : |
319+ pnpx nx lint-non-demos
320+
321+ if [ -f "changed-files.json" ]; then
322+ echo "Running lint-demos on changed files"
323+ CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json \
324+ | grep '^apps/demos/Demos/' \
325+ | sed 's|^apps/demos/||' \
326+ | while read f; do
327+ [ -f "$f" ] && echo "$f"
328+ done \
329+ | tr '\n' ' ')
330+ if [ ! -z "$CHANGED_DEMOS" ]; then
331+ echo "Changed demo files: $CHANGED_DEMOS"
332+ pnpx eslint $CHANGED_DEMOS
333+ else
334+ echo "No demo files changed, skipping lint-demos"
335+ fi
336+ else
337+ echo "changed-files.json not found"
338+ pnpm run lint-demos
339+ fi
323340
324341 check_generated_demos :
325342 name : ${{ matrix.name }}
326343 runs-on : ubuntu-22.04
327344 timeout-minutes : 10
328- needs : build-demos
345+ needs :
346+ - build-devextreme
329347
330348 strategy :
331349 fail-fast : false
332350 matrix :
333351 include :
334- - name : Check generated demos (1/5)
335- command : CONSTEL=1/5 pnpm run convert-to-js
336- - name : Check generated demos (2/5)
337- command : CONSTEL=2/5 pnpm run convert-to-js
338- - name : Check generated demos (3/5)
339- command : CONSTEL=3/5 pnpm run convert-to-js
340- - name : Check generated demos (4/5)
341- command : CONSTEL=4/5 pnpm run convert-to-js
342- - name : Check generated demos (5/5)
343- command : CONSTEL=5/5 pnpm run convert-to-js
352+ - name : Check generated demos
353+ command : pnpm run convert-to-js
344354
345355 steps :
346356 - name : Get sources
347357 uses : actions/checkout@v4
348358
359+ - name : Download artifacts
360+ if : github.event_name == 'pull_request'
361+ uses : actions/download-artifact@v4
362+ with :
363+ name : changed-demos
364+ path : apps/demos
365+
349366 - uses : pnpm/action-setup@v3
350367 with :
351368 version : 9
@@ -357,21 +374,6 @@ jobs:
357374 node-version : ' 20'
358375 cache : ' pnpm'
359376
360- # - name: Get pnpm store directory
361- # shell: bash
362- # run: |
363- # echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
364- #
365- # - uses: actions/cache@v4
366- # name: Setup pnpm cache
367- # with:
368- # path: |
369- # ${{ env.STORE_PATH }}
370- # .nx/cache
371- # key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
372- # restore-keys: |
373- # ${{ runner.os }}-pnpm-store
374-
375377 - name : Download devextreme sources
376378 uses : actions/download-artifact@v4
377379 with :
@@ -389,10 +391,33 @@ jobs:
389391 run : pnpm run prepare-js
390392
391393 - name : Check generated JS demos
394+ if : github.event_name == 'pull_request'
392395 working-directory : apps/demos
393396 run : |
397+ if [ -f "changed-files.json" ]; then
398+ echo "Running convert-to-js on changed files only"
399+
400+ CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json | grep '/React/' | grep '\.tsx$' | sed 's|^apps/demos/||' | sed 's|/[^/]*\.tsx$||' | sort | uniq)
401+
402+ if [ -z "$CHANGED_DEMOS" ]; then
403+ echo "No React demos found in changed files, skipping conversion"
404+ else
405+ echo "Changed React demos:"
406+ echo "$CHANGED_DEMOS"
407+
408+ echo "$CHANGED_DEMOS" | while read -r demo_dir; do
409+ if [ ! -z "$demo_dir" ]; then
410+ echo "Converting: $demo_dir"
411+ pnpm run convert-to-js "$demo_dir"
412+ fi
413+ done
414+ fi
415+ else
416+ echo "Running convert-to-js on all files"
394417 ${{ matrix.command }}
395-
418+ ${{ matrix.command }}
419+ fi
420+
396421 git add ./Demos -N
397422
398423 if git diff --exit-code . ':!package.json' ; then
@@ -405,6 +430,7 @@ jobs:
405430
406431 testcafe :
407432 needs : build-demos
433+ if : contains(github.event.pull_request.labels.*.name, 'force all tests')
408434 strategy :
409435 fail-fast : false
410436 matrix :
@@ -435,13 +461,6 @@ jobs:
435461 with :
436462 name : devextreme-sources
437463
438- - name : Download artifacts
439- if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
440- uses : actions/download-artifact@v4
441- with :
442- name : changed-demos
443- path : apps/demos
444-
445464 - uses : pnpm/action-setup@v3
446465 with :
447466 version : 9
@@ -469,9 +488,6 @@ jobs:
469488 working-directory : apps/demos
470489 run : pnpm add ../../devextreme-installer.tgz ../../devextreme-dist-installer.tgz ../../devextreme-react-installer.tgz ../../devextreme-vue-installer.tgz ../../devextreme-angular-installer.tgz
471490
472- # - name: Build wrappers
473- # run: pnpm exec nx run-many -t pack -p devextreme-angular devextreme-react devetreme-vue
474-
475491 - name : Prepare JS
476492 working-directory : apps/demos
477493 run : pnpm run prepare-js
@@ -497,6 +513,7 @@ jobs:
497513 python -m http.server 8083 &
498514
499515 - name : Run TestCafe tests
516+ shell : bash
500517 working-directory : apps/demos
501518 env :
502519 CHANGEDFILEINFOSPATH : changed-files.json
0 commit comments