[ci] Skip irrelevant jobs for test-only PRs
This PR optimizes GitHub Actions workflows for PRs that only change test
files in `test/e2e`, `test/development`, `test/integration`,
`test/production`, or `test/unit` directories. For test-only PRs, only
essential jobs run: builds, linting, type checking, unit test jobs, and
flake detection and deployment tests for the affected changes. This
reduces CI costs and execution time. The implementation follows the
existing docs-only pattern for consistency. It also enhances the logic
to detect related tests when fixtures or supporting files are changed by
searching upward to find the nearest directory containing test files.