diff --git a/.github/test-filters.yml b/.github/test-filters.yml new file mode 100644 index 00000000000..89f4322adea --- /dev/null +++ b/.github/test-filters.yml @@ -0,0 +1,19 @@ +all: + - "src/**" + - "test/**" + - "public/**" + # Workflows that can impact tests + - ".github/workflows/test*.yml" + - ".github/test-filters.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 diff --git a/.github/workflows/test-shard-template.yml b/.github/workflows/test-shard-template.yml index cee452f3a59..a1146cb3497 100644 --- a/.github/workflows/test-shard-template.yml +++ b/.github/workflows/test-shard-template.yml @@ -12,11 +12,16 @@ on: totalShards: required: true type: number + skip: + required: true + type: boolean + default: false jobs: test: name: Shard ${{ inputs.shard }} of ${{ inputs.totalShards }} runs-on: ubuntu-latest + if: ${{ !inputs.skip }} steps: - name: Check out Git repository uses: actions/checkout@v4.2.2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d9db8401f8e..f04a1987eff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,58 +7,30 @@ on: branches: - main # Trigger on push events to the main branch - beta # Trigger on push events to the beta branch - - release # Trigger on push events to the release 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 - beta # Trigger on pull request events targeting the beta branch - - release # Trigger on pull request events targeting the release 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: + check-path-change-filter: + runs-on: ubuntu-latest + permissions: + pull-requests: read + outputs: + all: ${{ steps.filter.outputs.all }} + steps: + - name: checkout + uses: actions/checkout@v4 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 + with: + filters: .github/test-filters.yml + run-tests: name: Run Tests + needs: check-path-change-filter strategy: matrix: shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] @@ -67,3 +39,4 @@ jobs: project: main shard: ${{ matrix.shard }} totalShards: 10 + skip: ${{ needs.check-path-change-filter.outputs.all == 'false'}}