From 420c2e37c21d123e1fb88bb64e68070305efd7c5 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Fri, 4 Apr 2025 17:13:21 -0500 Subject: [PATCH] [GitHub] Add path filters to avoid unnecessarily re-running tests (#5497) * Add path filters to avoid unnecessarily re-running tests * Apply suggestions from kev's review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update .github/workflows/tests.yml Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Don't ignore image files for tests --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- .github/workflows/tests.yml | 48 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 167a108e58c..ccc8604ff7e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,18 +5,58 @@ on: # but only for the main branch push: branches: - - main # Trigger on push events to the main branch + - main # Trigger on push events to the main branch - beta # Trigger on push events to the beta branch + # go upvote https://github.com/actions/runner/issues/1182 and yell at microsoft until they fix this or ditch yml for workflows + paths: + # src and test files + - "src/**" + - "test/**" + - "public/**" + # Workflows that can impact tests + - ".github/workflows/test*.yml" + # top-level files + - "package*.json" + - ".nvrmc" # Updates to node version can break tests + - "vite.*.ts" # vite.config.ts, vite.vitest.config.ts, vitest.workspace.ts + - "tsconfig*.json" # tsconfig.json tweaking can impact compilation + - "global.d.ts" + - ".env.*" + # Blanket negations for files that cannot impact tests + - "!**/*.py" # No .py files + - "!**/*.sh" # No .sh files + - "!**/*.md" # No .md files + - "!**/.git*" # .gitkeep and family + pull_request: branches: - - main # Trigger on pull request events targeting the main branch + - main # Trigger on pull request events targeting the main branch - beta # Trigger on pull request events targeting the beta branch + paths: # go upvote https://github.com/actions/runner/issues/1182 and yell at microsoft because until then we have to duplicate this + # src and test files + - "src/**" + - "test/**" + - "public/**" + # Workflows that can impact tests + - ".github/workflows/test*.yml" + # top-level files + - "package*.json" + - ".nvrmc" # Updates to node version can break tests + - "vite*" # vite.config.ts, vite.vitest.config.ts, vitest.workspace.ts + - "tsconfig*.json" # tsconfig.json tweaking can impact compilation + - "global.d.ts" + - ".env.*" + # Blanket negations for files that cannot impact tests + - "!**/*.py" # No .py files + - "!**/*.sh" # No .sh files + - "!**/*.md" # No .md files + - "!**/.git*" # .gitkeep and family merge_group: types: [checks_requested] jobs: run-tests: - name: Run Tests + name: Run Tests strategy: matrix: shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] @@ -24,4 +64,4 @@ jobs: with: project: main shard: ${{ matrix.shard }} - totalShards: 10 \ No newline at end of file + totalShards: 10