Skip to content

Commit bb83330

Browse files
CI: Skip demo framework tests when no changes detected or 'force all tests' is false (#31322)
1 parent 4157bb8 commit bb83330

1 file changed

Lines changed: 44 additions & 14 deletions

File tree

.github/workflows/demos_visual_tests_frameworks.yml

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ jobs:
153153

154154
get-changes:
155155
runs-on: ubuntu-22.04
156+
if: github.event_name == 'pull_request'
156157
name: Get changed demos
157158
timeout-minutes: 5
158159

@@ -256,6 +257,7 @@ jobs:
256257
uses: actions/checkout@v4
257258

258259
- name: Download artifacts
260+
if: github.event_name == 'pull_request'
259261
uses: actions/download-artifact@v4
260262
with:
261263
name: changed-demos
@@ -325,13 +327,52 @@ jobs:
325327
pnpm run lint-demos
326328
fi
327329
330+
- name: Run lint on changed demos
331+
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
332+
working-directory: apps/demos
333+
env:
334+
DEBUG: 'eslint:cli-engine,stylelint:standalone'
335+
run: |
336+
pnpx nx lint-non-demos
337+
338+
if [ -f "changed-files.json" ]; then
339+
echo "Running lint-demos on changed files"
340+
CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json | grep '^apps/demos/Demos/' | sed 's|^apps/demos/||' | tr '\n' ' ')
341+
if [ ! -z "$CHANGED_DEMOS" ]; then
342+
echo "Changed demo files: $CHANGED_DEMOS"
343+
pnpx eslint $CHANGED_DEMOS
344+
else
345+
echo "No demo files changed, skipping lint-demos"
346+
fi
347+
else
348+
echo "changed-files.json not found"
349+
pnpm run lint-demos
350+
fi
351+
352+
- name: Run lint on changed demos
353+
if: github.event_name != 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'force all tests')
354+
working-directory: apps/demos
355+
env:
356+
DEBUG: 'eslint:cli-engine,stylelint:standalone'
357+
run: |
358+
pnpx nx lint-non-demos
359+
360+
if [ -f "changed-files.json" ]; then
361+
echo "Running lint-demos on changed files"
362+
CHANGED_DEMOS=$(jq -r '.[].filename' changed-files.json | grep '^apps/demos/Demos/' | sed 's|^apps/demos/||' | tr '\n' ' ')
363+
if [ ! -z "$CHANGED_DEMOS" ]; then
364+
echo "Changed demo files: $CHANGED_DEMOS"
365+
pnpx eslint $CHANGED_DEMOS
366+
else
367+
echo "No demo files changed, skipping lint-demos"
368+
fi
369+
328370
check_generated_demos:
329371
name: ${{ matrix.name }}
330372
runs-on: ubuntu-22.04
331373
timeout-minutes: 10
332374
needs:
333375
- build-devextreme
334-
- get-changes
335376

336377
strategy:
337378
fail-fast: false
@@ -345,6 +386,7 @@ jobs:
345386
uses: actions/checkout@v4
346387

347388
- name: Download artifacts
389+
if: github.event_name == 'pull_request'
348390
uses: actions/download-artifact@v4
349391
with:
350392
name: changed-demos
@@ -376,12 +418,6 @@ jobs:
376418
working-directory: apps/demos
377419
run: pnpm run prepare-js
378420

379-
- name: Download changed demos info
380-
uses: actions/download-artifact@v4
381-
with:
382-
name: changed-demos
383-
path: apps/demos
384-
385421
- name: Check generated JS demos
386422
working-directory: apps/demos
387423
run: |
@@ -420,7 +456,7 @@ jobs:
420456
421457
testcafe:
422458
needs: build-demos
423-
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'force all tests')
459+
if: contains(github.event.pull_request.labels.*.name, 'force all tests')
424460
strategy:
425461
fail-fast: false
426462
matrix:
@@ -451,12 +487,6 @@ jobs:
451487
with:
452488
name: devextreme-sources
453489

454-
- name: Download artifacts
455-
uses: actions/download-artifact@v4
456-
with:
457-
name: changed-demos
458-
path: apps/demos
459-
460490
- uses: pnpm/action-setup@v4
461491
with:
462492
run_install: false

0 commit comments

Comments
 (0)