@@ -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
@@ -162,12 +164,22 @@ jobs:
162164
163165 - name : Get changed files
164166 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')
166167 with :
167168 gh-token : ${{ secrets.GITHUB_TOKEN }}
168169 paths : ' apps/demos/Demos/**/*'
169170 output : apps/demos/changed-files.json
170171
172+ - name : Display changed files
173+ run : |
174+ if [ -f "apps/demos/changed-files.json" ]; then
175+ echo "Found changed-files.json"
176+ echo "Content of changed-files.json:"
177+ cat apps/demos/changed-files.json
178+ echo "Number of changed files: $(jq length apps/demos/changed-files.json)"
179+ else
180+ echo "changed-files.json not found"
181+ fi
182+
171183 - name : Upload artifacts
172184 uses : actions/upload-artifact@v4
173185 with :
@@ -263,7 +275,6 @@ jobs:
263275 uses : actions/checkout@v4
264276
265277 - name : Download artifacts
266- if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
267278 uses : actions/download-artifact@v4
268279 with :
269280 name : changed-demos
@@ -305,47 +316,78 @@ jobs:
305316 - name : Install tgz
306317 run : pnpm add -w ./devextreme-installer.tgz ./devextreme-dist-installer.tgz ./devextreme-react-installer.tgz ./devextreme-vue-installer.tgz ./devextreme-angular-installer.tgz
307318
308- - uses : actions/setup-dotnet@v4
309- with :
310- dotnet-version : 5.0.408
319+ - name : Run lint on all demos
320+ if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'force all tests')
321+ working-directory : apps/demos
322+ env :
323+ DEBUG : ' eslint:cli-engine,stylelint:standalone'
324+ run : ${{ matrix.command }}
311325
312- - name : Prepare dotnet
326+ - name : Run lint on changed demos
327+ if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
328+ working-directory : apps/demos
329+ env :
330+ DEBUG : ' eslint:cli-engine,stylelint:standalone'
313331 run : |
314- dotnet new globaljson --sdk-version 5.0.408
315- dotnet tool install -g dotnet-format --version 5.1.225507
332+ pnpx nx lint-non-demos
333+
334+ if [ -f "changed-files.json" ]; then
335+ echo "Running lint-demos on changed files"
336+ CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json | grep '^apps/demos/Demos/' | sed 's|^apps/demos/||' | tr '\n' ' ')
337+ if [ ! -z "$CHANGED_DEMOS" ]; then
338+ echo "Changed demo files: $CHANGED_DEMOS"
339+ pnpx eslint $CHANGED_DEMOS
340+ else
341+ echo "No demo files changed, skipping lint-demos"
342+ fi
343+ else
344+ echo "changed-files.json not found"
345+ pnpm run lint-demos
346+ fi
316347
317- - name : Run lint
348+ - name : Run lint on changed demos
349+ if : github.event_name != 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
318350 working-directory : apps/demos
319351 env :
320- CHANGEDFILEINFOSPATH : changed-files.json
321352 DEBUG : ' eslint:cli-engine,stylelint:standalone'
322- run : ${{ matrix.command }}
353+ run : |
354+ pnpx nx lint-non-demos
355+
356+ if [ -f "changed-files.json" ]; then
357+ echo "Running lint-demos on changed files"
358+ CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json | grep '^apps/demos/Demos/' | sed 's|^apps/demos/||' | tr '\n' ' ')
359+ if [ ! -z "$CHANGED_DEMOS" ]; then
360+ echo "Changed demo files: $CHANGED_DEMOS"
361+ pnpx eslint $CHANGED_DEMOS
362+ else
363+ echo "No demo files changed, skipping lint-demos"
364+ fi
323365
324366 check_generated_demos :
325367 name : ${{ matrix.name }}
326368 runs-on : ubuntu-22.04
327369 timeout-minutes : 10
328- needs : build-demos
370+ needs :
371+ - build-devextreme
372+ - get-changes
329373
330374 strategy :
331375 fail-fast : false
332376 matrix :
333377 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
378+ - name : Check generated demos
379+ command : pnpm run convert-to-js
344380
345381 steps :
346382 - name : Get sources
347383 uses : actions/checkout@v4
348384
385+ - name : Download artifacts
386+ uses : actions/download-artifact@v4
387+ with :
388+ name : changed-demos
389+ path : apps/demos
390+
349391 - uses : pnpm/action-setup@v3
350392 with :
351393 version : 9
@@ -357,21 +399,6 @@ jobs:
357399 node-version : ' 20'
358400 cache : ' pnpm'
359401
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-
375402 - name : Download devextreme sources
376403 uses : actions/download-artifact@v4
377404 with :
@@ -388,10 +415,37 @@ jobs:
388415 working-directory : apps/demos
389416 run : pnpm run prepare-js
390417
418+ - name : Download changed demos info
419+ uses : actions/download-artifact@v4
420+ with :
421+ name : changed-demos
422+ path : apps/demos
423+
391424 - name : Check generated JS demos
392425 working-directory : apps/demos
393426 run : |
394- ${{ matrix.command }}
427+ if [ -f "changed-files.json" ]; then
428+ echo "Running convert-to-js on changed files only"
429+
430+ CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json | grep '/React/' | grep '\.tsx$' | sed 's|^apps/demos/||' | sed 's|/[^/]*\.tsx$||' | sort | uniq)
431+
432+ if [ -z "$CHANGED_DEMOS" ]; then
433+ echo "No React demos found in changed files, skipping conversion"
434+ else
435+ echo "Changed React demos:"
436+ echo "$CHANGED_DEMOS"
437+
438+ echo "$CHANGED_DEMOS" | while read -r demo_dir; do
439+ if [ ! -z "$demo_dir" ]; then
440+ echo "Converting: $demo_dir"
441+ pnpm run convert-to-js "$demo_dir"
442+ fi
443+ done
444+ fi
445+ else
446+ echo "Running convert-to-js on all files"
447+ ${{ matrix.command }}
448+ fi
395449
396450 git add ./Demos -N
397451
@@ -405,6 +459,7 @@ jobs:
405459
406460 testcafe :
407461 needs : build-demos
462+ if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'force all tests')
408463 strategy :
409464 fail-fast : false
410465 matrix :
@@ -436,7 +491,6 @@ jobs:
436491 name : devextreme-sources
437492
438493 - name : Download artifacts
439- if : github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
440494 uses : actions/download-artifact@v4
441495 with :
442496 name : changed-demos
@@ -469,9 +523,6 @@ jobs:
469523 working-directory : apps/demos
470524 run : pnpm add ../../devextreme-installer.tgz ../../devextreme-dist-installer.tgz ../../devextreme-react-installer.tgz ../../devextreme-vue-installer.tgz ../../devextreme-angular-installer.tgz
471525
472- # - name: Build wrappers
473- # run: pnpm exec nx run-many -t pack -p devextreme-angular devextreme-react devetreme-vue
474-
475526 - name : Prepare JS
476527 working-directory : apps/demos
477528 run : pnpm run prepare-js
0 commit comments